diff --git a/samples/fluid/src/main.c b/samples/fluid/src/main.c index aafdfbe..f805835 100644 --- a/samples/fluid/src/main.c +++ b/samples/fluid/src/main.c @@ -162,23 +162,23 @@ GLuint compile_shader(const char* vs, const char* fs) glGetProgramiv(prog, GL_LINK_STATUS, &status); if(status != GL_TRUE) { - log_error("program failed to link: "); + oc_log_error("program failed to link: "); int logSize = 0; glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logSize); - mem_arena_scope scratch = mem_scratch_begin(); - char* log = mem_arena_alloc(scratch.arena, logSize); + oc_arena_scope scratch = oc_scratch_begin(); + char* log = oc_arena_push(scratch.arena, logSize); glGetProgramInfoLog(prog, logSize, 0, log); - log_error("%s\n", log); + oc_log_error("%s\n", log); - mem_scratch_end(scratch); + oc_scratch_end(scratch); } int err = glGetError(); if(err) { - log_error("gl error %i\n", err); + oc_log_error("gl error %i\n", err); } return(prog); @@ -186,7 +186,7 @@ GLuint compile_shader(const char* vs, const char* fs) void init_advect(advect_program* program) { - log_info("compiling advect..."); + oc_log_info("compiling advect..."); program->prog = compile_shader(glsl_common_vertex, glsl_advect); program->pos = glGetAttribLocation(program->prog, "pos"); program->src = glGetUniformLocation(program->prog, "src"); @@ -197,7 +197,7 @@ void init_advect(advect_program* program) void init_div(div_program* program) { - log_info("compiling div..."); + oc_log_info("compiling div..."); program->prog = compile_shader(glsl_common_vertex, glsl_divergence); program->pos = glGetAttribLocation(program->prog, "pos"); program->src = glGetUniformLocation(program->prog, "src"); @@ -205,7 +205,7 @@ void init_div(div_program* program) void init_jacobi(jacobi_program* program) { - log_info("compiling jacobi..."); + oc_log_info("compiling jacobi..."); program->prog = compile_shader(glsl_common_vertex, glsl_jacobi_step); program->pos = glGetAttribLocation(program->prog, "pos"); program->xTex = glGetUniformLocation(program->prog, "xTex"); @@ -214,7 +214,7 @@ void init_jacobi(jacobi_program* program) void init_multigrid_restrict_residual(multigrid_restrict_residual_program* program) { - log_info("compiling multigrid restrict residual..."); + oc_log_info("compiling multigrid restrict residual..."); program->prog = compile_shader(glsl_common_vertex, glsl_multigrid_restrict_residual); program->pos = glGetAttribLocation(program->prog, "pos"); program->xTex = glGetUniformLocation(program->prog, "xTex"); @@ -223,7 +223,7 @@ void init_multigrid_restrict_residual(multigrid_restrict_residual_program* progr void init_multigrid_correct(multigrid_correct_program* program) { - log_info("compiling multigrid correct..."); + oc_log_info("compiling multigrid correct..."); program->prog = compile_shader(glsl_common_vertex, glsl_multigrid_correct); program->pos = glGetAttribLocation(program->prog, "pos"); program->src = glGetUniformLocation(program->prog, "src"); @@ -233,7 +233,7 @@ void init_multigrid_correct(multigrid_correct_program* program) void init_subtract(subtract_program* program) { - log_info("compiling subtract..."); + oc_log_info("compiling subtract..."); program->prog = compile_shader(glsl_common_vertex, glsl_subtract_pressure); program->pos = glGetAttribLocation(program->prog, "pos"); program->src = glGetUniformLocation(program->prog, "src"); @@ -243,7 +243,7 @@ void init_subtract(subtract_program* program) void init_splat(splat_program* program) { - log_info("compiling splat..."); + oc_log_info("compiling splat..."); program->prog = compile_shader(glsl_common_vertex, glsl_splat); program->pos = glGetAttribLocation(program->prog, "pos"); program->src = glGetUniformLocation(program->prog, "src"); @@ -257,7 +257,7 @@ void init_splat(splat_program* program) void init_blit(blit_program* program) { - log_info("compiling blit..."); + oc_log_info("compiling blit..."); program->prog = compile_shader(glsl_blit_vertex, glsl_blit_fragment); program->pos = glGetAttribLocation(program->prog, "pos"); program->mvp = glGetUniformLocation(program->prog, "mvp"); @@ -267,7 +267,7 @@ void init_blit(blit_program* program) void init_blit_div(blit_program* program) { - log_info("compiling blit div..."); + oc_log_info("compiling blit div..."); program->prog = compile_shader(glsl_blit_div_vertex, glsl_blit_div_fragment); program->pos = glGetAttribLocation(program->prog, "pos"); program->mvp = glGetUniformLocation(program->prog, "mvp"); @@ -276,7 +276,7 @@ void init_blit_div(blit_program* program) void init_blit_residue(blit_residue_program* program) { - log_info("compiling blit residue..."); + oc_log_info("compiling blit residue..."); program->prog = compile_shader(glsl_blit_div_vertex, glsl_blit_residue_fragment); program->pos = glGetAttribLocation(program->prog, "pos"); program->mvp = glGetUniformLocation(program->prog, "mvp"); @@ -325,7 +325,7 @@ void init_frame_buffer(frame_buffer* framebuffer, GLenum err = glCheckFramebufferStatus(GL_FRAMEBUFFER); if(err != GL_FRAMEBUFFER_COMPLETE) { - log_info("Frame buffer incomplete, %i", err); + oc_log_info("Frame buffer incomplete, %i", err); } } @@ -372,7 +372,7 @@ static bool resetCmd = false; void reset() { // resetCmd = true; - log_info("reset"); + oc_log_info("reset"); reset_texture(colorBuffer.textures[0], texWidth, texHeight, (char*)colorInitData); reset_texture(colorBuffer.textures[1], texWidth, texHeight, (char*)colorInitData); @@ -407,17 +407,17 @@ int frameWidth = 800; int frameHeight = 600; -ORCA_EXPORT void OnMouseDown(int button) +ORCA_EXPORT void oc_on_mouse_down(int button) { mouseInput.down = true; } -ORCA_EXPORT void OnMouseUp(int button) +ORCA_EXPORT void oc_on_mouse_up(int button) { mouseInput.down = false; } -ORCA_EXPORT void OnMouseMove(float x, float y, float dx, float dy) +ORCA_EXPORT void oc_on_mouse_move(float x, float y, float dx, float dy) { mouseInput.x = x * 2; mouseInput.y = y * 2; @@ -611,14 +611,14 @@ void input_splat(float t) float testDiv[texWidth/2][texWidth/2][4]; -mg_surface surface; +oc_surface surface; -ORCA_EXPORT void OnInit() +ORCA_EXPORT void oc_on_init() { - log_info("Hello, world (from C)"); + oc_log_info("Hello, world (from C)"); - surface = mg_surface_gles(); - mg_surface_prepare(surface); + surface = oc_surface_gles(); + oc_surface_select(surface); // init_color_checker(); // init_velocity_vortex(); @@ -637,17 +637,17 @@ ORCA_EXPORT void OnInit() init_blit_div(&blitDivProgram); // init frame buffers - log_info("create color buffer"); + oc_log_info("create color buffer"); init_frame_buffer(&colorBuffer, texWidth, texHeight, TEX_INTERNAL_FORMAT, TEX_FORMAT, TEX_TYPE, (char*)colorInitData); - log_info("create velocity buffer"); + oc_log_info("create velocity buffer"); init_frame_buffer(&velocityBuffer, texWidth, texHeight, TEX_INTERNAL_FORMAT, TEX_FORMAT, TEX_TYPE, (char*)velocityInitData); int gridFactor = 1; for(int i=0; i -vec2 frameSize = {100, 100}; +oc_vec2 frameSize = {100, 100}; -mg_surface surface; +oc_surface surface; unsigned int program; @@ -31,26 +31,24 @@ void compile_shader(GLuint shader, const char* source) int err = glGetError(); if(err) { - log_info("gl error"); + oc_log_info("gl error"); } } -char* ORCA_IMPORT(orca_mem_grow)(u64 size); - -ORCA_EXPORT void OnInit(void) +ORCA_EXPORT void oc_on_init(void) { - surface = mg_surface_gles(); - mg_surface_prepare(surface); + surface = oc_surface_gles(); + oc_surface_select(surface); const char* extensions = (const char*)glGetString(GL_EXTENSIONS); - log_info("GLES extensions: %s\n", extensions); + oc_log_info("GLES extensions: %s\n", extensions); int extensionCount = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &extensionCount); for(int i=0; i= frameSize.x) { velocity.x = -velocity.x; @@ -189,13 +189,13 @@ ORCA_EXPORT void OnFrameRefresh(void) f32 t = ((ball.x + ball.w/2) - paddle.x) / paddle.w; f32 launchAngle = lerp(-PADDLE_MAX_LAUNCH_ANGLE, PADDLE_MAX_LAUNCH_ANGLE, t); f32 speed = sqrtf(velocity.x*velocity.x + velocity.y*velocity.y); - velocity = (vec2){ + velocity = (oc_vec2){ sinf(launchAngle) * speed, cosf(launchAngle) * speed, }; ball.y = paddle.y + paddle.h; - log_info("PONG!"); + oc_log_info("PONG!"); } if (ball.y <= 0) { @@ -208,10 +208,10 @@ ORCA_EXPORT void OnFrameRefresh(void) continue; } - mp_rect r = blockRect(i); + oc_rect r = blockRect(i); int result = checkCollision(r); if (result) { - log_info("Collision! direction=%d", result); + oc_log_info("Collision! direction=%d", result); blockHealth[i] -= 1; f32 vx = velocity.x; @@ -241,74 +241,74 @@ ORCA_EXPORT void OnFrameRefresh(void) } - mg_canvas_set_current(canvas); + oc_canvas_set_current(canvas); - mg_set_color_rgba(10.0f/255.0f, 31.0f/255.0f, 72.0f/255.0f, 1); - mg_clear(); + oc_set_color_rgba(10.0f/255.0f, 31.0f/255.0f, 72.0f/255.0f, 1); + oc_clear(); - mg_image_draw(waterImage, (mp_rect){0, 0, frameSize.x, frameSize.y}); + oc_image_draw(waterImage, (oc_rect){0, 0, frameSize.x, frameSize.y}); - mg_mat2x3 yUp = { + oc_mat2x3 yUp = { 1, 0, 0, 0, -1, frameSize.y, }; - mg_matrix_push(yUp); + oc_matrix_push(yUp); { for (int i = 0; i < NUM_BLOCKS; i++) { if (blockHealth[i] <= 0) { continue; } - mp_rect r = blockRect(i); - mg_set_color_rgba(0, 0, 0, 0.2); - mg_rounded_rectangle_fill(r.x, r.y-2, r.w, r.h, 4); - mg_set_color_rgba(0.9, 0.9, 0.9, 1); - mg_rounded_rectangle_fill(r.x, r.y, r.w, r.h, 4); + oc_rect r = blockRect(i); + oc_set_color_rgba(0, 0, 0, 0.2); + oc_rounded_rectangle_fill(r.x, r.y-2, r.w, r.h, 4); + oc_set_color_rgba(0.9, 0.9, 0.9, 1); + oc_rounded_rectangle_fill(r.x, r.y, r.w, r.h, 4); int fontSize = 18; - str8 text = str8_pushf(mem_scratch(), + oc_str8 text = oc_str8_pushf(oc_scratch(), "%d", blockHealth[i] ); - mp_rect textRect = mg_text_bounding_box(pongFont, fontSize, text); + oc_rect textRect = oc_text_bounding_box(pongFont, fontSize, text); - vec2 textPos = { + oc_vec2 textPos = { r.x + r.w/2 - textRect.w/2, - r.y + 9, // TODO: mg_text_bounding_box is returning extremely wack results for height. + r.y + 9, // TODO: oc_text_bounding_box is returning extremely wack results for height. }; - mg_set_color_rgba(0, 0, 0, 1); - mg_set_font(pongFont); - mg_set_font_size(18); - mg_move_to(textPos.x, textPos.y); - mg_matrix_push(flipYAt(textPos)); + oc_set_color_rgba(0, 0, 0, 1); + oc_set_font(pongFont); + oc_set_font_size(18); + oc_move_to(textPos.x, textPos.y); + oc_matrix_push(flipYAt(textPos)); { - mg_text_outlines(text); - mg_fill(); + oc_text_outlines(text); + oc_fill(); } - mg_matrix_pop(); + oc_matrix_pop(); } - mg_set_color_rgba(0.9, 0.9, 0.9, 1); - mg_rounded_rectangle_fill(paddle.x, paddle.y, paddle.w, paddle.h, 4); + oc_set_color_rgba(0.9, 0.9, 0.9, 1); + oc_rounded_rectangle_fill(paddle.x, paddle.y, paddle.w, paddle.h, 4); - mg_matrix_push(flipY(ball)); + oc_matrix_push(flipY(ball)); { - mg_image_draw(ballImage, ball); + oc_image_draw(ballImage, ball); } - mg_matrix_pop(); + oc_matrix_pop(); } - mg_matrix_pop(); + oc_matrix_pop(); - mg_surface_prepare(surface); - mg_render(surface, canvas); - mg_surface_present(surface); + oc_surface_select(surface); + oc_render(surface, canvas); + oc_surface_present(surface); } -mp_rect blockRect(int i) { +oc_rect blockRect(int i) { int row = i / NUM_BLOCKS_PER_ROW; int col = i % NUM_BLOCKS_PER_ROW; - return (mp_rect){ + return (oc_rect){ BLOCKS_PADDING + (BLOCKS_PADDING + BLOCK_WIDTH) * col, BLOCKS_BOTTOM + (BLOCKS_PADDING + BLOCK_HEIGHT) * row, BLOCK_WIDTH, @@ -318,7 +318,7 @@ mp_rect blockRect(int i) { // Returns a cardinal direction 1-8 for the collision with the block, or zero // if no collision. 1 is straight up and directions proceed clockwise. -int checkCollision(mp_rect block) { +int checkCollision(oc_rect block) { // Note that all the logic for this game has the origin in the bottom left. f32 ballx2 = ball.x + ball.w; @@ -355,8 +355,8 @@ int checkCollision(mp_rect block) { // // We assume significant tunneling can't happen. - vec2 ballCenter = (vec2){ball.x + ball.w/2, ball.y + ball.h/2}; - vec2 blockCenter = (vec2){block.x + block.w/2, block.y + block.h/2}; + oc_vec2 ballCenter = (oc_vec2){ball.x + ball.w/2, ball.y + ball.h/2}; + oc_vec2 blockCenter = (oc_vec2){block.x + block.w/2, block.y + block.h/2}; // Moving right if (velocity.x > 0) { @@ -445,15 +445,15 @@ f32 lerp(f32 a, f32 b, f32 t) { return (1 - t) * a + t * b; } -mg_mat2x3 flipY(mp_rect r) { - return (mg_mat2x3){ +oc_mat2x3 flipY(oc_rect r) { + return (oc_mat2x3){ 1, 0, 0, 0, -1, 2 * r.y + r.h, }; } -mg_mat2x3 flipYAt(vec2 pos) { - return (mg_mat2x3){ +oc_mat2x3 flipYAt(oc_vec2 pos) { + return (oc_mat2x3){ 1, 0, 0, 0, -1, 2 * pos.y, }; diff --git a/samples/ui/src/main.c b/samples/ui/src/main.c index 547f8b0..22aa7c2 100644 --- a/samples/ui/src/main.c +++ b/samples/ui/src/main.c @@ -1,230 +1,229 @@ #include"orca.h" -vec2 frameSize = {100, 100}; +oc_vec2 frameSize = {100, 100}; -mg_surface surface; -mg_canvas canvas; -mg_font font; -ui_context ui; -mem_arena textArena = {0}; +oc_surface surface; +oc_canvas canvas; +oc_font font; +oc_ui_context ui; +oc_arena textArena = {0}; -ORCA_EXPORT void OnInit(void) +ORCA_EXPORT void oc_on_init(void) { - //TODO create surface for main window - surface = mg_surface_canvas(); - canvas = mg_canvas_create(); - ui_init(&ui); + surface = oc_surface_canvas(); + canvas = oc_canvas_create(); + oc_ui_init(&ui); //NOTE: load font { - file_handle file = file_open(STR8("/OpenSansLatinSubset.ttf"), FILE_ACCESS_READ, 0); - if(file_last_error(file) != IO_OK) + oc_file file = oc_file_open(OC_STR8("/OpenSansLatinSubset.ttf"), OC_FILE_ACCESS_READ, 0); + if(oc_file_last_error(file) != OC_IO_OK) { - log_error("Couldn't open file OpenSansLatinSubset.ttf\n"); + oc_log_error("Couldn't open file OpenSansLatinSubset.ttf\n"); } - u64 size = file_size(file); - char* buffer = mem_arena_alloc(mem_scratch(), size); - file_read(file, size, buffer); - file_close(file); - unicode_range ranges[5] = {UNICODE_RANGE_BASIC_LATIN, - UNICODE_RANGE_C1_CONTROLS_AND_LATIN_1_SUPPLEMENT, - UNICODE_RANGE_LATIN_EXTENDED_A, - UNICODE_RANGE_LATIN_EXTENDED_B, - UNICODE_RANGE_SPECIALS}; + u64 size = oc_file_size(file); + char* buffer = oc_arena_push(oc_scratch(), size); + oc_file_read(file, size, buffer); + oc_file_close(file); + oc_unicode_range ranges[5] = {OC_UNICODE_BASIC_LATIN, + OC_UNICODE_C1_CONTROLS_AND_LATIN_1_SUPPLEMENT, + OC_UNICODE_LATIN_EXTENDED_A, + OC_UNICODE_LATIN_EXTENDED_B, + OC_UNICODE_SPECIALS}; // TODO: Decide whether we're using strings or explicit pointer + length - font = mg_font_create_from_memory(size, (byte*)buffer, 5, ranges); + font = oc_font_create_from_memory(oc_str8_from_buffer(size, buffer), 5, ranges); } - mem_arena_clear(mem_scratch()); - mem_arena_init(&textArena); + oc_arena_clear(oc_scratch()); + oc_arena_init(&textArena); } -ORCA_EXPORT void OnFrameResize(u32 width, u32 height) +ORCA_EXPORT void oc_on_resize(u32 width, u32 height) { - log_info("frame resize %u, %u", width, height); + oc_log_info("frame resize %u, %u", width, height); frameSize.x = width; frameSize.y = height; } -ORCA_EXPORT void OnRawEvent(mp_event *event) +ORCA_EXPORT void oc_on_raw_event(oc_event *event) { - ui_process_event(event); + oc_ui_process_event(event); } void widget_begin_view(char* str) { - ui_style_next(&(ui_style){.layout.axis = UI_AXIS_Y, + oc_ui_style_next(&(oc_ui_style){.layout.axis = OC_UI_AXIS_Y, .layout.spacing = 10, .layout.margin.x = 10, .layout.margin.y = 10, - .layout.align.x = UI_ALIGN_CENTER, - .layout.align.y = UI_ALIGN_START}, - UI_STYLE_LAYOUT); + .layout.align.x = OC_UI_ALIGN_CENTER, + .layout.align.y = OC_UI_ALIGN_START}, + OC_UI_STYLE_LAYOUT); - ui_box_begin(str, UI_FLAG_DRAW_BORDER); - ui_label(str); + oc_ui_box_begin(str, OC_UI_FLAG_DRAW_BORDER); + oc_ui_label(str); } void widget_end_view(void) { - ui_box_end(); + oc_ui_box_end(); } -#define widget_view(s) defer_loop(widget_begin_view(s), widget_end_view()) +#define widget_view(s) oc_defer_loop(widget_begin_view(s), widget_end_view()) -ORCA_EXPORT void OnFrameRefresh(void) +ORCA_EXPORT void oc_on_frame_refresh(void) { - ui_style defaultStyle = {.bgColor = {0}, + oc_ui_style defaultStyle = {.bgColor = {0}, .color = {1, 1, 1, 1}, .font = font, .fontSize = 16, .borderColor = {0.278, 0.333, 0.412, 1}, .borderSize = 2}; - ui_style_mask defaultMask = UI_STYLE_BG_COLOR - | UI_STYLE_COLOR - | UI_STYLE_BORDER_COLOR - | UI_STYLE_BORDER_SIZE - | UI_STYLE_FONT - | UI_STYLE_FONT_SIZE; + oc_ui_style_mask defaultMask = OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_COLOR + | OC_UI_STYLE_BORDER_COLOR + | OC_UI_STYLE_BORDER_SIZE + | OC_UI_STYLE_FONT + | OC_UI_STYLE_FONT_SIZE; - ui_frame(frameSize, &defaultStyle, defaultMask) + oc_ui_frame(frameSize, &defaultStyle, defaultMask) { - ui_style_match_before(ui_pattern_all(), &defaultStyle, defaultMask); + oc_ui_style_match_before(oc_ui_pattern_all(), &defaultStyle, defaultMask); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 1}, - .layout.axis = UI_AXIS_Y, - .layout.align.x = UI_ALIGN_CENTER, - .layout.align.y = UI_ALIGN_START, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 1}, + .layout.axis = OC_UI_AXIS_Y, + .layout.align.x = OC_UI_ALIGN_CENTER, + .layout.align.y = OC_UI_ALIGN_START, .layout.spacing = 10, .layout.margin.x = 10, .layout.margin.y = 10, .bgColor = {0.11, 0.11, 0.11, 1}}, - UI_STYLE_SIZE - | UI_STYLE_LAYOUT - | UI_STYLE_BG_COLOR); + OC_UI_STYLE_SIZE + | OC_UI_STYLE_LAYOUT + | OC_UI_STYLE_BG_COLOR); - ui_container("background", UI_FLAG_DRAW_BACKGROUND) + oc_ui_container("background", OC_UI_FLAG_DRAW_BACKGROUND) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_CHILDREN}, - .layout.align.x = UI_ALIGN_CENTER}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_ALIGN_X); - ui_container("title", 0) + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_CHILDREN}, + .layout.align.x = OC_UI_ALIGN_CENTER}, + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_ALIGN_X); + oc_ui_container("title", 0) { - ui_style_next(&(ui_style){.fontSize = 26}, UI_STYLE_FONT_SIZE); - ui_label("Orca UI Demo"); + oc_ui_style_next(&(oc_ui_style){.fontSize = 26}, OC_UI_STYLE_FONT_SIZE); + oc_ui_label("Orca UI Demo"); - if(ui_box_sig(ui_box_top()).hovering) + if(oc_ui_box_sig(oc_ui_box_top()).hovering) { - ui_tooltip("tooltip") + oc_ui_tooltip("tooltip") { - ui_style_next(&(ui_style){.bgColor = {1, 0.99, 0.82, 1}}, - UI_STYLE_BG_COLOR); + oc_ui_style_next(&(oc_ui_style){.bgColor = {1, 0.99, 0.82, 1}}, + OC_UI_STYLE_BG_COLOR); - ui_container("background", UI_FLAG_DRAW_BACKGROUND) + oc_ui_container("background", OC_UI_FLAG_DRAW_BACKGROUND) { - ui_style_next(&(ui_style){.color = {0, 0, 0, 1}}, - UI_STYLE_COLOR); + oc_ui_style_next(&(oc_ui_style){.color = {0, 0, 0, 1}}, + OC_UI_STYLE_COLOR); - ui_label("That is a tooltip!"); + oc_ui_label("That is a tooltip!"); } } } } - ui_menu_bar("Menu bar") + oc_ui_menu_bar("Menu bar") { - ui_menu("Menu 1") + oc_ui_menu("Menu 1") { - if(ui_menu_button("Option 1.1").pressed) + if(oc_ui_menu_button("Option 1.1").pressed) { - log_info("Pressed option 1.1\n"); + oc_log_info("Pressed option 1.1\n"); } - ui_menu_button("Option 1.2"); - ui_menu_button("Option 1.3"); - ui_menu_button("Option 1.4"); + oc_ui_menu_button("Option 1.2"); + oc_ui_menu_button("Option 1.3"); + oc_ui_menu_button("Option 1.4"); } - ui_menu("Menu 2") + oc_ui_menu("Menu 2") { - ui_menu_button("Option 2.1"); - ui_menu_button("Option 2.2"); - ui_menu_button("Option 2.3"); - ui_menu_button("Option 2.4"); + oc_ui_menu_button("Option 2.1"); + oc_ui_menu_button("Option 2.2"); + oc_ui_menu_button("Option 2.3"); + oc_ui_menu_button("Option 2.4"); } - ui_menu("Menu 3") + oc_ui_menu("Menu 3") { - ui_menu_button("Option 3.1"); - ui_menu_button("Option 3.2"); - ui_menu_button("Option 3.3"); - ui_menu_button("Option 3.4"); + oc_ui_menu_button("Option 3.1"); + oc_ui_menu_button("Option 3.2"); + oc_ui_menu_button("Option 3.3"); + oc_ui_menu_button("Option 3.4"); } } - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 1, 1}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 1, 1}}, + OC_UI_STYLE_SIZE); - ui_style_next(&(ui_style){.layout.axis = UI_AXIS_X}, UI_STYLE_LAYOUT_AXIS); - ui_container("contents", 0) + oc_ui_style_next(&(oc_ui_style){.layout.axis = OC_UI_AXIS_X}, OC_UI_STYLE_LAYOUT_AXIS); + oc_ui_container("contents", 0) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 0.5}, - .size.height = {UI_SIZE_PARENT, 1}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 0.5}, + .size.height = {OC_UI_SIZE_PARENT, 1}}, + OC_UI_STYLE_SIZE); - ui_container("left", 0) + oc_ui_container("left", 0) { - ui_style_next(&(ui_style){.layout.axis = UI_AXIS_X, + oc_ui_style_next(&(oc_ui_style){.layout.axis = OC_UI_AXIS_X, .layout.spacing = 10, .layout.margin.x = 10, .layout.margin.y = 10, - .size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 0.5}}, - UI_STYLE_LAYOUT_AXIS - |UI_STYLE_LAYOUT_SPACING - |UI_STYLE_LAYOUT_MARGIN_X - |UI_STYLE_LAYOUT_MARGIN_Y - |UI_STYLE_SIZE); + .size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 0.5}}, + OC_UI_STYLE_LAYOUT_AXIS + |OC_UI_STYLE_LAYOUT_SPACING + |OC_UI_STYLE_LAYOUT_MARGIN_X + |OC_UI_STYLE_LAYOUT_MARGIN_Y + |OC_UI_STYLE_SIZE); - ui_container("up", 0) + oc_ui_container("up", 0) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 0.5}, - .size.height = {UI_SIZE_PARENT, 1}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 0.5}, + .size.height = {OC_UI_SIZE_PARENT, 1}}, + OC_UI_STYLE_SIZE); widget_view("Buttons") { - if(ui_button("Button A").clicked) + if(oc_ui_button("Button A").clicked) { - log_info("A clicked"); + oc_log_info("A clicked"); } - if(ui_button("Button B").clicked) + if(oc_ui_button("Button B").clicked) { - log_info("B clicked"); + oc_log_info("B clicked"); } - if(ui_button("Button C").clicked) + if(oc_ui_button("Button C").clicked) { - log_info("C clicked"); + oc_log_info("C clicked"); } } - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 0.5}, - .size.height = {UI_SIZE_PARENT, 1}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 0.5}, + .size.height = {OC_UI_SIZE_PARENT, 1}}, + OC_UI_STYLE_SIZE); - ui_pattern pattern = {0}; - ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TAG, .tag = ui_tag_make("checkbox")}); - ui_style_match_after(pattern, - &(ui_style){.bgColor = {0, 1, 0, 1}, + oc_ui_pattern pattern = {0}; + oc_ui_pattern_push(oc_scratch(), &pattern, (oc_ui_selector){.kind = OC_UI_SEL_TAG, .tag = oc_ui_tag_make("checkbox")}); + oc_ui_style_match_after(pattern, + &(oc_ui_style){.bgColor = {0, 1, 0, 1}, .color = {1, 1, 1, 1}}, - UI_STYLE_COLOR | UI_STYLE_BG_COLOR); + OC_UI_STYLE_COLOR | OC_UI_STYLE_BG_COLOR); widget_view("checkboxes") { @@ -232,156 +231,156 @@ ORCA_EXPORT void OnFrameRefresh(void) static bool check2 = false; static bool check3 = false; - ui_checkbox("check1", &check1); - ui_checkbox("check2", &check2); - ui_checkbox("check3", &check3); + oc_ui_checkbox("check1", &check1); + oc_ui_checkbox("check2", &check2); + oc_ui_checkbox("check3", &check3); } } - ui_style_next(&(ui_style){.layout.axis = UI_AXIS_X, - .size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 0.5}}, - UI_STYLE_LAYOUT_AXIS - |UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.layout.axis = OC_UI_AXIS_X, + .size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 0.5}}, + OC_UI_STYLE_LAYOUT_AXIS + |OC_UI_STYLE_SIZE); - ui_container("down", 0) + oc_ui_container("down", 0) { widget_view("Vertical Sliders") { - ui_style_next(&(ui_style){.layout.axis = UI_AXIS_X, + oc_ui_style_next(&(oc_ui_style){.layout.axis = OC_UI_AXIS_X, .layout.spacing = 10}, - UI_STYLE_LAYOUT_AXIS - |UI_STYLE_LAYOUT_SPACING); - ui_container("contents", 0) + OC_UI_STYLE_LAYOUT_AXIS + |OC_UI_STYLE_LAYOUT_SPACING); + oc_ui_container("contents", 0) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 20}, - .size.height = {UI_SIZE_PIXELS, 200}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 20}, + .size.height = {OC_UI_SIZE_PIXELS, 200}}, + OC_UI_STYLE_SIZE); static f32 slider1 = 0; - ui_slider("slider1", 0.2, &slider1); + oc_ui_slider("slider1", 0.2, &slider1); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 20}, - .size.height = {UI_SIZE_PIXELS, 200}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 20}, + .size.height = {OC_UI_SIZE_PIXELS, 200}}, + OC_UI_STYLE_SIZE); static f32 slider2 = 0; - ui_slider("slider2", 0.2, &slider2); + oc_ui_slider("slider2", 0.2, &slider2); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 20}, - .size.height = {UI_SIZE_PIXELS, 200}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 20}, + .size.height = {OC_UI_SIZE_PIXELS, 200}}, + OC_UI_STYLE_SIZE); static f32 slider3 = 0; - ui_slider("slider3", 0.2, &slider3); + oc_ui_slider("slider3", 0.2, &slider3); } } widget_view("Horizontal Sliders") { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 200}, - .size.height = {UI_SIZE_PIXELS, 20}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 200}, + .size.height = {OC_UI_SIZE_PIXELS, 20}}, + OC_UI_STYLE_SIZE); static f32 slider1 = 0; - ui_slider("slider1", 0.2, &slider1); + oc_ui_slider("slider1", 0.2, &slider1); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 200}, - .size.height = {UI_SIZE_PIXELS, 20}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 200}, + .size.height = {OC_UI_SIZE_PIXELS, 20}}, + OC_UI_STYLE_SIZE); static f32 slider2 = 0; - ui_slider("slider2", 0.2, &slider2); + oc_ui_slider("slider2", 0.2, &slider2); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 200}, - .size.height = {UI_SIZE_PIXELS, 20}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 200}, + .size.height = {OC_UI_SIZE_PIXELS, 20}}, + OC_UI_STYLE_SIZE); static f32 slider3 = 0; - ui_slider("slider3", 0.2, &slider3); + oc_ui_slider("slider3", 0.2, &slider3); } } } - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 0.5}, - .size.height = {UI_SIZE_PARENT, 1}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 0.5}, + .size.height = {OC_UI_SIZE_PARENT, 1}}, + OC_UI_STYLE_SIZE); - ui_container("right", 0) + oc_ui_container("right", 0) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 0.33}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 0.33}}, + OC_UI_STYLE_SIZE); widget_view("Text box") { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 300}, - .size.height = {UI_SIZE_TEXT}}, - UI_STYLE_SIZE); - static str8 text = {0}; - ui_text_box_result res = ui_text_box("textbox", mem_scratch(), text); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 300}, + .size.height = {OC_UI_SIZE_TEXT}}, + OC_UI_STYLE_SIZE); + static oc_str8 text = {0}; + oc_ui_text_box_result res = oc_ui_text_box("textbox", oc_scratch(), text); if(res.changed) { - mem_arena_clear(&textArena); - text = str8_push_copy(&textArena, res.text); + oc_arena_clear(&textArena); + text = oc_str8_push_copy(&textArena, res.text); } } - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 0.33}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 0.33}}, + OC_UI_STYLE_SIZE); widget_view("Test") { - ui_pattern pattern = {0}; - ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = STR8("panel")}); - ui_style_match_after(pattern, &(ui_style){.bgColor = {0.3, 0.3, 1, 1}}, UI_STYLE_BG_COLOR); + oc_ui_pattern pattern = {0}; + oc_ui_pattern_push(oc_scratch(), &pattern, (oc_ui_selector){.kind = OC_UI_SEL_TEXT, .text = OC_STR8("panel")}); + oc_ui_style_match_after(pattern, &(oc_ui_style){.bgColor = {0.3, 0.3, 1, 1}}, OC_UI_STYLE_BG_COLOR); static int selected = 0; - str8 options[] = {STR8("option 1"), - STR8("option 2"), - STR8("long option 3"), - STR8("option 4"), - STR8("option 5")}; - ui_select_popup_info info = {.selectedIndex = selected, + oc_str8 options[] = {OC_STR8("option 1"), + OC_STR8("option 2"), + OC_STR8("long option 3"), + OC_STR8("option 4"), + OC_STR8("option 5")}; + oc_ui_select_popup_info info = {.selectedIndex = selected, .optionCount = 5, .options = options}; - ui_select_popup_info result = ui_select_popup("popup", &info); + oc_ui_select_popup_info result = oc_ui_select_popup("popup", &info); selected = result.selectedIndex; } - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 0.33}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 0.33}}, + OC_UI_STYLE_SIZE); widget_view("Color") { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 0.7}, - .layout.axis = UI_AXIS_X}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_AXIS); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 0.7}, + .layout.axis = OC_UI_AXIS_X}, + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_AXIS); - ui_panel("Panel", UI_FLAG_DRAW_BORDER) + oc_ui_panel("Panel", OC_UI_FLAG_DRAW_BORDER) { - ui_style_next(&(ui_style){.layout.axis = UI_AXIS_X}, - UI_STYLE_LAYOUT_AXIS); - ui_container("contents", 0) + oc_ui_style_next(&(oc_ui_style){.layout.axis = OC_UI_AXIS_X}, + OC_UI_STYLE_LAYOUT_AXIS); + oc_ui_container("contents", 0) { - ui_style_next(&(ui_style){.layout.spacing = 20}, - UI_STYLE_LAYOUT_SPACING); - ui_container("buttons", 0) + oc_ui_style_next(&(oc_ui_style){.layout.spacing = 20}, + OC_UI_STYLE_LAYOUT_SPACING); + oc_ui_container("buttons", 0) { - ui_button("Button A"); - ui_button("Button B"); - ui_button("Button C"); - ui_button("Button D"); + oc_ui_button("Button A"); + oc_ui_button("Button B"); + oc_ui_button("Button C"); + oc_ui_button("Button D"); } - ui_style_next(&(ui_style){.layout.axis = UI_AXIS_X, + oc_ui_style_next(&(oc_ui_style){.layout.axis = OC_UI_AXIS_X, .layout.spacing = 20}, - UI_STYLE_LAYOUT_SPACING - |UI_STYLE_LAYOUT_AXIS); + OC_UI_STYLE_LAYOUT_SPACING + |OC_UI_STYLE_LAYOUT_AXIS); - ui_container("buttons2", 0) + oc_ui_container("buttons2", 0) { - ui_button("Button A"); - ui_button("Button B"); - ui_button("Button C"); - ui_button("Button D"); + oc_ui_button("Button A"); + oc_ui_button("Button B"); + oc_ui_button("Button C"); + oc_ui_button("Button D"); } } } @@ -393,9 +392,9 @@ ORCA_EXPORT void OnFrameRefresh(void) } - mg_canvas_set_current(canvas); - mg_surface_prepare(surface); - ui_draw(); - mg_render(surface, canvas); - mg_surface_present(surface); + oc_canvas_set_current(canvas); + oc_surface_select(surface); + oc_ui_draw(); + oc_render(surface, canvas); + oc_surface_present(surface); } diff --git a/scripts/bindgen.py b/scripts/bindgen.py index a946c2e..96d05f3 100755 --- a/scripts/bindgen.py +++ b/scripts/bindgen.py @@ -155,8 +155,8 @@ def bindgen(apiName, spec, **kwargs): if argTag == 'p' and argLen != None: s += '\t{\n' - s += '\t\tORCA_ASSERT(((char*)'+ argName + ' >= (char*)_mem) && (((char*)'+ argName +' - (char*)_mem) < m3_GetMemorySize(runtime)), "parameter \''+argName+'\' is out of bounds");\n' - s += '\t\tORCA_ASSERT((char*)' + argName + ' + ' + s += '\t\tOC_ASSERT(((char*)'+ argName + ' >= (char*)_mem) && (((char*)'+ argName +' - (char*)_mem) < m3_GetMemorySize(runtime)), "parameter \''+argName+'\' is out of bounds");\n' + s += '\t\tOC_ASSERT((char*)' + argName + ' + ' proc = argLen.get('proc') if proc != None: @@ -245,7 +245,7 @@ def bindgen(apiName, spec, **kwargs): s += ' res = m3_LinkRawFunction(module, "*", "' + name + '", "' + m3Sig + '", ' + cname + '_stub);\n' s += ' if(res != m3Err_none && res != m3Err_functionLookupFailed)\n' s += ' {\n' - s += ' log_error("Couldn\'t link function ' + name + ' (%s)\\n", res);\n' + s += ' oc_log_error("Couldn\'t link function ' + name + ' (%s)\\n", res);\n' s += ' ret = -1;\n' s += ' }\n\n' diff --git a/scripts/dev.py b/scripts/dev.py index a84dd18..4024fdd 100644 --- a/scripts/dev.py +++ b/scripts/dev.py @@ -137,7 +137,7 @@ def build_platform_layer_lib_win(release): subprocess.run([ "cl", "/nologo", "/we4013", "/Zi", "/Zc:preprocessor", - "/DMP_BUILD_DLL", + "/DOC_BUILD_DLL", "/std:c11", "/experimental:c11atomics", *includes, "src/orca.c", "/Fo:build/bin/orca.o", @@ -154,7 +154,7 @@ def build_platform_layer_lib_mac(release): flags = ["-mmacos-version-min=10.15.4", "-maes"] cflags = ["-std=c11"] - debug_flags = ["-O3"] if release else ["-g", "-DDEBUG", "-DLOG_COMPILE_DEBUG"] + debug_flags = ["-O3"] if release else ["-g", "-DOC_DEBUG", "-DOC_LOG_COMPILE_DEBUG"] ldflags = [f"-L{sdk_dir}/usr/lib", f"-F{sdk_dir}/System/Library/Frameworks/"] includes = ["-Isrc", "-Isrc/util", "-Isrc/platform", "-Iext", "-Iext/angle/include"] @@ -327,7 +327,7 @@ def build_orca_mac(release): "-Iext/wasm3/source" ] libs = ["-Lbuild/bin", "-Lbuild/lib", "-lorca", "-lwasm3"] - debug_flags = ["-O2"] if release else ["-g", "-DLOG_COMPILE_DEBUG"] + debug_flags = ["-O2"] if release else ["-g", "-DOC_DEBUG -DOC_LOG_COMPILE_DEBUG"] flags = [ *debug_flags, "-mmacos-version-min=10.15.4", diff --git a/scripts/glapi.py b/scripts/glapi.py index 75439ea..e4c4ec5 100644 --- a/scripts/glapi.py +++ b/scripts/glapi.py @@ -99,21 +99,21 @@ f.write('#include"GL/glcorearb.h"\n') f.write('#include"GLES3/gl32.h"\n\n') # generate interface struct -f.write('typedef struct mg_gl_api\n{\n') +f.write('typedef struct oc_gl_api\n{\n') f.write(' const char* name;\n') for func in glall: f.write('\t' + 'PFN' + func.upper() + 'PROC ' + remove_prefix(func, 'gl') + ';\n') -f.write('} mg_gl_api;\n\n') +f.write('} oc_gl_api;\n\n') # generate interface macros # TODO guard for different api/versions and only #define functions present in desired version -f.write("MP_API mg_gl_api* mg_gl_get_api(void);\n\n") +f.write("ORCA_API oc_gl_api* oc_gl_get_api(void);\n\n") for func in glall: - f.write('#define ' + func + ' mg_gl_get_api()->' + remove_prefix(func, 'gl') + '\n') + f.write('#define ' + func + ' oc_gl_get_api()->' + remove_prefix(func, 'gl') + '\n') emit_end_guard(f, apiName) f.close() @@ -129,15 +129,15 @@ emit_begin_guard(f, loaderName) f.write('#include"gl_api.h"\n\n') -f.write("typedef void*(*mg_gl_load_proc)(const char* name);\n\n") +f.write("typedef void*(*oc_gl_load_proc)(const char* name);\n\n") -f.write("void mg_gl_load_gl41(mg_gl_api* api, mg_gl_load_proc loadProc);\n") -f.write("void mg_gl_load_gl43(mg_gl_api* api, mg_gl_load_proc loadProc);\n") -f.write("void mg_gl_load_gl44(mg_gl_api* api, mg_gl_load_proc loadProc);\n") -f.write("void mg_gl_load_gles30(mg_gl_api* api, mg_gl_load_proc loadProc);\n") -f.write("void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc);\n\n") +f.write("void oc_gl_load_gl41(oc_gl_api* api, oc_gl_load_proc loadProc);\n") +f.write("void oc_gl_load_gl43(oc_gl_api* api, oc_gl_load_proc loadProc);\n") +f.write("void oc_gl_load_gl44(oc_gl_api* api, oc_gl_load_proc loadProc);\n") +f.write("void oc_gl_load_gles30(oc_gl_api* api, oc_gl_load_proc loadProc);\n") +f.write("void oc_gl_load_gles31(oc_gl_api* api, oc_gl_load_proc loadProc);\n\n") -f.write("void mg_gl_select_api(mg_gl_api* api);\n\n") +f.write("void oc_gl_select_api(oc_gl_api* api);\n\n") emit_end_guard(f, loaderName) f.close() @@ -146,7 +146,7 @@ f.close() #--------------------------------------------------------------- def emit_loader(f, name, procs): - f.write('void mg_gl_load_'+ name +'(mg_gl_api* api, mg_gl_load_proc loadProc)\n') + f.write('void oc_gl_load_'+ name +'(oc_gl_api* api, oc_gl_load_proc loadProc)\n') f.write("{\n") f.write(' api->name = "'+ name +'";\n') @@ -154,14 +154,14 @@ def emit_loader(f, name, procs): if proc in procs: f.write(' api->' + remove_prefix(proc, 'gl') + ' = loadProc("' + proc + '");\n') else: - f.write(' api->' + remove_prefix(proc, 'gl') + ' = mg_' + proc + '_noimpl;\n') + f.write(' api->' + remove_prefix(proc, 'gl') + ' = oc_' + proc + '_noimpl;\n') f.write("}\n\n") def emit_null_api(f, procs): - f.write('mg_gl_api __mgGLNoAPI;\n\n') + f.write('oc_gl_api oc_glNoAPI;\n\n') for name in procs: @@ -185,7 +185,7 @@ def emit_null_api(f, procs): retType = retType.strip() - f.write(retType + ' mg_' + name + '_noimpl(') + f.write(retType + ' oc_' + name + '_noimpl(') params = command.findall('param') @@ -217,21 +217,21 @@ def emit_null_api(f, procs): f.write(')\n') f.write('{\n') - f.write(' if(__mgGLAPI == &__mgGLNoAPI)\n') + f.write(' if(oc_glAPI == &oc_glNoAPI)\n') f.write(' {\n') - f.write(' log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\\n");\n') + f.write(' oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_prepare() before calling OpenGL API functions.\\n");\n') f.write(' }\n') f.write(' else\n') f.write(' {\n') - f.write(' log_error("'+ name +' is not part of currently selected %s API\\n", __mgGLAPI->name);\n') + f.write(' oc_log_error("'+ name +' is not part of currently selected %s API\\n", oc_glAPI->name);\n') f.write(' }\n') if retType != 'void': f.write(' return(('+ retType +')0);\n') f.write('}\n') - f.write('mg_gl_api __mgGLNoAPI = {\n') + f.write('oc_gl_api oc_glNoAPI = {\n') for proc in procs: - f.write(' .' + remove_prefix(proc, 'gl') + ' = mg_' + proc + '_noimpl,\n') + f.write(' .' + remove_prefix(proc, 'gl') + ' = oc_' + proc + '_noimpl,\n') f.write("};\n\n") f = open(loaderCPath, 'w') @@ -241,7 +241,7 @@ emit_doc(f, loaderName, '.c') f.write('#include"' + loaderName + '.h"\n') f.write('#include"platform/platform.h"\n\n') -f.write("mp_thread_local mg_gl_api* __mgGLAPI = 0;\n") +f.write("oc_thread_local oc_gl_api* oc_glAPI = 0;\n") emit_null_api(f, glall) emit_loader(f, 'gl41', gl41) @@ -250,8 +250,8 @@ emit_loader(f, 'gl44', gl44) emit_loader(f, 'gles31', gles31) emit_loader(f, 'gles32', gles32) -f.write("void mg_gl_select_api(mg_gl_api* api){ __mgGLAPI = api; }\n") -f.write("void mg_gl_deselect_api(){ __mgGLAPI = &__mgGLNoAPI; }\n") -f.write("mg_gl_api* mg_gl_get_api(void) { return(__mgGLAPI); }\n\n") +f.write("void oc_gl_select_api(oc_gl_api* api){ oc_glAPI = api; }\n") +f.write("void oc_gl_deselect_api(){ oc_glAPI = &oc_glNoAPI; }\n") +f.write("oc_gl_api* oc_gl_get_api(void) { return(oc_glAPI); }\n\n") f.close() diff --git a/sketches/atlas/build.sh b/sketches/atlas/build.sh index ab2560b..057a4b9 100755 --- a/sketches/atlas/build.sh +++ b/sketches/atlas/build.sh @@ -6,7 +6,7 @@ SRCDIR=../../src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_atlas main.c diff --git a/sketches/canvas/build.sh b/sketches/canvas/build.sh index 7092b38..99bbcfb 100755 --- a/sketches/canvas/build.sh +++ b/sketches/canvas/build.sh @@ -6,7 +6,7 @@ EXTDIR=../../ext INCLUDES="-I$SRCDIR -I$EXTDIR" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_canvas main.c diff --git a/sketches/image/build.sh b/sketches/image/build.sh index f298744..906600a 100755 --- a/sketches/image/build.sh +++ b/sketches/image/build.sh @@ -6,7 +6,7 @@ SRCDIR=../../src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_image main.c diff --git a/sketches/multi_surface/build.sh b/sketches/multi_surface/build.sh index 137b04c..8fcd4f4 100755 --- a/sketches/multi_surface/build.sh +++ b/sketches/multi_surface/build.sh @@ -7,7 +7,7 @@ EXTDIR=../../ext INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app -I$EXTDIR" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_multi_surface main.c diff --git a/sketches/polygon/build.sh b/sketches/polygon/build.sh index 2dc5185..cb50f8f 100755 --- a/sketches/polygon/build.sh +++ b/sketches/polygon/build.sh @@ -6,7 +6,7 @@ SRCDIR=../../src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_polygon main.c diff --git a/sketches/render_thread/build.sh b/sketches/render_thread/build.sh index 5657331..98fb2b3 100644 --- a/sketches/render_thread/build.sh +++ b/sketches/render_thread/build.sh @@ -7,7 +7,7 @@ EXTDIR=../../ext INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app -I$EXTDIR" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_render_thread main.c diff --git a/sketches/simpleWindow/build.sh b/sketches/simpleWindow/build.sh index 67d5f3e..8efc53b 100755 --- a/sketches/simpleWindow/build.sh +++ b/sketches/simpleWindow/build.sh @@ -7,7 +7,7 @@ EXTDIR=../../ext INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost -framework Carbon -framework Cocoa -framework Metal -framework QuartzCore" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS -Wl,-dead_strip $LIBS $INCLUDES -o $BINDIR/example_simple_window main.c diff --git a/sketches/smooth_resize/build.sh b/sketches/smooth_resize/build.sh index 6204822..dff6051 100755 --- a/sketches/smooth_resize/build.sh +++ b/sketches/smooth_resize/build.sh @@ -6,7 +6,7 @@ SRCDIR=../../src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_smooth_resize main.c diff --git a/sketches/surface_sharing/build.sh b/sketches/surface_sharing/build.sh index 5e6e39a..212fd47 100755 --- a/sketches/surface_sharing/build.sh +++ b/sketches/surface_sharing/build.sh @@ -7,7 +7,7 @@ EXTDIR=../../ext INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app -I$EXTDIR" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_surface_sharing main.c diff --git a/sketches/tiger/build.sh b/sketches/tiger/build.sh index 00bb31a..25cdd41 100755 --- a/sketches/tiger/build.sh +++ b/sketches/tiger/build.sh @@ -6,7 +6,7 @@ EXTDIR=../../ext INCLUDES="-I$SRCDIR -I$EXTDIR" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_tiger main.c diff --git a/sketches/triangleGL/build.sh b/sketches/triangleGL/build.sh index a96768b..e8a1a94 100755 --- a/sketches/triangleGL/build.sh +++ b/sketches/triangleGL/build.sh @@ -6,6 +6,6 @@ SRCDIR=../../src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost -framework Carbon -framework Cocoa -framework Metal -framework QuartzCore" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o test main.c diff --git a/sketches/triangleGLES/build.sh b/sketches/triangleGLES/build.sh index d22877d..140cc2b 100755 --- a/sketches/triangleGLES/build.sh +++ b/sketches/triangleGLES/build.sh @@ -7,7 +7,7 @@ EXTDIR=../../ext INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app -I$EXTDIR" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_gles_triangle main.c diff --git a/sketches/triangleMetal/build.sh b/sketches/triangleMetal/build.sh index 72c8081..920b73d 100755 --- a/sketches/triangleMetal/build.sh +++ b/sketches/triangleMetal/build.sh @@ -6,7 +6,7 @@ SRCDIR=../../src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost -framework Foundation -framework Metal" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" xcrun -sdk macosx metal -c -o shader.air shader.metal xcrun -sdk macosx metallib -o shader.metallib shader.air diff --git a/sketches/ui/build.sh b/sketches/ui/build.sh index 9d06d53..eff026e 100755 --- a/sketches/ui/build.sh +++ b/sketches/ui/build.sh @@ -6,7 +6,7 @@ SRCDIR=../../src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$BINDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" clang -g $FLAGS $LIBS $INCLUDES -o $BINDIR/example_ui main.c diff --git a/src/app/app.c b/src/app/app.c new file mode 100644 index 0000000..76910d0 --- /dev/null +++ b/src/app/app.c @@ -0,0 +1,217 @@ +/************************************************************//** +* +* @file: app.c +* @author: Martin Fouilleul +* @date: 23/12/2022 +* @revision: +* +*****************************************************************/ +#include"platform/platform_debug.h" +#include"app_internal.h" + +oc_app oc_appData = {0}; + +//--------------------------------------------------------------- +// Window handles +//--------------------------------------------------------------- + +void oc_init_window_handles() +{ + oc_list_init(&oc_appData.windowFreeList); + for(int i=0; i>32; + u32 generation = handle.h & 0xffffffff; + if(index >= OC_APP_MAX_WINDOWS) + { + return(0); + } + oc_window_data* window = &oc_appData.windowPool[index]; + if(window->generation != generation) + { + return(0); + } + else + { + return(window); + } +} + +oc_window oc_window_handle_from_ptr(oc_window_data* window) +{ + OC_DEBUG_ASSERT( (window - oc_appData.windowPool) >= 0 + && (window - oc_appData.windowPool) < OC_APP_MAX_WINDOWS); + + u64 h = ((u64)(window - oc_appData.windowPool))<<32 + | ((u64)window->generation); + + return((oc_window){h}); +} + +void oc_window_recycle_ptr(oc_window_data* window) +{ + window->generation++; + oc_list_push(&oc_appData.windowFreeList, &window->freeListElt); +} + +//--------------------------------------------------------------- +// Init +//--------------------------------------------------------------- + +static void oc_init_common() +{ + oc_init_window_handles(); + oc_ringbuffer_init(&oc_appData.eventQueue, 16); +} + +static void oc_terminate_common() +{ + oc_ringbuffer_cleanup(&oc_appData.eventQueue); +} + +//--------------------------------------------------------------- +// Event handling +//--------------------------------------------------------------- + +void oc_queue_event(oc_event* event) +{ + oc_ringbuffer* queue = &oc_appData.eventQueue; + + if(oc_ringbuffer_write_available(queue) < sizeof(oc_event)) + { + oc_log_error("event queue full\n"); + } + else + { + bool error = false; + oc_ringbuffer_reserve(queue, sizeof(oc_event), (u8*)event); + + if(event->type == OC_EVENT_PATHDROP) + { + oc_list_for(&event->paths.list, elt, oc_str8_elt, listElt) + { + oc_str8* path = &elt->string; + if(oc_ringbuffer_write_available(queue) < (sizeof(u64) + path->len)) + { + oc_log_error("event queue full\n"); + error = true; + break; + } + else + { + oc_ringbuffer_reserve(queue, sizeof(u64), (u8*)&path->len); + oc_ringbuffer_reserve(queue, path->len, (u8*)path->ptr); + } + } + } + if(error) + { + oc_ringbuffer_rewind(queue); + } + else + { + oc_ringbuffer_commit(queue); + } + } +} + +oc_event* oc_next_event(oc_arena* arena) +{ + //NOTE: pop and return event from queue + oc_event* event = 0; + oc_ringbuffer* queue = &oc_appData.eventQueue; + + if(oc_ringbuffer_read_available(queue) >= sizeof(oc_event)) + { + event = oc_arena_push_type(arena, oc_event); + u64 read = oc_ringbuffer_read(queue, sizeof(oc_event), (u8*)event); + OC_DEBUG_ASSERT(read == sizeof(oc_event)); + + if(event->type == OC_EVENT_PATHDROP) + { + u64 pathCount = event->paths.eltCount; + event->paths = (oc_str8_list){0}; + + for(int i=0; ipaths, oc_str8_from_buffer(len, buffer)); + } + } + } + return(event); +} + +//--------------------------------------------------------------- +// window rects helpers +//--------------------------------------------------------------- + +void oc_window_set_content_position(oc_window window, oc_vec2 position) +{ + oc_rect rect = oc_window_get_content_rect(window); + rect.x = position.x; + rect.y = position.y; + oc_window_set_content_rect(window, rect); +} + +void oc_window_set_content_size(oc_window window, oc_vec2 size) +{ + oc_rect rect = oc_window_get_content_rect(window); + rect.w = size.x; + rect.h = size.y; + oc_window_set_content_rect(window, rect); +} + +void oc_window_set_frame_position(oc_window window, oc_vec2 position) +{ + oc_rect frame = oc_window_get_frame_rect(window); + frame.x = position.x; + frame.y = position.y; + oc_window_set_frame_rect(window, frame); +} + +void oc_window_set_frame_size(oc_window window, oc_vec2 size) +{ + oc_rect frame = oc_window_get_frame_rect(window); + frame.w = size.x; + frame.h = size.y; + oc_window_set_frame_rect(window, frame); +} diff --git a/src/app/app.h b/src/app/app.h new file mode 100644 index 0000000..92d5ed2 --- /dev/null +++ b/src/app/app.h @@ -0,0 +1,392 @@ +/************************************************************//** +* +* @file: platform_app.h +* @author: Martin Fouilleul +* @date: 16/05/2020 +* @revision: +* +*****************************************************************/ +#ifndef __APP_H_ +#define __APP_H_ + +#include"util/typedefs.h" +#include"util/utf8.h" +#include"util/lists.h" +#include"util/memory.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//-------------------------------------------------------------------- +// Typedefs, enums and constants +//-------------------------------------------------------------------- + +typedef struct oc_window { u64 h; } oc_window; + +typedef enum { OC_MOUSE_CURSOR_ARROW, + OC_MOUSE_CURSOR_RESIZE_0, + OC_MOUSE_CURSOR_RESIZE_90, + OC_MOUSE_CURSOR_RESIZE_45, + OC_MOUSE_CURSOR_RESIZE_135, + OC_MOUSE_CURSOR_TEXT } oc_mouse_cursor; + +typedef i32 oc_window_style; +static const oc_window_style OC_WINDOW_STYLE_NO_TITLE = 0x01<<0, + OC_WINDOW_STYLE_FIXED_SIZE = 0x01<<1, + OC_WINDOW_STYLE_NO_CLOSE = 0x01<<2, + OC_WINDOW_STYLE_NO_MINIFY = 0x01<<3, + OC_WINDOW_STYLE_NO_FOCUS = 0x01<<4, + OC_WINDOW_STYLE_FLOAT = 0x01<<5, + OC_WINDOW_STYLE_POPUPMENU = 0x01<<6, + OC_WINDOW_STYLE_NO_BUTTONS = 0x01<<7; + +typedef enum { OC_EVENT_NONE, + OC_EVENT_KEYBOARD_MODS, //TODO: remove, keep only key? + OC_EVENT_KEYBOARD_KEY, + OC_EVENT_KEYBOARD_CHAR, + OC_EVENT_MOUSE_BUTTON, + OC_EVENT_MOUSE_MOVE, + OC_EVENT_MOUSE_WHEEL, + OC_EVENT_MOUSE_ENTER, + OC_EVENT_MOUSE_LEAVE, + OC_EVENT_WINDOW_RESIZE, + OC_EVENT_WINDOW_MOVE, + OC_EVENT_WINDOW_FOCUS, + OC_EVENT_WINDOW_UNFOCUS, + OC_EVENT_WINDOW_HIDE, // rename to minimize? + OC_EVENT_WINDOW_SHOW, // rename to restore? + OC_EVENT_WINDOW_CLOSE, + OC_EVENT_PATHDROP, + OC_EVENT_FRAME, + OC_EVENT_QUIT } oc_event_type; + +typedef enum { OC_KEY_NO_ACTION, + OC_KEY_PRESS, + OC_KEY_RELEASE, + OC_KEY_REPEAT } oc_key_action; + +typedef enum { OC_KEY_UNKNOWN = 0, + OC_KEY_SPACE = 32, + OC_KEY_APOSTROPHE = 39, /* ' */ + OC_KEY_COMMA = 44, /* , */ + OC_KEY_MINUS = 45, // - + OC_KEY_PERIOD = 46, // . + OC_KEY_SLASH = 47, // / + OC_KEY_0 = 48, + OC_KEY_1 = 49, + OC_KEY_2 = 50, + OC_KEY_3 = 51, + OC_KEY_4 = 52, + OC_KEY_5 = 53, + OC_KEY_6 = 54, + OC_KEY_7 = 55, + OC_KEY_8 = 56, + OC_KEY_9 = 57, + OC_KEY_SEMICOLON = 59, // ; + OC_KEY_EQUAL = 61, // = + OC_KEY_A = 65, + OC_KEY_B = 66, + OC_KEY_C = 67, + OC_KEY_D = 68, + OC_KEY_E = 69, + OC_KEY_F = 70, + OC_KEY_G = 71, + OC_KEY_H = 72, + OC_KEY_I = 73, + OC_KEY_J = 74, + OC_KEY_K = 75, + OC_KEY_L = 76, + OC_KEY_M = 77, + OC_KEY_N = 78, + OC_KEY_O = 79, + OC_KEY_P = 80, + OC_KEY_Q = 81, + OC_KEY_R = 82, + OC_KEY_S = 83, + OC_KEY_T = 84, + OC_KEY_U = 85, + OC_KEY_V = 86, + OC_KEY_W = 87, + OC_KEY_X = 88, + OC_KEY_Y = 89, + OC_KEY_Z = 90, + OC_KEY_LEFT_BRACKET = 91, // [ + OC_KEY_BACKSLASH = 92, // \ */ + OC_KEY_RIGHT_BRACKET = 93, // ] + OC_KEY_GRAVE_ACCENT = 96, // ` + OC_KEY_WORLD_1 = 161, // non-US #1 + OC_KEY_WORLD_2 = 162, // non-US #2 + OC_KEY_ESCAPE = 256, + OC_KEY_ENTER = 257, + OC_KEY_TAB = 258, + OC_KEY_BACKSPACE = 259, + OC_KEY_INSERT = 260, + OC_KEY_DELETE = 261, + OC_KEY_RIGHT = 262, + OC_KEY_LEFT = 263, + OC_KEY_DOWN = 264, + OC_KEY_UP = 265, + OC_KEY_PAGE_UP = 266, + OC_KEY_PAGE_DOWN = 267, + OC_KEY_HOME = 268, + OC_KEY_END = 269, + OC_KEY_CAPS_LOCK = 280, + OC_KEY_SCROLL_LOCK = 281, + OC_KEY_NUM_LOCK = 282, + OC_KEY_PRINT_SCREEN = 283, + OC_KEY_PAUSE = 284, + OC_KEY_F1 = 290, + OC_KEY_F2 = 291, + OC_KEY_F3 = 292, + OC_KEY_F4 = 293, + OC_KEY_F5 = 294, + OC_KEY_F6 = 295, + OC_KEY_F7 = 296, + OC_KEY_F8 = 297, + OC_KEY_F9 = 298, + OC_KEY_F10 = 299, + OC_KEY_F11 = 300, + OC_KEY_F12 = 301, + OC_KEY_F13 = 302, + OC_KEY_F14 = 303, + OC_KEY_F15 = 304, + OC_KEY_F16 = 305, + OC_KEY_F17 = 306, + OC_KEY_F18 = 307, + OC_KEY_F19 = 308, + OC_KEY_F20 = 309, + OC_KEY_F21 = 310, + OC_KEY_F22 = 311, + OC_KEY_F23 = 312, + OC_KEY_F24 = 313, + OC_KEY_F25 = 314, + OC_KEY_KP_0 = 320, + OC_KEY_KP_1 = 321, + OC_KEY_KP_2 = 322, + OC_KEY_KP_3 = 323, + OC_KEY_KP_4 = 324, + OC_KEY_KP_5 = 325, + OC_KEY_KP_6 = 326, + OC_KEY_KP_7 = 327, + OC_KEY_KP_8 = 328, + OC_KEY_KP_9 = 329, + OC_KEY_KP_DECIMAL = 330, + OC_KEY_KP_DIVIDE = 331, + OC_KEY_KP_MULTIPLY = 332, + OC_KEY_KP_SUBTRACT = 333, + OC_KEY_KP_ADD = 334, + OC_KEY_KP_ENTER = 335, + OC_KEY_KP_EQUAL = 336, + OC_KEY_LEFT_SHIFT = 340, + OC_KEY_LEFT_CONTROL = 341, + OC_KEY_LEFT_ALT = 342, + OC_KEY_LEFT_SUPER = 343, + OC_KEY_RIGHT_SHIFT = 344, + OC_KEY_RIGHT_CONTROL = 345, + OC_KEY_RIGHT_ALT = 346, + OC_KEY_RIGHT_SUPER = 347, + OC_KEY_MENU = 348, + OC_KEY_COUNT } oc_key_code; + +typedef enum { + OC_KEYMOD_NONE = 0x00, + OC_KEYMOD_ALT = 0x01, + OC_KEYMOD_SHIFT = 0x02, + OC_KEYMOD_CTRL = 0x04, + OC_KEYMOD_CMD = 0x08, + OC_KEYMOD_MAIN_MODIFIER = 0x16 /* CMD on Mac, CTRL on Win32 */ } oc_keymod_flags; + +typedef enum { + OC_MOUSE_LEFT = 0x00, + OC_MOUSE_RIGHT = 0x01, + OC_MOUSE_MIDDLE = 0x02, + OC_MOUSE_EXT1 = 0x03, + OC_MOUSE_EXT2 = 0x04, + OC_MOUSE_BUTTON_COUNT } oc_mouse_button; + +typedef struct oc_key_event // keyboard and mouse buttons input +{ + oc_key_action action; + i32 code; + oc_keymod_flags mods; + char label[8]; + u8 labelLen; + int clickCount; +} oc_key_event; + +typedef struct oc_char_event // character input +{ + oc_utf32 codepoint; + char sequence[8]; + u8 seqLen; +} oc_char_event; + +typedef struct oc_mouse_event // mouse move/scroll +{ + f32 x; + f32 y; + f32 deltaX; + f32 deltaY; + oc_keymod_flags mods; +} oc_mouse_event; + +typedef struct oc_move_event // window resize / move +{ + oc_rect frame; + oc_rect content; +} oc_move_event; + +typedef struct oc_event +{ + //TODO clipboard and path drop + oc_window window; + oc_event_type type; + + union + { + oc_key_event key; + oc_char_event character; + oc_mouse_event mouse; + oc_move_event move; + oc_str8_list paths; + }; + +} oc_event; + +//NOTE: these APIs are not directly available to Orca apps +#if !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA) +//-------------------------------------------------------------------- +// app management +//-------------------------------------------------------------------- + +ORCA_API void oc_init(void); +ORCA_API void oc_terminate(void); + +ORCA_API bool oc_should_quit(void); +ORCA_API void oc_cancel_quit(void); +ORCA_API void oc_request_quit(void); + +ORCA_API void oc_set_cursor(oc_mouse_cursor cursor); + +//-------------------------------------------------------------------- +// Main loop and events handling +//-------------------------------------------------------------------- +/*NOTE: + oc_pump_events() pumps system events into the event queue. A timeout of 0 polls for events, + while a timeout of -1 blocks for events. A timeout > 0 blocks until new events are available + or the timeout elapses. + + oc_next_event() get the next event from the event queue, allocating from the passed arena +*/ +ORCA_API void oc_pump_events(f64 timeout); +ORCA_API oc_event* oc_next_event(oc_arena* arena); + +typedef void(*oc_live_resize_callback)(oc_event event, void* data); +ORCA_API void oc_set_live_resize_callback(oc_live_resize_callback callback, void* data); + +//-------------------------------------------------------------------- +// window management +//-------------------------------------------------------------------- + +ORCA_API bool oc_window_handle_is_null(oc_window window); +ORCA_API oc_window oc_window_null_handle(void); + +ORCA_API oc_window oc_window_create(oc_rect contentRect, oc_str8 title, oc_window_style style); +ORCA_API void oc_window_destroy(oc_window window); +ORCA_API void* oc_window_native_pointer(oc_window window); + +ORCA_API bool oc_window_should_close(oc_window window); +ORCA_API void oc_window_request_close(oc_window window); +ORCA_API void oc_window_cancel_close(oc_window window); + +ORCA_API bool oc_window_is_hidden(oc_window window); +ORCA_API void oc_window_hide(oc_window window); +ORCA_API void oc_window_show(oc_window window); + +ORCA_API bool oc_window_is_minimized(oc_window window); +ORCA_API bool oc_window_is_maximized(oc_window window); +ORCA_API void oc_window_minimize(oc_window window); +ORCA_API void oc_window_maximize(oc_window window); +ORCA_API void oc_window_restore(oc_window window); + +ORCA_API bool oc_window_has_focus(oc_window window); +ORCA_API void oc_window_focus(oc_window window); +ORCA_API void oc_window_unfocus(oc_window window); + +ORCA_API void oc_window_send_to_back(oc_window window); +ORCA_API void oc_window_bring_to_front(oc_window window); + +ORCA_API oc_rect oc_window_get_frame_rect(oc_window window); +ORCA_API void oc_window_set_frame_rect(oc_window window, oc_rect rect); +ORCA_API void oc_window_set_frame_position(oc_window window, oc_vec2 position); +ORCA_API void oc_window_set_frame_size(oc_window window, oc_vec2 size); + +ORCA_API oc_rect oc_window_get_content_rect(oc_window window); +ORCA_API void oc_window_set_content_rect(oc_window window, oc_rect rect); +ORCA_API void oc_window_set_content_position(oc_window window, oc_vec2 position); +ORCA_API void oc_window_set_content_size(oc_window window, oc_vec2 size); + +ORCA_API void oc_window_center(oc_window window); + +ORCA_API oc_rect oc_window_content_rect_for_frame_rect(oc_rect frameRect, oc_window_style style); +ORCA_API oc_rect oc_window_frame_rect_for_content_rect(oc_rect contentRect, oc_window_style style); + +//--------------------------------------------------------------- +// Dispatching stuff to the main thread +//--------------------------------------------------------------- + +typedef i32 (*oc_dispatch_proc)(void* user); + +ORCA_API i32 oc_dispatch_on_main_thread_sync(oc_window main_window, oc_dispatch_proc proc, void* user); + +//-------------------------------------------------------------------- +// Clipboard +//-------------------------------------------------------------------- +ORCA_API void oc_clipboard_clear(void); + +ORCA_API void oc_clipboard_set_string(oc_str8 string); +ORCA_API oc_str8 oc_clipboard_get_string(oc_arena* arena); +ORCA_API oc_str8 oc_clipboard_copy_string(oc_str8 backing); + +ORCA_API bool oc_clipboard_has_tag(const char* tag); +ORCA_API void oc_clipboard_set_data_for_tag(const char* tag, oc_str8 data); +ORCA_API oc_str8 oc_clipboard_get_data_for_tag(oc_arena* arena, const char* tag); + +//-------------------------------------------------------------------- +// native open/save/alert windows +//-------------------------------------------------------------------- + +ORCA_API oc_str8 oc_open_dialog(oc_arena* arena, + oc_str8 title, + oc_str8 defaultPath, + oc_str8_list filters, + bool directory); + +ORCA_API oc_str8 oc_save_dialog(oc_arena* arena, + oc_str8 title, + oc_str8 defaultPath, + oc_str8_list filters); + +ORCA_API int oc_alert_popup(oc_str8 title, + oc_str8 message, + oc_str8_list options); + + +//-------------------------------------------------------------------- +// file system stuff... //TODO: move elsewhere +//-------------------------------------------------------------------- +ORCA_API int oc_file_move(oc_str8 from, oc_str8 to); +ORCA_API int oc_file_remove(oc_str8 path); + +ORCA_API int oc_directory_create(oc_str8 path); + + +#endif // !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA) + +#ifdef __cplusplus +} // extern "C" +#endif + + +#endif //__APP_H_ diff --git a/src/app/mp_app_internal.h b/src/app/app_internal.h similarity index 56% rename from src/app/mp_app_internal.h rename to src/app/app_internal.h index 454baef..66a9fde 100644 --- a/src/app/mp_app_internal.h +++ b/src/app/app_internal.h @@ -1,22 +1,22 @@ /************************************************************//** * -* @file: mp_app_internal.h +* @file: app_internal.h * @author: Martin Fouilleul * @date: 23/12/2022 * @revision: * *****************************************************************/ -#ifndef __MP_APP_INTERNAL_H_ -#define __MP_APP_INTERNAL_H_ +#ifndef __APP_INTERNAL_H_ +#define __APP_INTERNAL_H_ -#include"mp_app.h" +#include"app.h" #include"platform/platform.h" #include"util/ringbuffer.h" -#if PLATFORM_WINDOWS +#if OC_PLATFORM_WINDOWS #include"win32_app.h" -#elif PLATFORM_MACOS +#elif OC_PLATFORM_MACOS #include"osx_app.h" #else #error "platform not supported yet" @@ -26,66 +26,66 @@ // Window structure //--------------------------------------------------------------- -typedef struct mp_frame_stats +typedef struct oc_frame_stats { f64 start; f64 workTime; f64 remainingTime; f64 targetFramePeriod; -} mp_frame_stats; +} oc_frame_stats; -typedef struct mp_window_data +typedef struct oc_window_data { - list_elt freeListElt; + oc_list_elt freeListElt; u32 generation; - mp_window_style style; + oc_window_style style; bool shouldClose; //TODO could be in status flags bool hidden; bool minimized; - MP_PLATFORM_WINDOW_DATA -} mp_window_data; + OC_PLATFORM_WINDOW_DATA +} oc_window_data; //--------------------------------------------------------------- // Global App State //--------------------------------------------------------------- -typedef struct mp_key_utf8 +typedef struct oc_key_utf8 { u8 labelLen; char label[8]; -} mp_key_utf8; +} oc_key_utf8; -enum { MP_APP_MAX_WINDOWS = 128 }; +enum { OC_APP_MAX_WINDOWS = 128 }; -typedef struct mp_app +typedef struct oc_app { bool init; bool shouldQuit; bool minimized; - str8 pendingPathDrop; - mem_arena eventArena; + oc_str8 pendingPathDrop; + oc_arena eventArena; - ringbuffer eventQueue; + oc_ringbuffer eventQueue; - mp_frame_stats frameStats; + oc_frame_stats frameStats; - mp_window_data windowPool[MP_APP_MAX_WINDOWS]; - list_info windowFreeList; + oc_window_data windowPool[OC_APP_MAX_WINDOWS]; + oc_list windowFreeList; - mp_live_resize_callback liveResizeCallback; + oc_live_resize_callback liveResizeCallback; void* liveResizeData; - mp_key_utf8 keyLabels[512]; + oc_key_utf8 keyLabels[512]; int keyCodes[512]; - int nativeKeys[MP_KEY_COUNT]; + int nativeKeys[OC_KEY_COUNT]; - MP_PLATFORM_APP_DATA -} mp_app; + OC_PLATFORM_APP_DATA +} oc_app; -#endif // __MP_APP_INTERNAL_H_ +#endif // __APP_INTERNAL_H_ diff --git a/src/app/mp_app.c b/src/app/mp_app.c deleted file mode 100644 index 621a7ef..0000000 --- a/src/app/mp_app.c +++ /dev/null @@ -1,217 +0,0 @@ -/************************************************************//** -* -* @file: mp_app_internal.c -* @author: Martin Fouilleul -* @date: 23/12/2022 -* @revision: -* -*****************************************************************/ -#include"platform/platform_debug.h" -#include"mp_app_internal.h" - -mp_app __mpApp = {0}; - -//--------------------------------------------------------------- -// Window handles -//--------------------------------------------------------------- - -void mp_init_window_handles() -{ - list_init(&__mpApp.windowFreeList); - for(int i=0; i>32; - u32 generation = handle.h & 0xffffffff; - if(index >= MP_APP_MAX_WINDOWS) - { - return(0); - } - mp_window_data* window = &__mpApp.windowPool[index]; - if(window->generation != generation) - { - return(0); - } - else - { - return(window); - } -} - -mp_window mp_window_handle_from_ptr(mp_window_data* window) -{ - DEBUG_ASSERT( (window - __mpApp.windowPool) >= 0 - && (window - __mpApp.windowPool) < MP_APP_MAX_WINDOWS); - - u64 h = ((u64)(window - __mpApp.windowPool))<<32 - | ((u64)window->generation); - - return((mp_window){h}); -} - -void mp_window_recycle_ptr(mp_window_data* window) -{ - window->generation++; - list_push(&__mpApp.windowFreeList, &window->freeListElt); -} - -//--------------------------------------------------------------- -// Init -//--------------------------------------------------------------- - -static void mp_init_common() -{ - mp_init_window_handles(); - ringbuffer_init(&__mpApp.eventQueue, 16); -} - -static void mp_terminate_common() -{ - ringbuffer_cleanup(&__mpApp.eventQueue); -} - -//--------------------------------------------------------------- -// Event handling -//--------------------------------------------------------------- - -void mp_queue_event(mp_event* event) -{ - ringbuffer* queue = &__mpApp.eventQueue; - - if(ringbuffer_write_available(queue) < sizeof(mp_event)) - { - log_error("event queue full\n"); - } - else - { - bool error = false; - ringbuffer_reserve(queue, sizeof(mp_event), (u8*)event); - - if(event->type == MP_EVENT_PATHDROP) - { - for_list(&event->paths.list, elt, str8_elt, listElt) - { - str8* path = &elt->string; - if(ringbuffer_write_available(queue) < (sizeof(u64) + path->len)) - { - log_error("event queue full\n"); - error = true; - break; - } - else - { - ringbuffer_reserve(queue, sizeof(u64), (u8*)&path->len); - ringbuffer_reserve(queue, path->len, (u8*)path->ptr); - } - } - } - if(error) - { - ringbuffer_rewind(queue); - } - else - { - ringbuffer_commit(queue); - } - } -} - -mp_event* mp_next_event(mem_arena* arena) -{ - //NOTE: pop and return event from queue - mp_event* event = 0; - ringbuffer* queue = &__mpApp.eventQueue; - - if(ringbuffer_read_available(queue) >= sizeof(mp_event)) - { - event = mem_arena_alloc_type(arena, mp_event); - u64 read = ringbuffer_read(queue, sizeof(mp_event), (u8*)event); - DEBUG_ASSERT(read == sizeof(mp_event)); - - if(event->type == MP_EVENT_PATHDROP) - { - u64 pathCount = event->paths.eltCount; - event->paths = (str8_list){0}; - - for(int i=0; ipaths, str8_from_buffer(len, buffer)); - } - } - } - return(event); -} - -//--------------------------------------------------------------- -// window rects helpers -//--------------------------------------------------------------- - -void mp_window_set_content_position(mp_window window, vec2 position) -{ - mp_rect rect = mp_window_get_content_rect(window); - rect.x = position.x; - rect.y = position.y; - mp_window_set_content_rect(window, rect); -} - -void mp_window_set_content_size(mp_window window, vec2 size) -{ - mp_rect rect = mp_window_get_content_rect(window); - rect.w = size.x; - rect.h = size.y; - mp_window_set_content_rect(window, rect); -} - -void mp_window_set_frame_position(mp_window window, vec2 position) -{ - mp_rect frame = mp_window_get_frame_rect(window); - frame.x = position.x; - frame.y = position.y; - mp_window_set_frame_rect(window, frame); -} - -void mp_window_set_frame_size(mp_window window, vec2 size) -{ - mp_rect frame = mp_window_get_frame_rect(window); - frame.w = size.x; - frame.h = size.y; - mp_window_set_frame_rect(window, frame); -} diff --git a/src/app/mp_app.h b/src/app/mp_app.h deleted file mode 100644 index 73a7d7f..0000000 --- a/src/app/mp_app.h +++ /dev/null @@ -1,395 +0,0 @@ -/************************************************************//** -* -* @file: platform_app.h -* @author: Martin Fouilleul -* @date: 16/05/2020 -* @revision: -* -*****************************************************************/ -#ifndef __PLATFORM_APP_H_ -#define __PLATFORM_APP_H_ - -#include"util/typedefs.h" -#include"util/utf8.h" -#include"util/lists.h" -#include"util/memory.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//-------------------------------------------------------------------- -// Typedefs, enums and constants -//-------------------------------------------------------------------- - -typedef struct mp_window { u64 h; } mp_window; - -typedef enum { MP_MOUSE_CURSOR_ARROW, - MP_MOUSE_CURSOR_RESIZE_0, - MP_MOUSE_CURSOR_RESIZE_90, - MP_MOUSE_CURSOR_RESIZE_45, - MP_MOUSE_CURSOR_RESIZE_135, - MP_MOUSE_CURSOR_TEXT } mp_mouse_cursor; - -typedef i32 mp_window_style; -static const mp_window_style MP_WINDOW_STYLE_NO_TITLE = 0x01<<0, - MP_WINDOW_STYLE_FIXED_SIZE = 0x01<<1, - MP_WINDOW_STYLE_NO_CLOSE = 0x01<<2, - MP_WINDOW_STYLE_NO_MINIFY = 0x01<<3, - MP_WINDOW_STYLE_NO_FOCUS = 0x01<<4, - MP_WINDOW_STYLE_FLOAT = 0x01<<5, - MP_WINDOW_STYLE_POPUPMENU = 0x01<<6, - MP_WINDOW_STYLE_NO_BUTTONS = 0x01<<7; - -typedef enum { MP_EVENT_NONE, - MP_EVENT_KEYBOARD_MODS, //TODO: remove, keep only key? - MP_EVENT_KEYBOARD_KEY, - MP_EVENT_KEYBOARD_CHAR, - MP_EVENT_MOUSE_BUTTON, - MP_EVENT_MOUSE_MOVE, - MP_EVENT_MOUSE_WHEEL, - MP_EVENT_MOUSE_ENTER, - MP_EVENT_MOUSE_LEAVE, - MP_EVENT_WINDOW_RESIZE, - MP_EVENT_WINDOW_MOVE, - MP_EVENT_WINDOW_FOCUS, - MP_EVENT_WINDOW_UNFOCUS, - MP_EVENT_WINDOW_HIDE, // rename to minimize? - MP_EVENT_WINDOW_SHOW, // rename to restore? - MP_EVENT_WINDOW_CLOSE, - MP_EVENT_PATHDROP, - MP_EVENT_FRAME, - MP_EVENT_QUIT } mp_event_type; - -typedef enum { MP_KEY_NO_ACTION, - MP_KEY_PRESS, - MP_KEY_RELEASE, - MP_KEY_REPEAT } mp_key_action; - -typedef enum { MP_KEY_UNKNOWN = 0, - MP_KEY_SPACE = 32, - MP_KEY_APOSTROPHE = 39, /* ' */ - MP_KEY_COMMA = 44, /* , */ - MP_KEY_MINUS = 45, // - - MP_KEY_PERIOD = 46, // . - MP_KEY_SLASH = 47, // / - MP_KEY_0 = 48, - MP_KEY_1 = 49, - MP_KEY_2 = 50, - MP_KEY_3 = 51, - MP_KEY_4 = 52, - MP_KEY_5 = 53, - MP_KEY_6 = 54, - MP_KEY_7 = 55, - MP_KEY_8 = 56, - MP_KEY_9 = 57, - MP_KEY_SEMICOLON = 59, // ; - MP_KEY_EQUAL = 61, // = - MP_KEY_A = 65, - MP_KEY_B = 66, - MP_KEY_C = 67, - MP_KEY_D = 68, - MP_KEY_E = 69, - MP_KEY_F = 70, - MP_KEY_G = 71, - MP_KEY_H = 72, - MP_KEY_I = 73, - MP_KEY_J = 74, - MP_KEY_K = 75, - MP_KEY_L = 76, - MP_KEY_M = 77, - MP_KEY_N = 78, - MP_KEY_O = 79, - MP_KEY_P = 80, - MP_KEY_Q = 81, - MP_KEY_R = 82, - MP_KEY_S = 83, - MP_KEY_T = 84, - MP_KEY_U = 85, - MP_KEY_V = 86, - MP_KEY_W = 87, - MP_KEY_X = 88, - MP_KEY_Y = 89, - MP_KEY_Z = 90, - MP_KEY_LEFT_BRACKET = 91, // [ - MP_KEY_BACKSLASH = 92, // \ */ - MP_KEY_RIGHT_BRACKET = 93, // ] - MP_KEY_GRAVE_ACCENT = 96, // ` - MP_KEY_WORLD_1 = 161, // non-US #1 - MP_KEY_WORLD_2 = 162, // non-US #2 - MP_KEY_ESCAPE = 256, - MP_KEY_ENTER = 257, - MP_KEY_TAB = 258, - MP_KEY_BACKSPACE = 259, - MP_KEY_INSERT = 260, - MP_KEY_DELETE = 261, - MP_KEY_RIGHT = 262, - MP_KEY_LEFT = 263, - MP_KEY_DOWN = 264, - MP_KEY_UP = 265, - MP_KEY_PAGE_UP = 266, - MP_KEY_PAGE_DOWN = 267, - MP_KEY_HOME = 268, - MP_KEY_END = 269, - MP_KEY_CAPS_LOCK = 280, - MP_KEY_SCROLL_LOCK = 281, - MP_KEY_NUM_LOCK = 282, - MP_KEY_PRINT_SCREEN = 283, - MP_KEY_PAUSE = 284, - MP_KEY_F1 = 290, - MP_KEY_F2 = 291, - MP_KEY_F3 = 292, - MP_KEY_F4 = 293, - MP_KEY_F5 = 294, - MP_KEY_F6 = 295, - MP_KEY_F7 = 296, - MP_KEY_F8 = 297, - MP_KEY_F9 = 298, - MP_KEY_F10 = 299, - MP_KEY_F11 = 300, - MP_KEY_F12 = 301, - MP_KEY_F13 = 302, - MP_KEY_F14 = 303, - MP_KEY_F15 = 304, - MP_KEY_F16 = 305, - MP_KEY_F17 = 306, - MP_KEY_F18 = 307, - MP_KEY_F19 = 308, - MP_KEY_F20 = 309, - MP_KEY_F21 = 310, - MP_KEY_F22 = 311, - MP_KEY_F23 = 312, - MP_KEY_F24 = 313, - MP_KEY_F25 = 314, - MP_KEY_KP_0 = 320, - MP_KEY_KP_1 = 321, - MP_KEY_KP_2 = 322, - MP_KEY_KP_3 = 323, - MP_KEY_KP_4 = 324, - MP_KEY_KP_5 = 325, - MP_KEY_KP_6 = 326, - MP_KEY_KP_7 = 327, - MP_KEY_KP_8 = 328, - MP_KEY_KP_9 = 329, - MP_KEY_KP_DECIMAL = 330, - MP_KEY_KP_DIVIDE = 331, - MP_KEY_KP_MULTIPLY = 332, - MP_KEY_KP_SUBTRACT = 333, - MP_KEY_KP_ADD = 334, - MP_KEY_KP_ENTER = 335, - MP_KEY_KP_EQUAL = 336, - MP_KEY_LEFT_SHIFT = 340, - MP_KEY_LEFT_CONTROL = 341, - MP_KEY_LEFT_ALT = 342, - MP_KEY_LEFT_SUPER = 343, - MP_KEY_RIGHT_SHIFT = 344, - MP_KEY_RIGHT_CONTROL = 345, - MP_KEY_RIGHT_ALT = 346, - MP_KEY_RIGHT_SUPER = 347, - MP_KEY_MENU = 348, - MP_KEY_COUNT } mp_key_code; - -typedef enum { - MP_KEYMOD_NONE = 0x00, - MP_KEYMOD_ALT = 0x01, - MP_KEYMOD_SHIFT = 0x02, - MP_KEYMOD_CTRL = 0x04, - MP_KEYMOD_CMD = 0x08, - MP_KEYMOD_MAIN_MODIFIER = 0x16 /* CMD on Mac, CTRL on Win32 */ } mp_keymod_flags; - -typedef enum { - MP_MOUSE_LEFT = 0x00, - MP_MOUSE_RIGHT = 0x01, - MP_MOUSE_MIDDLE = 0x02, - MP_MOUSE_EXT1 = 0x03, - MP_MOUSE_EXT2 = 0x04, - MP_MOUSE_BUTTON_COUNT } mp_mouse_button; - -typedef struct mp_key_event // keyboard and mouse buttons input -{ - mp_key_action action; - i32 code; - mp_keymod_flags mods; - char label[8]; - u8 labelLen; - int clickCount; -} mp_key_event; - -typedef struct mp_char_event // character input -{ - utf32 codepoint; - char sequence[8]; - u8 seqLen; -} mp_char_event; - -typedef struct mp_mouse_event // mouse move/scroll -{ - f32 x; - f32 y; - f32 deltaX; - f32 deltaY; - mp_keymod_flags mods; -} mp_mouse_event; - -typedef struct mp_move_event // window resize / move -{ - mp_rect frame; - mp_rect content; -} mp_move_event; - -typedef struct mp_event -{ - //TODO clipboard and path drop - mp_window window; - mp_event_type type; - - union - { - mp_key_event key; - mp_char_event character; - mp_mouse_event mouse; - mp_move_event move; - str8_list paths; - }; - -} mp_event; - -//NOTE: these APIs are not directly available to Orca apps -#if !defined(PLATFORM_ORCA) || !(PLATFORM_ORCA) -//-------------------------------------------------------------------- -// app management -//-------------------------------------------------------------------- - -MP_API void mp_init(void); -MP_API void mp_terminate(void); - -MP_API bool mp_should_quit(void); -MP_API void mp_cancel_quit(void); -MP_API void mp_request_quit(void); - -MP_API void mp_set_cursor(mp_mouse_cursor cursor); - -//-------------------------------------------------------------------- -// Main loop and events handling -//-------------------------------------------------------------------- -/*NOTE: - mp_pump_events() pumps system events into the event queue. A timeout of 0 polls for events, - while a timeout of -1 blocks for events. A timeout > 0 blocks until new events are available - or the timeout elapses. - - mp_next_event() get the next event from the event queue, allocating from the passed arena -*/ -MP_API void mp_pump_events(f64 timeout); -MP_API mp_event* mp_next_event(mem_arena* arena); - -typedef void(*mp_live_resize_callback)(mp_event event, void* data); -MP_API void mp_set_live_resize_callback(mp_live_resize_callback callback, void* data); - -//-------------------------------------------------------------------- -// window management -//-------------------------------------------------------------------- - -MP_API bool mp_window_handle_is_null(mp_window window); -MP_API mp_window mp_window_null_handle(void); - -MP_API mp_window mp_window_create(mp_rect contentRect, const char* title, mp_window_style style); -MP_API void mp_window_destroy(mp_window window); -MP_API void* mp_window_native_pointer(mp_window window); - -MP_API bool mp_window_should_close(mp_window window); -MP_API void mp_window_request_close(mp_window window); -MP_API void mp_window_cancel_close(mp_window window); - -MP_API bool mp_window_is_hidden(mp_window window); -MP_API void mp_window_hide(mp_window window); -MP_API void mp_window_show(mp_window window); - -MP_API bool mp_window_is_minimized(mp_window window); -MP_API bool mp_window_is_maximized(mp_window window); -MP_API void mp_window_minimize(mp_window window); -MP_API void mp_window_maximize(mp_window window); -MP_API void mp_window_restore(mp_window window); - -MP_API bool mp_window_has_focus(mp_window window); -MP_API void mp_window_focus(mp_window window); -MP_API void mp_window_unfocus(mp_window window); - -MP_API void mp_window_send_to_back(mp_window window); -MP_API void mp_window_bring_to_front(mp_window window); - -MP_API mp_rect mp_window_get_frame_rect(mp_window window); -MP_API void mp_window_set_frame_rect(mp_window window, mp_rect rect); -MP_API void mp_window_set_frame_position(mp_window window, vec2 position); -MP_API void mp_window_set_frame_size(mp_window window, vec2 size); - -MP_API mp_rect mp_window_get_content_rect(mp_window window); -MP_API void mp_window_set_content_rect(mp_window window, mp_rect rect); -MP_API void mp_window_set_content_position(mp_window window, vec2 position); -MP_API void mp_window_set_content_size(mp_window window, vec2 size); - -MP_API void mp_window_center(mp_window window); - -MP_API mp_rect mp_window_content_rect_for_frame_rect(mp_rect frameRect, mp_window_style style); -MP_API mp_rect mp_window_frame_rect_for_content_rect(mp_rect contentRect, mp_window_style style); - -//--------------------------------------------------------------- -// Dispatching stuff to the main thread -//--------------------------------------------------------------- - -typedef i32 (*mp_dispatch_proc)(void* user); - -MP_API i32 mp_dispatch_on_main_thread_sync(mp_window main_window, mp_dispatch_proc proc, void* user); - -//-------------------------------------------------------------------- -// Clipboard -//-------------------------------------------------------------------- -MP_API void mp_clipboard_clear(void); - -MP_API void mp_clipboard_set_string(str8 string); -MP_API str8 mp_clipboard_get_string(mem_arena* arena); -MP_API str8 mp_clipboard_copy_string(str8 backing); - -MP_API bool mp_clipboard_has_tag(const char* tag); -MP_API void mp_clipboard_set_data_for_tag(const char* tag, str8 data); -MP_API str8 mp_clipboard_get_data_for_tag(mem_arena* arena, const char* tag); - -//-------------------------------------------------------------------- -// native open/save/alert windows -//-------------------------------------------------------------------- - -MP_API str8 mp_open_dialog(mem_arena* arena, - const char* title, - const char* defaultPath, - int filterCount, - const char** filters, - bool directory); - -MP_API str8 mp_save_dialog(mem_arena* arena, - const char* title, - const char* defaultPath, - int filterCount, - const char** filters); - -MP_API int mp_alert_popup(const char* title, - const char* message, - u32 count, - const char** options); - - -//-------------------------------------------------------------------- -// file system stuff... //TODO: move elsewhere -//-------------------------------------------------------------------- -MP_API int mp_file_move(str8 from, str8 to); -MP_API int mp_file_remove(str8 path); - -MP_API int mp_directory_create(str8 path); - - -#endif // !defined(PLATFORM_ORCA) || !(PLATFORM_ORCA) - -#ifdef __cplusplus -} // extern "C" -#endif - - -#endif //__PLATFORM_APP_H_ diff --git a/src/app/orca_app.c b/src/app/orca_app.c index 281a359..cfeb123 100644 --- a/src/app/orca_app.c +++ b/src/app/orca_app.c @@ -1,4 +1,4 @@ #include"orca.h" //This is used to pass raw events from the runtime -ORCA_EXPORT mp_event _OrcaRawEvent; +ORCA_EXPORT oc_event oc_rawEvent; diff --git a/src/app/osx_app.h b/src/app/osx_app.h index 1be6020..d578c1c 100644 --- a/src/app/osx_app.h +++ b/src/app/osx_app.h @@ -9,7 +9,7 @@ #ifndef __OSX_APP_H_ #define __OSX_APP_H_ -#include"mp_app.h" +#include"app.h" #include"graphics/graphics.h" #ifdef __OBJC__ @@ -26,19 +26,19 @@ #include -typedef struct osx_window_data +typedef struct oc_osx_window_data { NSWindow* nsWindow; NSView* nsView; NSObject* nsWindowDelegate; -} osx_window_data; +} oc_osx_window_data; -#define MP_PLATFORM_WINDOW_DATA osx_window_data osx; +#define OC_PLATFORM_WINDOW_DATA oc_osx_window_data osx; -const u32 MP_APP_MAX_VIEWS = 128; +const u32 OC_APP_MAX_VIEWS = 128; -typedef struct osx_app_data +typedef struct oc_osx_app_data { NSTimer* frameTimer; NSCursor* cursor; @@ -47,9 +47,9 @@ typedef struct osx_app_data void* kbLayoutUnicodeData; id kbLayoutListener; -} osx_app_data; +} oc_osx_app_data; -#define MP_PLATFORM_APP_DATA osx_app_data osx; +#define OC_PLATFORM_APP_DATA oc_osx_app_data osx; //----------------------------------------------- // Surface layer @@ -76,11 +76,11 @@ typedef struct osx_app_data @end #endif -typedef struct mp_layer +typedef struct oc_layer { CALayer* caLayer; CAContext* caContext; -} mp_layer; +} oc_layer; diff --git a/src/app/osx_app.m b/src/app/osx_app.m index 546d632..e93d609 100644 --- a/src/app/osx_app.m +++ b/src/app/osx_app.m @@ -15,21 +15,21 @@ #include"lists.h" #include"ringbuffer.h" #include"memory.h" -#include"macro_helpers.h" +#include"macros.h" #include"platform_debug.h" #include"platform_clock.h" #include"graphics/graphics_surface.h" -#include"mp_app.c" +#include"app.c" //-------------------------------------------------------------------- // mp window struct and utility functions //-------------------------------------------------------------------- -static u32 mp_osx_get_window_style_mask(mp_window_style style) +static u32 oc_osx_get_window_style_mask(oc_window_style style) { u32 mask = 0; - if(style & MP_WINDOW_STYLE_NO_TITLE) + if(style & OC_WINDOW_STYLE_NO_TITLE) { mask = NSWindowStyleMaskBorderless; } @@ -38,15 +38,15 @@ static u32 mp_osx_get_window_style_mask(mp_window_style style) mask = NSWindowStyleMaskTitled; } - if(!(style & MP_WINDOW_STYLE_FIXED_SIZE)) + if(!(style & OC_WINDOW_STYLE_FIXED_SIZE)) { mask |= NSWindowStyleMaskResizable; } - if(!(style & MP_WINDOW_STYLE_NO_CLOSE)) + if(!(style & OC_WINDOW_STYLE_NO_CLOSE)) { mask |= NSWindowStyleMaskClosable; } - if(!(style & MP_WINDOW_STYLE_NO_MINIFY)) + if(!(style & OC_WINDOW_STYLE_NO_MINIFY)) { mask |= NSWindowStyleMaskMiniaturizable; } @@ -55,205 +55,205 @@ static u32 mp_osx_get_window_style_mask(mp_window_style style) //--------------------------------------------------------------- -static void mp_init_osx_keys() +static void oc_init_osx_keys() { - memset(__mpApp.keyCodes, MP_KEY_UNKNOWN, 256*sizeof(int)); + memset(oc_appData.keyCodes, OC_KEY_UNKNOWN, 256*sizeof(int)); - __mpApp.keyCodes[0x1D] = MP_KEY_0; - __mpApp.keyCodes[0x12] = MP_KEY_1; - __mpApp.keyCodes[0x13] = MP_KEY_2; - __mpApp.keyCodes[0x14] = MP_KEY_3; - __mpApp.keyCodes[0x15] = MP_KEY_4; - __mpApp.keyCodes[0x17] = MP_KEY_5; - __mpApp.keyCodes[0x16] = MP_KEY_6; - __mpApp.keyCodes[0x1A] = MP_KEY_7; - __mpApp.keyCodes[0x1C] = MP_KEY_8; - __mpApp.keyCodes[0x19] = MP_KEY_9; - __mpApp.keyCodes[0x00] = MP_KEY_A; - __mpApp.keyCodes[0x0B] = MP_KEY_B; - __mpApp.keyCodes[0x08] = MP_KEY_C; - __mpApp.keyCodes[0x02] = MP_KEY_D; - __mpApp.keyCodes[0x0E] = MP_KEY_E; - __mpApp.keyCodes[0x03] = MP_KEY_F; - __mpApp.keyCodes[0x05] = MP_KEY_G; - __mpApp.keyCodes[0x04] = MP_KEY_H; - __mpApp.keyCodes[0x22] = MP_KEY_I; - __mpApp.keyCodes[0x26] = MP_KEY_J; - __mpApp.keyCodes[0x28] = MP_KEY_K; - __mpApp.keyCodes[0x25] = MP_KEY_L; - __mpApp.keyCodes[0x2E] = MP_KEY_M; - __mpApp.keyCodes[0x2D] = MP_KEY_N; - __mpApp.keyCodes[0x1F] = MP_KEY_O; - __mpApp.keyCodes[0x23] = MP_KEY_P; - __mpApp.keyCodes[0x0C] = MP_KEY_Q; - __mpApp.keyCodes[0x0F] = MP_KEY_R; - __mpApp.keyCodes[0x01] = MP_KEY_S; - __mpApp.keyCodes[0x11] = MP_KEY_T; - __mpApp.keyCodes[0x20] = MP_KEY_U; - __mpApp.keyCodes[0x09] = MP_KEY_V; - __mpApp.keyCodes[0x0D] = MP_KEY_W; - __mpApp.keyCodes[0x07] = MP_KEY_X; - __mpApp.keyCodes[0x10] = MP_KEY_Y; - __mpApp.keyCodes[0x06] = MP_KEY_Z; + oc_appData.keyCodes[0x1D] = OC_KEY_0; + oc_appData.keyCodes[0x12] = OC_KEY_1; + oc_appData.keyCodes[0x13] = OC_KEY_2; + oc_appData.keyCodes[0x14] = OC_KEY_3; + oc_appData.keyCodes[0x15] = OC_KEY_4; + oc_appData.keyCodes[0x17] = OC_KEY_5; + oc_appData.keyCodes[0x16] = OC_KEY_6; + oc_appData.keyCodes[0x1A] = OC_KEY_7; + oc_appData.keyCodes[0x1C] = OC_KEY_8; + oc_appData.keyCodes[0x19] = OC_KEY_9; + oc_appData.keyCodes[0x00] = OC_KEY_A; + oc_appData.keyCodes[0x0B] = OC_KEY_B; + oc_appData.keyCodes[0x08] = OC_KEY_C; + oc_appData.keyCodes[0x02] = OC_KEY_D; + oc_appData.keyCodes[0x0E] = OC_KEY_E; + oc_appData.keyCodes[0x03] = OC_KEY_F; + oc_appData.keyCodes[0x05] = OC_KEY_G; + oc_appData.keyCodes[0x04] = OC_KEY_H; + oc_appData.keyCodes[0x22] = OC_KEY_I; + oc_appData.keyCodes[0x26] = OC_KEY_J; + oc_appData.keyCodes[0x28] = OC_KEY_K; + oc_appData.keyCodes[0x25] = OC_KEY_L; + oc_appData.keyCodes[0x2E] = OC_KEY_M; + oc_appData.keyCodes[0x2D] = OC_KEY_N; + oc_appData.keyCodes[0x1F] = OC_KEY_O; + oc_appData.keyCodes[0x23] = OC_KEY_P; + oc_appData.keyCodes[0x0C] = OC_KEY_Q; + oc_appData.keyCodes[0x0F] = OC_KEY_R; + oc_appData.keyCodes[0x01] = OC_KEY_S; + oc_appData.keyCodes[0x11] = OC_KEY_T; + oc_appData.keyCodes[0x20] = OC_KEY_U; + oc_appData.keyCodes[0x09] = OC_KEY_V; + oc_appData.keyCodes[0x0D] = OC_KEY_W; + oc_appData.keyCodes[0x07] = OC_KEY_X; + oc_appData.keyCodes[0x10] = OC_KEY_Y; + oc_appData.keyCodes[0x06] = OC_KEY_Z; - __mpApp.keyCodes[0x27] = MP_KEY_APOSTROPHE; - __mpApp.keyCodes[0x2A] = MP_KEY_BACKSLASH; - __mpApp.keyCodes[0x2B] = MP_KEY_COMMA; - __mpApp.keyCodes[0x18] = MP_KEY_EQUAL; - __mpApp.keyCodes[0x32] = MP_KEY_GRAVE_ACCENT; - __mpApp.keyCodes[0x21] = MP_KEY_LEFT_BRACKET; - __mpApp.keyCodes[0x1B] = MP_KEY_MINUS; - __mpApp.keyCodes[0x2F] = MP_KEY_PERIOD; - __mpApp.keyCodes[0x1E] = MP_KEY_RIGHT_BRACKET; - __mpApp.keyCodes[0x29] = MP_KEY_SEMICOLON; - __mpApp.keyCodes[0x2C] = MP_KEY_SLASH; - __mpApp.keyCodes[0x0A] = MP_KEY_WORLD_1; + oc_appData.keyCodes[0x27] = OC_KEY_APOSTROPHE; + oc_appData.keyCodes[0x2A] = OC_KEY_BACKSLASH; + oc_appData.keyCodes[0x2B] = OC_KEY_COMMA; + oc_appData.keyCodes[0x18] = OC_KEY_EQUAL; + oc_appData.keyCodes[0x32] = OC_KEY_GRAVE_ACCENT; + oc_appData.keyCodes[0x21] = OC_KEY_LEFT_BRACKET; + oc_appData.keyCodes[0x1B] = OC_KEY_MINUS; + oc_appData.keyCodes[0x2F] = OC_KEY_PERIOD; + oc_appData.keyCodes[0x1E] = OC_KEY_RIGHT_BRACKET; + oc_appData.keyCodes[0x29] = OC_KEY_SEMICOLON; + oc_appData.keyCodes[0x2C] = OC_KEY_SLASH; + oc_appData.keyCodes[0x0A] = OC_KEY_WORLD_1; - __mpApp.keyCodes[0x33] = MP_KEY_BACKSPACE; - __mpApp.keyCodes[0x39] = MP_KEY_CAPS_LOCK; - __mpApp.keyCodes[0x75] = MP_KEY_DELETE; - __mpApp.keyCodes[0x7D] = MP_KEY_DOWN; - __mpApp.keyCodes[0x77] = MP_KEY_END; - __mpApp.keyCodes[0x24] = MP_KEY_ENTER; - __mpApp.keyCodes[0x35] = MP_KEY_ESCAPE; - __mpApp.keyCodes[0x7A] = MP_KEY_F1; - __mpApp.keyCodes[0x78] = MP_KEY_F2; - __mpApp.keyCodes[0x63] = MP_KEY_F3; - __mpApp.keyCodes[0x76] = MP_KEY_F4; - __mpApp.keyCodes[0x60] = MP_KEY_F5; - __mpApp.keyCodes[0x61] = MP_KEY_F6; - __mpApp.keyCodes[0x62] = MP_KEY_F7; - __mpApp.keyCodes[0x64] = MP_KEY_F8; - __mpApp.keyCodes[0x65] = MP_KEY_F9; - __mpApp.keyCodes[0x6D] = MP_KEY_F10; - __mpApp.keyCodes[0x67] = MP_KEY_F11; - __mpApp.keyCodes[0x6F] = MP_KEY_F12; - __mpApp.keyCodes[0x69] = MP_KEY_F13; - __mpApp.keyCodes[0x6B] = MP_KEY_F14; - __mpApp.keyCodes[0x71] = MP_KEY_F15; - __mpApp.keyCodes[0x6A] = MP_KEY_F16; - __mpApp.keyCodes[0x40] = MP_KEY_F17; - __mpApp.keyCodes[0x4F] = MP_KEY_F18; - __mpApp.keyCodes[0x50] = MP_KEY_F19; - __mpApp.keyCodes[0x5A] = MP_KEY_F20; - __mpApp.keyCodes[0x73] = MP_KEY_HOME; - __mpApp.keyCodes[0x72] = MP_KEY_INSERT; - __mpApp.keyCodes[0x7B] = MP_KEY_LEFT; - __mpApp.keyCodes[0x3A] = MP_KEY_LEFT_ALT; - __mpApp.keyCodes[0x3B] = MP_KEY_LEFT_CONTROL; - __mpApp.keyCodes[0x38] = MP_KEY_LEFT_SHIFT; - __mpApp.keyCodes[0x37] = MP_KEY_LEFT_SUPER; - __mpApp.keyCodes[0x6E] = MP_KEY_MENU; - __mpApp.keyCodes[0x47] = MP_KEY_NUM_LOCK; - __mpApp.keyCodes[0x79] = MP_KEY_PAGE_DOWN; - __mpApp.keyCodes[0x74] = MP_KEY_PAGE_UP; - __mpApp.keyCodes[0x7C] = MP_KEY_RIGHT; - __mpApp.keyCodes[0x3D] = MP_KEY_RIGHT_ALT; - __mpApp.keyCodes[0x3E] = MP_KEY_RIGHT_CONTROL; - __mpApp.keyCodes[0x3C] = MP_KEY_RIGHT_SHIFT; - __mpApp.keyCodes[0x36] = MP_KEY_RIGHT_SUPER; - __mpApp.keyCodes[0x31] = MP_KEY_SPACE; - __mpApp.keyCodes[0x30] = MP_KEY_TAB; - __mpApp.keyCodes[0x7E] = MP_KEY_UP; + oc_appData.keyCodes[0x33] = OC_KEY_BACKSPACE; + oc_appData.keyCodes[0x39] = OC_KEY_CAPS_LOCK; + oc_appData.keyCodes[0x75] = OC_KEY_DELETE; + oc_appData.keyCodes[0x7D] = OC_KEY_DOWN; + oc_appData.keyCodes[0x77] = OC_KEY_END; + oc_appData.keyCodes[0x24] = OC_KEY_ENTER; + oc_appData.keyCodes[0x35] = OC_KEY_ESCAPE; + oc_appData.keyCodes[0x7A] = OC_KEY_F1; + oc_appData.keyCodes[0x78] = OC_KEY_F2; + oc_appData.keyCodes[0x63] = OC_KEY_F3; + oc_appData.keyCodes[0x76] = OC_KEY_F4; + oc_appData.keyCodes[0x60] = OC_KEY_F5; + oc_appData.keyCodes[0x61] = OC_KEY_F6; + oc_appData.keyCodes[0x62] = OC_KEY_F7; + oc_appData.keyCodes[0x64] = OC_KEY_F8; + oc_appData.keyCodes[0x65] = OC_KEY_F9; + oc_appData.keyCodes[0x6D] = OC_KEY_F10; + oc_appData.keyCodes[0x67] = OC_KEY_F11; + oc_appData.keyCodes[0x6F] = OC_KEY_F12; + oc_appData.keyCodes[0x69] = OC_KEY_F13; + oc_appData.keyCodes[0x6B] = OC_KEY_F14; + oc_appData.keyCodes[0x71] = OC_KEY_F15; + oc_appData.keyCodes[0x6A] = OC_KEY_F16; + oc_appData.keyCodes[0x40] = OC_KEY_F17; + oc_appData.keyCodes[0x4F] = OC_KEY_F18; + oc_appData.keyCodes[0x50] = OC_KEY_F19; + oc_appData.keyCodes[0x5A] = OC_KEY_F20; + oc_appData.keyCodes[0x73] = OC_KEY_HOME; + oc_appData.keyCodes[0x72] = OC_KEY_INSERT; + oc_appData.keyCodes[0x7B] = OC_KEY_LEFT; + oc_appData.keyCodes[0x3A] = OC_KEY_LEFT_ALT; + oc_appData.keyCodes[0x3B] = OC_KEY_LEFT_CONTROL; + oc_appData.keyCodes[0x38] = OC_KEY_LEFT_SHIFT; + oc_appData.keyCodes[0x37] = OC_KEY_LEFT_SUPER; + oc_appData.keyCodes[0x6E] = OC_KEY_MENU; + oc_appData.keyCodes[0x47] = OC_KEY_NUM_LOCK; + oc_appData.keyCodes[0x79] = OC_KEY_PAGE_DOWN; + oc_appData.keyCodes[0x74] = OC_KEY_PAGE_UP; + oc_appData.keyCodes[0x7C] = OC_KEY_RIGHT; + oc_appData.keyCodes[0x3D] = OC_KEY_RIGHT_ALT; + oc_appData.keyCodes[0x3E] = OC_KEY_RIGHT_CONTROL; + oc_appData.keyCodes[0x3C] = OC_KEY_RIGHT_SHIFT; + oc_appData.keyCodes[0x36] = OC_KEY_RIGHT_SUPER; + oc_appData.keyCodes[0x31] = OC_KEY_SPACE; + oc_appData.keyCodes[0x30] = OC_KEY_TAB; + oc_appData.keyCodes[0x7E] = OC_KEY_UP; - __mpApp.keyCodes[0x52] = MP_KEY_KP_0; - __mpApp.keyCodes[0x53] = MP_KEY_KP_1; - __mpApp.keyCodes[0x54] = MP_KEY_KP_2; - __mpApp.keyCodes[0x55] = MP_KEY_KP_3; - __mpApp.keyCodes[0x56] = MP_KEY_KP_4; - __mpApp.keyCodes[0x57] = MP_KEY_KP_5; - __mpApp.keyCodes[0x58] = MP_KEY_KP_6; - __mpApp.keyCodes[0x59] = MP_KEY_KP_7; - __mpApp.keyCodes[0x5B] = MP_KEY_KP_8; - __mpApp.keyCodes[0x5C] = MP_KEY_KP_9; - __mpApp.keyCodes[0x45] = MP_KEY_KP_ADD; - __mpApp.keyCodes[0x41] = MP_KEY_KP_DECIMAL; - __mpApp.keyCodes[0x4B] = MP_KEY_KP_DIVIDE; - __mpApp.keyCodes[0x4C] = MP_KEY_KP_ENTER; - __mpApp.keyCodes[0x51] = MP_KEY_KP_EQUAL; - __mpApp.keyCodes[0x43] = MP_KEY_KP_MULTIPLY; - __mpApp.keyCodes[0x4E] = MP_KEY_KP_SUBTRACT; + oc_appData.keyCodes[0x52] = OC_KEY_KP_0; + oc_appData.keyCodes[0x53] = OC_KEY_KP_1; + oc_appData.keyCodes[0x54] = OC_KEY_KP_2; + oc_appData.keyCodes[0x55] = OC_KEY_KP_3; + oc_appData.keyCodes[0x56] = OC_KEY_KP_4; + oc_appData.keyCodes[0x57] = OC_KEY_KP_5; + oc_appData.keyCodes[0x58] = OC_KEY_KP_6; + oc_appData.keyCodes[0x59] = OC_KEY_KP_7; + oc_appData.keyCodes[0x5B] = OC_KEY_KP_8; + oc_appData.keyCodes[0x5C] = OC_KEY_KP_9; + oc_appData.keyCodes[0x45] = OC_KEY_KP_ADD; + oc_appData.keyCodes[0x41] = OC_KEY_KP_DECIMAL; + oc_appData.keyCodes[0x4B] = OC_KEY_KP_DIVIDE; + oc_appData.keyCodes[0x4C] = OC_KEY_KP_ENTER; + oc_appData.keyCodes[0x51] = OC_KEY_KP_EQUAL; + oc_appData.keyCodes[0x43] = OC_KEY_KP_MULTIPLY; + oc_appData.keyCodes[0x4E] = OC_KEY_KP_SUBTRACT; - memset(__mpApp.nativeKeys, 0, sizeof(int)*MP_KEY_COUNT); + memset(oc_appData.nativeKeys, 0, sizeof(int)*OC_KEY_COUNT); for(int nativeKey=0; nativeKey<256; nativeKey++) { - mp_key_code mpKey = __mpApp.keyCodes[nativeKey]; + oc_key_code mpKey = oc_appData.keyCodes[nativeKey]; if(mpKey) { - __mpApp.nativeKeys[mpKey] = nativeKey; + oc_appData.nativeKeys[mpKey] = nativeKey; } } } -static int mp_convert_osx_key(unsigned short nsCode) +static int oc_convert_osx_key(unsigned short nsCode) { if(nsCode >= 265) { - return(MP_KEY_UNKNOWN); + return(OC_KEY_UNKNOWN); } else { - return(__mpApp.keyCodes[nsCode]); + return(oc_appData.keyCodes[nsCode]); } } -static mp_keymod_flags mp_convert_osx_mods(NSUInteger nsFlags) +static oc_keymod_flags oc_convert_osx_mods(NSUInteger nsFlags) { - mp_keymod_flags mods = MP_KEYMOD_NONE; + oc_keymod_flags mods = OC_KEYMOD_NONE; if(nsFlags & NSEventModifierFlagShift) { - mods |= MP_KEYMOD_SHIFT; + mods |= OC_KEYMOD_SHIFT; } if(nsFlags & NSEventModifierFlagControl) { - mods |= MP_KEYMOD_CTRL; + mods |= OC_KEYMOD_CTRL; } if(nsFlags & NSEventModifierFlagOption) { - mods |= MP_KEYMOD_ALT; + mods |= OC_KEYMOD_ALT; } if(nsFlags & NSEventModifierFlagCommand) { - mods |= MP_KEYMOD_CMD; - mods |= MP_KEYMOD_MAIN_MODIFIER; + mods |= OC_KEYMOD_CMD; + mods |= OC_KEYMOD_MAIN_MODIFIER; } return(mods); } -static void mp_update_keyboard_layout() +static void oc_update_keyboard_layout() { - if(__mpApp.osx.kbLayoutInputSource) + if(oc_appData.osx.kbLayoutInputSource) { - CFRelease(__mpApp.osx.kbLayoutInputSource); - __mpApp.osx.kbLayoutInputSource = 0; - __mpApp.osx.kbLayoutUnicodeData = nil; + CFRelease(oc_appData.osx.kbLayoutInputSource); + oc_appData.osx.kbLayoutInputSource = 0; + oc_appData.osx.kbLayoutUnicodeData = nil; } - __mpApp.osx.kbLayoutInputSource = TISCopyCurrentKeyboardLayoutInputSource(); - if(!__mpApp.osx.kbLayoutInputSource) + oc_appData.osx.kbLayoutInputSource = TISCopyCurrentKeyboardLayoutInputSource(); + if(!oc_appData.osx.kbLayoutInputSource) { - log_error("Failed to load keyboard layout input source"); + oc_log_error("Failed to load keyboard layout input source"); } - __mpApp.osx.kbLayoutUnicodeData = TISGetInputSourceProperty(__mpApp.osx.kbLayoutInputSource, + oc_appData.osx.kbLayoutUnicodeData = TISGetInputSourceProperty(oc_appData.osx.kbLayoutInputSource, kTISPropertyUnicodeKeyLayoutData); - if(!__mpApp.osx.kbLayoutUnicodeData) + if(!oc_appData.osx.kbLayoutUnicodeData) { - log_error("Failed to load keyboard layout unicode data"); + oc_log_error("Failed to load keyboard layout unicode data"); } - memset(__mpApp.keyLabels, 0, sizeof(mp_key_utf8)*MP_KEY_COUNT); + memset(oc_appData.keyLabels, 0, sizeof(oc_key_utf8)*OC_KEY_COUNT); - for(int key=0; keylabelLen, keyInfo->label); + oc_key_utf8* keyInfo = &(oc_appData.keyLabels[key]); + oc_str8 label = oc_str8_from_buffer(keyInfo->labelLen, keyInfo->label); return(label); } -mp_key_code mp_label_to_key(str8 label) +oc_key_code oc_label_to_key(oc_str8 label) { - mp_key_code res = MP_KEY_UNKNOWN; - for(int key=0; key +@interface OCAppDelegate : NSObject -(id)init; @end -@implementation MPAppDelegate +@implementation OCAppDelegate -(id)init { @@ -373,14 +373,14 @@ void mp_install_keyboard_layout_listener() { //NOTE: We set shouldQuit to true and send a Quit event // We then return a value to cancel the direct termination because we still - // want to execte the code after mp_event_loop(). If the user didn't set shouldQuit to - // false, mp_event_loop() will exit, and the user can execute any cleanup needed and + // want to execte the code after oc_event_loop(). If the user didn't set shouldQuit to + // false, oc_event_loop() will exit, and the user can execute any cleanup needed and // exit the program. - __mpApp.shouldQuit = true; - mp_event event = {}; - event.type = MP_EVENT_QUIT; - mp_queue_event(&event); + oc_appData.shouldQuit = true; + oc_event event = {}; + event.type = OC_EVENT_QUIT; + oc_queue_event(&event); return(NSTerminateCancel); } @@ -407,9 +407,9 @@ void mp_install_keyboard_layout_listener() - (void)timerElapsed:(NSTimer*)timer { - mp_event event = {}; - event.type = MP_EVENT_FRAME; - mp_queue_event(&event); + oc_event event = {}; + event.type = OC_EVENT_FRAME; + oc_queue_event(&event); } - (void)applicationDidFinishLaunching:(NSNotification *)notification @@ -438,19 +438,19 @@ void mp_install_keyboard_layout_listener() - (BOOL)application:(NSApplication *)application openFile:(NSString *)filename { - mp_event event = {0}; - event.window = (mp_window){0}; - event.type = MP_EVENT_PATHDROP; + oc_event event = {0}; + event.window = (oc_window){0}; + event.type = OC_EVENT_PATHDROP; - mem_arena* scratch = mem_scratch(); - mem_arena_scope scope = mem_arena_scope_begin(scratch); + oc_arena* scratch = oc_scratch(); + oc_arena_scope scope = oc_arena_scope_begin(scratch); - str8 path = str8_push_cstring(scratch, [filename UTF8String]); - str8_list_push(scratch, &event.paths, path); + oc_str8 path = oc_str8_push_cstring(scratch, [filename UTF8String]); + oc_str8_list_push(scratch, &event.paths, path); - mp_queue_event(&event); + oc_queue_event(&event); - mem_arena_scope_end(scope); + oc_arena_scope_end(scope); return(YES); } @@ -459,38 +459,38 @@ void mp_install_keyboard_layout_listener() { NSString* nsPath = [[appleEvent paramDescriptorForKeyword:keyDirectObject] stringValue]; - mp_event event = {}; - event.window = (mp_window){0}; - event.type = MP_EVENT_PATHDROP; + oc_event event = {}; + event.window = (oc_window){0}; + event.type = OC_EVENT_PATHDROP; - mem_arena* scratch = mem_scratch(); - mem_arena_scope scope = mem_arena_scope_begin(scratch); + oc_arena* scratch = oc_scratch(); + oc_arena_scope scope = oc_arena_scope_begin(scratch); - str8 path = str8_push_cstring(scratch, [nsPath UTF8String]); - str8_list_push(scratch, &event.paths, path); + oc_str8 path = oc_str8_push_cstring(scratch, [nsPath UTF8String]); + oc_str8_list_push(scratch, &event.paths, path); - mp_queue_event(&event); + oc_queue_event(&event); - mem_arena_scope_end(scope); + oc_arena_scope_end(scope); } //TODO: drag and drop paths -@end // @implementation MPAppDelegate +@end // @implementation OCAppDelegate //--------------------------------------------------------------- // Custom NSWindow //--------------------------------------------------------------- -@implementation MPNativeWindow -- (id)initWithMPWindow:(mp_window_data*) window contentRect:(NSRect) rect styleMask:(uint32) style +@implementation OCWindow +- (id)initWithWindowData:(oc_window_data*) window contentRect:(NSRect) rect styleMask:(uint32) style { mpWindow = window; return([self initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:NO]); } - (BOOL)canBecomeKeyWindow { - return(!(mpWindow->style & MP_WINDOW_STYLE_NO_FOCUS)); + return(!(mpWindow->style & OC_WINDOW_STYLE_NO_FOCUS)); } /* - (NSDragOperation)draggingEntered:(id )sender @@ -571,22 +571,22 @@ void mp_install_keyboard_layout_listener() - (BOOL)validateMenuItem:(NSMenuItem *)menuItem; */ -@end //@implementation MPNativeWindow +@end //@implementation OCWindow //--------------------------------------------------------------- // Custom NSWindow delegate //--------------------------------------------------------------- -@interface MPNativeWindowDelegate : NSObject +@interface OCWindowDelegate : NSObject { - mp_window_data* mpWindow; + oc_window_data* mpWindow; } -- (id)initWithMPWindow:(mp_window_data*) window; +- (id)initWithWindowData:(oc_window_data*) window; @end -@implementation MPNativeWindowDelegate +@implementation OCWindowDelegate -- (id)initWithMPWindow:(mp_window_data*) window +- (id)initWithWindowData:(oc_window_data*) window { self = [super init]; if(self != nil) @@ -598,22 +598,22 @@ void mp_install_keyboard_layout_listener() - (void)windowDidBecomeKey:(NSNotification*)notification { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_FOCUS; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_FOCUS; mpWindow->hidden = false; - mp_queue_event(&event); + oc_queue_event(&event); } - (void)windowDidResignKey:(NSNotification*)notification { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_UNFOCUS; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_UNFOCUS; - mp_queue_event(&event); + oc_queue_event(&event); } - (void)windowDidMove:(NSNotification *)notification @@ -622,9 +622,9 @@ void mp_install_keyboard_layout_listener() const NSRect frameRect = [mpWindow->osx.nsWindow frame]; NSScreen* screen = mpWindow->osx.nsWindow.screen; - mp_event event = {}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_MOVE; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_MOVE; event.move.frame.x = frameRect.origin.x; event.move.frame.y = screen.frame.size.height - frameRect.origin.y - frameRect.size.height; @@ -636,7 +636,7 @@ void mp_install_keyboard_layout_listener() event.move.content.w = contentRect.size.width; event.move.content.h = contentRect.size.height; - mp_queue_event(&event); + oc_queue_event(&event); } - (void)windowDidResize:(NSNotification *)notification @@ -645,9 +645,9 @@ void mp_install_keyboard_layout_listener() const NSRect frameRect = [mpWindow->osx.nsWindow frame]; NSScreen* screen = mpWindow->osx.nsWindow.screen; - mp_event event = {}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_RESIZE; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_RESIZE; event.move.frame.x = frameRect.origin.x; event.move.frame.y = screen.frame.size.height - frameRect.origin.y - frameRect.size.height; @@ -659,13 +659,13 @@ void mp_install_keyboard_layout_listener() event.move.content.w = contentRect.size.width; event.move.content.h = contentRect.size.height; - if(__mpApp.liveResizeCallback) + if(oc_appData.liveResizeCallback) { - __mpApp.liveResizeCallback(event, __mpApp.liveResizeData); + oc_appData.liveResizeCallback(event, oc_appData.liveResizeData); } //TODO: also ensure we don't overflow the queue during live resize... - mp_queue_event(&event); + oc_queue_event(&event); } -(void)windowWillStartLiveResize:(NSNotification *)notification @@ -686,40 +686,40 @@ void mp_install_keyboard_layout_listener() [mpWindow->osx.nsWindowDelegate release]; mpWindow->osx.nsWindowDelegate = nil; - mp_window_recycle_ptr(mpWindow); + oc_window_recycle_ptr(mpWindow); } - (BOOL)windowShouldClose:(id)sender { mpWindow->shouldClose = true; - mp_event event = {}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_CLOSE; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_CLOSE; - mp_queue_event(&event); + oc_queue_event(&event); return(mpWindow->shouldClose); } -@end //@implementation MPNativeWindowDelegate +@end //@implementation OCWindowDelegate //--------------------------------------------------------------- // Custom NSView //--------------------------------------------------------------- -@interface MPNativeView : NSView +@interface OCView : NSView { - mp_window_data* window; + oc_window_data* window; NSTrackingArea* trackingArea; NSMutableAttributedString* markedText; } -- (id)initWithMPWindow:(mp_window_data*) mpWindow; +- (id)initWithWindowData:(oc_window_data*) mpWindow; @end -@implementation MPNativeView +@implementation OCView -- (id)initWithMPWindow:(mp_window_data*) mpWindow +- (id)initWithWindowData:(oc_window_data*) mpWindow { self = [super init]; if(self != nil) @@ -753,7 +753,7 @@ void mp_install_keyboard_layout_listener() -(void)drawRect:(NSRect)dirtyRect { - if(window->style & MP_WINDOW_STYLE_NO_TITLE) + if(window->style & OC_WINDOW_STYLE_NO_TITLE) { [NSGraphicsContext saveGraphicsState]; NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:[self frame] xRadius:5 yRadius:5]; @@ -762,7 +762,7 @@ void mp_install_keyboard_layout_listener() NSRectFill([self frame]); } - if(window->style & MP_WINDOW_STYLE_NO_TITLE) + if(window->style & OC_WINDOW_STYLE_NO_TITLE) { [NSGraphicsContext restoreGraphicsState]; [window->osx.nsWindow invalidateShadow]; @@ -776,9 +776,9 @@ void mp_install_keyboard_layout_listener() - (void)cursorUpdate:(NSEvent*)event { - if(__mpApp.osx.cursor) + if(oc_appData.osx.cursor) { - [__mpApp.osx.cursor set]; + [oc_appData.osx.cursor set]; } else { @@ -786,48 +786,48 @@ void mp_install_keyboard_layout_listener() } } -static void mp_process_mouse_button(NSEvent* nsEvent, mp_window_data* window, mp_mouse_button button, mp_key_action action) +static void oc_process_mouse_button(NSEvent* nsEvent, oc_window_data* window, oc_mouse_button button, oc_key_action action) { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_MOUSE_BUTTON; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_MOUSE_BUTTON; event.key.action = action; event.key.code = button; - event.key.mods = mp_convert_osx_mods([nsEvent modifierFlags]); + event.key.mods = oc_convert_osx_mods([nsEvent modifierFlags]); event.key.clickCount = [nsEvent clickCount]; - mp_queue_event(&event); + oc_queue_event(&event); } - (void)mouseDown:(NSEvent *)nsEvent { - mp_process_mouse_button(nsEvent, window, MP_MOUSE_LEFT, MP_KEY_PRESS); + oc_process_mouse_button(nsEvent, window, OC_MOUSE_LEFT, OC_KEY_PRESS); [window->osx.nsWindow makeFirstResponder:self]; } - (void)mouseUp:(NSEvent*)nsEvent { - mp_process_mouse_button(nsEvent, window, MP_MOUSE_LEFT, MP_KEY_RELEASE); + oc_process_mouse_button(nsEvent, window, OC_MOUSE_LEFT, OC_KEY_RELEASE); } - (void)rightMouseDown:(NSEvent*)nsEvent { - mp_process_mouse_button(nsEvent, window, MP_MOUSE_RIGHT, MP_KEY_PRESS); + oc_process_mouse_button(nsEvent, window, OC_MOUSE_RIGHT, OC_KEY_PRESS); } - (void)rightMouseUp:(NSEvent*)nsEvent { - mp_process_mouse_button(nsEvent, window, MP_MOUSE_RIGHT, MP_KEY_RELEASE); + oc_process_mouse_button(nsEvent, window, OC_MOUSE_RIGHT, OC_KEY_RELEASE); } - (void)otherMouseDown:(NSEvent*)nsEvent { - mp_process_mouse_button(nsEvent, window, [nsEvent buttonNumber], MP_KEY_PRESS); + oc_process_mouse_button(nsEvent, window, [nsEvent buttonNumber], OC_KEY_PRESS); } - (void)otherMouseUp:(NSEvent*)nsEvent { - mp_process_mouse_button(nsEvent, window, [nsEvent buttonNumber], MP_KEY_RELEASE); + oc_process_mouse_button(nsEvent, window, [nsEvent buttonNumber], OC_KEY_RELEASE); } - (void)mouseDragged:(NSEvent*)nsEvent @@ -840,90 +840,90 @@ static void mp_process_mouse_button(NSEvent* nsEvent, mp_window_data* window, mp NSPoint p = [self convertPoint:[nsEvent locationInWindow] fromView:nil]; NSRect frame = [[window->osx.nsWindow contentView] frame]; - mp_event event = {}; - event.type = MP_EVENT_MOUSE_MOVE; - event.window = mp_window_handle_from_ptr(window); + oc_event event = {}; + event.type = OC_EVENT_MOUSE_MOVE; + event.window = oc_window_handle_from_ptr(window); event.mouse.x = p.x; event.mouse.y = frame.size.height - p.y; event.mouse.deltaX = [nsEvent deltaX]; event.mouse.deltaY = [nsEvent deltaY]; - event.mouse.mods = mp_convert_osx_mods([nsEvent modifierFlags]); + event.mouse.mods = oc_convert_osx_mods([nsEvent modifierFlags]); - mp_queue_event(&event); + oc_queue_event(&event); } - (void)scrollWheel:(NSEvent*)nsEvent { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_MOUSE_WHEEL; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_MOUSE_WHEEL; double factor = [nsEvent hasPreciseScrollingDeltas] ? 0.1 : 1.0; event.mouse.x = 0; event.mouse.y = 0; event.mouse.deltaX = -[nsEvent scrollingDeltaX]*factor; event.mouse.deltaY = -[nsEvent scrollingDeltaY]*factor; - event.mouse.mods = mp_convert_osx_mods([nsEvent modifierFlags]); + event.mouse.mods = oc_convert_osx_mods([nsEvent modifierFlags]); - mp_queue_event(&event); + oc_queue_event(&event); } - (void)mouseExited:(NSEvent *)nsEvent { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_MOUSE_LEAVE; - mp_queue_event(&event); + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_MOUSE_LEAVE; + oc_queue_event(&event); } - (void)mouseEntered:(NSEvent *)nsEvent { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_MOUSE_ENTER; - mp_queue_event(&event); + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_MOUSE_ENTER; + oc_queue_event(&event); } - (void)keyDown:(NSEvent*)nsEvent { - mp_key_action action = [nsEvent isARepeat] ? MP_KEY_REPEAT : MP_KEY_PRESS; + oc_key_action action = [nsEvent isARepeat] ? OC_KEY_REPEAT : OC_KEY_PRESS; - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_KEYBOARD_KEY; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_KEYBOARD_KEY; event.key.action = action; - event.key.code = mp_convert_osx_key([nsEvent keyCode]); - event.key.mods = mp_convert_osx_mods([nsEvent modifierFlags]); + event.key.code = oc_convert_osx_key([nsEvent keyCode]); + event.key.mods = oc_convert_osx_mods([nsEvent modifierFlags]); - str8 label = mp_key_to_label(event.key.code); + oc_str8 label = oc_key_to_label(event.key.code); event.key.labelLen = label.len; memcpy(event.key.label, label.ptr, label.len); - mp_queue_event(&event); + oc_queue_event(&event); [self interpretKeyEvents:@[nsEvent]]; } - (void)keyUp:(NSEvent*)nsEvent { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_KEYBOARD_KEY; - event.key.action = MP_KEY_RELEASE; - event.key.code = mp_convert_osx_key([nsEvent keyCode]); - event.key.mods = mp_convert_osx_mods([nsEvent modifierFlags]); + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_KEYBOARD_KEY; + event.key.action = OC_KEY_RELEASE; + event.key.code = oc_convert_osx_key([nsEvent keyCode]); + event.key.mods = oc_convert_osx_mods([nsEvent modifierFlags]); - mp_queue_event(&event); + oc_queue_event(&event); } - (void) flagsChanged:(NSEvent*)nsEvent { - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_KEYBOARD_MODS; - event.key.mods = mp_convert_osx_mods([nsEvent modifierFlags]); + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_KEYBOARD_MODS; + event.key.mods = oc_convert_osx_mods([nsEvent modifierFlags]); - mp_queue_event(&event); + oc_queue_event(&event); } - (BOOL)performKeyEquivalent:(NSEvent*)nsEvent @@ -937,12 +937,12 @@ static void mp_process_mouse_button(NSEvent* nsEvent, mp_window_data* window, mp } else if([nsEvent charactersIgnoringModifiers] == [NSString stringWithUTF8String:"q"]) { - __mpApp.shouldQuit = true; + oc_appData.shouldQuit = true; - mp_event event = {}; - event.type = MP_EVENT_QUIT; + oc_event event = {}; + event.type = OC_EVENT_QUIT; - mp_queue_event(&event); + oc_queue_event(&event); //[NSApp terminate:self]; return(YES); @@ -1024,7 +1024,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; { NSString* characters; NSEvent* nsEvent = [NSApp currentEvent]; - mp_keymod_flags mods = mp_convert_osx_mods([nsEvent modifierFlags]); + oc_keymod_flags mods = oc_convert_osx_mods([nsEvent modifierFlags]); if([string isKindOfClass:[NSAttributedString class]]) { @@ -1038,7 +1038,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; NSRange range = NSMakeRange(0, [characters length]); while (range.length) { - utf32 codepoint = 0; + oc_utf32 codepoint = 0; if ([characters getBytes:&codepoint maxLength:sizeof(codepoint) @@ -1053,15 +1053,15 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; continue; } - mp_event event = {}; - event.window = mp_window_handle_from_ptr(window); - event.type = MP_EVENT_KEYBOARD_CHAR; + oc_event event = {}; + event.window = oc_window_handle_from_ptr(window); + event.type = OC_EVENT_KEYBOARD_CHAR; event.character.codepoint = codepoint; - str8 seq = utf8_encode(event.character.sequence, event.character.codepoint); + oc_str8 seq = oc_utf8_encode(event.character.sequence, event.character.codepoint); event.character.seqLen = seq.len; - mp_queue_event(&event); + oc_queue_event(&event); } } [self unmarkText]; @@ -1072,50 +1072,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; } -@end //@implementation MPNativeView - -/* -void mp_sleep_nanoseconds(u64 nanoseconds) -{ - timespec rqtp; - rqtp.tv_sec = nanoseconds / 1000000000; - rqtp.tv_nsec = nanoseconds - rqtp.tv_sec * 1000000000; - nanosleep(&rqtp, 0); -} - -static mach_timebase_info_data_t __machTimeBase__ = {1,1}; - -u64 mp_get_elapsed_nanoseconds() -{ - //NOTE(martin): according to the documentation, mach_absolute_time() does not - // increment when the system is asleep - u64 now = mach_absolute_time(); - now *= __machTimeBase__.numer; - now /= __machTimeBase__.denom; - return(now); -} - -f64 mp_get_elapsed_seconds() -{ - return(1.e-9*(f64)mp_get_elapsed_nanoseconds()); -} -*/ -/* -CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, - const CVTimeStamp *inNow, - const CVTimeStamp *inOutputTime, - CVOptionFlags flagsIn, - CVOptionFlags *flagsOut, - void *displayLinkContext) -{ - if(__mpApp.displayRefreshCallback) - { - __mpApp.displayRefreshCallback(__mpApp.displayRefreshData); - } - - return(0); -} -*/ +@end //@implementation OCView //*************************************************************** // public API @@ -1125,33 +1082,33 @@ CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, // App public API //--------------------------------------------------------------- -void mp_init() +void oc_init() {@autoreleasepool { - if(!__mpApp.init) + if(!oc_appData.init) { - memset(&__mpApp, 0, sizeof(__mpApp)); + memset(&oc_appData, 0, sizeof(oc_appData)); - mem_arena_init(&__mpApp.eventArena); + oc_arena_init(&oc_appData.eventArena); - mp_clock_init(); + oc_clock_init(); - mp_init_osx_keys(); - mp_update_keyboard_layout(); - mp_install_keyboard_layout_listener(); + oc_init_osx_keys(); + oc_update_keyboard_layout(); + oc_install_keyboard_layout_listener(); - mp_init_window_handles(); + oc_init_window_handles(); - ringbuffer_init(&__mpApp.eventQueue, 16); + oc_ringbuffer_init(&oc_appData.eventQueue, 16); - [MPApplication sharedApplication]; - MPAppDelegate* delegate = [[MPAppDelegate alloc] init]; + [OCApplication sharedApplication]; + OCAppDelegate* delegate = [[OCAppDelegate alloc] init]; [NSApp setDelegate: delegate]; [NSThread detachNewThreadSelector:@selector(noOpThread:) toTarget:NSApp withObject:nil]; - __mpApp.init = true; + oc_appData.init = true; [NSApp run]; [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; @@ -1160,78 +1117,78 @@ void mp_init() } }} -void mp_terminate() +void oc_terminate() { //TODO: proper app data cleanup (eg delegate, etc) - if(__mpApp.init) + if(oc_appData.init) { - mem_arena_release(&__mpApp.eventArena); - __mpApp = (mp_app){0}; + oc_arena_cleanup(&oc_appData.eventArena); + oc_appData = (oc_app){0}; } } -bool mp_should_quit() +bool oc_should_quit() { - return(__mpApp.shouldQuit); + return(oc_appData.shouldQuit); } -void mp_do_quit() +void oc_do_quit() { - __mpApp.shouldQuit = true; + oc_appData.shouldQuit = true; } -void mp_cancel_quit() +void oc_cancel_quit() { - __mpApp.shouldQuit = false; + oc_appData.shouldQuit = false; } -void mp_request_quit() +void oc_request_quit() { - __mpApp.shouldQuit = true; - mp_event event = {}; - event.type = MP_EVENT_QUIT; - mp_queue_event(&event); + oc_appData.shouldQuit = true; + oc_event event = {}; + event.type = OC_EVENT_QUIT; + oc_queue_event(&event); } -void mp_set_cursor(mp_mouse_cursor cursor) +void oc_set_cursor(oc_mouse_cursor cursor) { switch(cursor) { - case MP_MOUSE_CURSOR_ARROW: + case OC_MOUSE_CURSOR_ARROW: { - __mpApp.osx.cursor = [NSCursor arrowCursor]; + oc_appData.osx.cursor = [NSCursor arrowCursor]; } break; - case MP_MOUSE_CURSOR_RESIZE_0: + case OC_MOUSE_CURSOR_RESIZE_0: { - __mpApp.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeEastWestCursor)]; + oc_appData.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeEastWestCursor)]; } break; - case MP_MOUSE_CURSOR_RESIZE_90: + case OC_MOUSE_CURSOR_RESIZE_90: { - __mpApp.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthSouthCursor)]; + oc_appData.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthSouthCursor)]; } break; - case MP_MOUSE_CURSOR_RESIZE_45: + case OC_MOUSE_CURSOR_RESIZE_45: { - __mpApp.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthEastSouthWestCursor)]; + oc_appData.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthEastSouthWestCursor)]; } break; - case MP_MOUSE_CURSOR_RESIZE_135: + case OC_MOUSE_CURSOR_RESIZE_135: { - __mpApp.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthWestSouthEastCursor)]; + oc_appData.osx.cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthWestSouthEastCursor)]; } break; - case MP_MOUSE_CURSOR_TEXT: + case OC_MOUSE_CURSOR_TEXT: { - __mpApp.osx.cursor = [NSCursor IBeamCursor]; + oc_appData.osx.cursor = [NSCursor IBeamCursor]; } break; } - [__mpApp.osx.cursor set]; + [oc_appData.osx.cursor set]; } -void mp_clipboard_clear() +void oc_clipboard_clear() {@autoreleasepool{ NSPasteboard* pb = [NSPasteboard generalPasteboard]; [pb clearContents]; }} -void mp_clipboard_set_string(str8 string) +void oc_clipboard_set_string(oc_str8 string) {@autoreleasepool{ NSString* nsString = [[NSString alloc] initWithBytes:string.ptr length:string.len encoding:NSUTF8StringEncoding]; @@ -1239,33 +1196,33 @@ void mp_clipboard_set_string(str8 string) [pb writeObjects:[[NSArray alloc] initWithObjects:nsString, nil]]; }} -str8 mp_clipboard_copy_string(str8 backing) +oc_str8 oc_clipboard_copy_string(oc_str8 backing) {@autoreleasepool{ //WARN(martin): maxSize includes space for a null terminator NSPasteboard* pb = [NSPasteboard generalPasteboard]; NSString* nsString = [pb stringForType:NSPasteboardTypeString]; const char* cString = [nsString UTF8String]; - u32 len = minimum(backing.len-1, strlen(cString)); //length without null terminator + u32 len = oc_min(backing.len-1, strlen(cString)); //length without null terminator strncpy(backing.ptr, cString, backing.len-1); backing.ptr[len] = '\0'; - str8 result = str8_slice(backing, 0, len); + oc_str8 result = oc_str8_slice(backing, 0, len); return(result); }} -str8 mp_clipboard_get_string(mem_arena* arena) +oc_str8 oc_clipboard_get_string(oc_arena* arena) {@autoreleasepool{ //WARN(martin): maxSize includes space for a null terminator NSPasteboard* pb = [NSPasteboard generalPasteboard]; NSString* nsString = [pb stringForType:NSPasteboardTypeString]; const char* cString = [nsString UTF8String]; - str8 result = str8_push_cstring(arena, cString); + oc_str8 result = oc_str8_push_cstring(arena, cString); return(result); }} -bool mp_clipboard_has_tag(const char* tag) +bool oc_clipboard_has_tag(const char* tag) {@autoreleasepool{ NSString* tagString = [[NSString alloc] initWithUTF8String: tag]; @@ -1277,7 +1234,7 @@ bool mp_clipboard_has_tag(const char* tag) return(available != nil); }} -void mp_clipboard_set_data_for_tag(const char* tag, str8 string) +void oc_clipboard_set_data_for_tag(const char* tag, oc_str8 string) {@autoreleasepool{ NSString* tagString = [[NSString alloc] initWithUTF8String: tag]; @@ -1289,14 +1246,14 @@ void mp_clipboard_set_data_for_tag(const char* tag, str8 string) [pb setData: nsData forType: tagString]; }} -str8 mp_clipboard_get_data_for_tag(mem_arena* arena, const char* tag) +oc_str8 oc_clipboard_get_data_for_tag(oc_arena* arena, const char* tag) {@autoreleasepool{ NSString* tagString = [[NSString alloc] initWithUTF8String: tag]; NSPasteboard* pb = [NSPasteboard generalPasteboard]; NSData* nsData = [pb dataForType: tagString]; - str8 result = str8_push_buffer(arena, [nsData length], (char*)[nsData bytes]); + oc_str8 result = oc_str8_push_buffer(arena, [nsData length], (char*)[nsData bytes]); return(result); }} @@ -1305,20 +1262,20 @@ str8 mp_clipboard_get_data_for_tag(mem_arena* arena, const char* tag) // Window public API //--------------------------------------------------------------- -mp_window mp_window_create(mp_rect contentRect, const char* title, mp_window_style style) +oc_window oc_window_create(oc_rect contentRect, oc_str8 title, oc_window_style style) {@autoreleasepool{ - mp_window_data* window = mp_window_alloc(); + oc_window_data* window = oc_window_alloc(); if(!window) { - log_error("Could not allocate window data\n"); - return((mp_window){0}); + oc_log_error("Could not allocate window data\n"); + return((oc_window){0}); } window->style = style; window->shouldClose = false; window->hidden = true; - u32 styleMask = mp_osx_get_window_style_mask(style); + u32 styleMask = oc_osx_get_window_style_mask(style); NSRect screenRect = [[NSScreen mainScreen] frame]; NSRect rect = NSMakeRect(contentRect.x, @@ -1326,31 +1283,34 @@ mp_window mp_window_create(mp_rect contentRect, const char* title, mp_window_sty contentRect.w, contentRect.h); - window->osx.nsWindow = [[MPNativeWindow alloc] initWithMPWindow: window contentRect:rect styleMask:styleMask]; - window->osx.nsWindowDelegate = [[MPNativeWindowDelegate alloc] initWithMPWindow:window]; + window->osx.nsWindow = [[OCWindow alloc] initWithWindowData: window contentRect:rect styleMask:styleMask]; + window->osx.nsWindowDelegate = [[OCWindowDelegate alloc] initWithWindowData:window]; [window->osx.nsWindow setDelegate:(id)window->osx.nsWindowDelegate]; - [window->osx.nsWindow setTitle:[NSString stringWithUTF8String:title]]; - if(style & MP_WINDOW_STYLE_NO_TITLE) + + + [window->osx.nsWindow setTitle:[[NSString alloc] initWithBytes:(void*)title.ptr length: title.len encoding: NSUTF8StringEncoding]]; + + if(style & OC_WINDOW_STYLE_NO_TITLE) { [window->osx.nsWindow setOpaque:NO]; [window->osx.nsWindow setBackgroundColor:[NSColor clearColor]]; [window->osx.nsWindow setHasShadow:YES]; } - if(style & MP_WINDOW_STYLE_FLOAT) + if(style & OC_WINDOW_STYLE_FLOAT) { [window->osx.nsWindow setLevel:NSFloatingWindowLevel]; [window->osx.nsWindow setHidesOnDeactivate:YES]; } - if(style & MP_WINDOW_STYLE_NO_BUTTONS) + if(style & OC_WINDOW_STYLE_NO_BUTTONS) { [[window->osx.nsWindow standardWindowButton:NSWindowCloseButton] setHidden:YES]; [[window->osx.nsWindow standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES]; [[window->osx.nsWindow standardWindowButton:NSWindowZoomButton] setHidden:YES]; } - MPNativeView* view = [[MPNativeView alloc] initWithMPWindow:window]; + OCView* view = [[OCView alloc] initWithWindowData:window]; [view setCanDrawConcurrently: YES]; [window->osx.nsWindow setContentView:view]; @@ -1358,15 +1318,15 @@ mp_window mp_window_create(mp_rect contentRect, const char* title, mp_window_sty [window->osx.nsWindow setAcceptsMouseMovedEvents:YES]; - mp_window windowHandle = mp_window_handle_from_ptr(window); + oc_window windowHandle = oc_window_handle_from_ptr(window); return(windowHandle); }//autoreleasepool } -void mp_window_destroy(mp_window window) +void oc_window_destroy(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { [windowData->osx.nsWindow orderOut:nil]; @@ -1380,14 +1340,14 @@ void mp_window_destroy(mp_window window) [windowData->osx.nsWindow close]; //also release the window - mp_window_recycle_ptr(windowData); + oc_window_recycle_ptr(windowData); } } // autoreleasepool } -bool mp_window_should_close(mp_window window) +bool oc_window_should_close(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return(windowData->shouldClose); @@ -1398,18 +1358,18 @@ bool mp_window_should_close(mp_window window) } } -void mp_window_cancel_close(mp_window window) +void oc_window_cancel_close(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { windowData->shouldClose = false; } } -void mp_window_request_close(mp_window window) +void oc_window_request_close(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { [windowData->osx.nsWindow close]; @@ -1417,9 +1377,9 @@ void mp_window_request_close(mp_window window) } } -void* mp_window_native_pointer(mp_window window) +void* oc_window_native_pointer(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return((__bridge void*)windowData->osx.nsWindow); @@ -1430,18 +1390,18 @@ void* mp_window_native_pointer(mp_window window) } } -void mp_window_center(mp_window window) +void oc_window_center(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { [windowData->osx.nsWindow center]; } }} -bool mp_window_is_hidden(mp_window window) +bool oc_window_is_hidden(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return(windowData->hidden); @@ -1452,9 +1412,9 @@ bool mp_window_is_hidden(mp_window window) } } -bool mp_window_is_focused(mp_window window) +bool oc_window_is_focused(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return([windowData->osx.nsWindow isKeyWindow]); @@ -1465,9 +1425,9 @@ bool mp_window_is_focused(mp_window window) } }} -void mp_window_hide(mp_window window) +void oc_window_hide(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { windowData->hidden = true; @@ -1475,27 +1435,27 @@ void mp_window_hide(mp_window window) } }} -void mp_window_focus(mp_window window) +void oc_window_focus(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { [windowData->osx.nsWindow makeKeyWindow]; } }} -void mp_window_send_to_back(mp_window window) +void oc_window_send_to_back(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { [windowData->osx.nsWindow orderBack:nil]; } }} -void mp_window_bring_to_front(mp_window window) +void oc_window_bring_to_front(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { windowData->hidden = false; @@ -1503,22 +1463,22 @@ void mp_window_bring_to_front(mp_window window) } }} -void mp_window_bring_to_front_and_focus(mp_window window) +void oc_window_bring_to_front_and_focus(oc_window window) { - mp_window_bring_to_front(window); - mp_window_focus(window); + oc_window_bring_to_front(window); + oc_window_focus(window); } -mp_rect mp_window_get_frame_rect(mp_window window) +oc_rect oc_window_get_frame_rect(oc_window window) { - mp_rect rect = {0}; - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_rect rect = {0}; + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { NSRect frameRect = windowData->osx.nsWindow.frame; NSScreen* screen = windowData->osx.nsWindow.screen; - rect = (mp_rect){ + rect = (oc_rect){ frameRect.origin.x, screen.frame.size.height - frameRect.origin.y - frameRect.size.height, frameRect.size.width, @@ -1528,9 +1488,9 @@ mp_rect mp_window_get_frame_rect(mp_window window) return(rect); } -void mp_window_set_frame_rect(mp_window window, mp_rect rect) +void oc_window_set_frame_rect(oc_window window, oc_rect rect) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { NSScreen* screen = windowData->osx.nsWindow.screen; @@ -1544,16 +1504,16 @@ void mp_window_set_frame_rect(mp_window window, mp_rect rect) } }} -mp_rect mp_window_get_content_rect(mp_window window) +oc_rect oc_window_get_content_rect(oc_window window) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { NSScreen* screen = [windowData->osx.nsWindow screen]; NSView* view = [windowData->osx.nsWindow contentView]; NSRect contentRect = [windowData->osx.nsWindow convertRectToScreen: view.frame]; - mp_rect rect = { + oc_rect rect = { contentRect.origin.x, screen.frame.size.height - contentRect.origin.y - contentRect.size.height, contentRect.size.width, @@ -1563,14 +1523,14 @@ mp_rect mp_window_get_content_rect(mp_window window) } else { - return((mp_rect){}); + return((oc_rect){}); } }} -void mp_window_set_content_rect(mp_window window, mp_rect rect) +void oc_window_set_content_rect(oc_window window, oc_rect rect) {@autoreleasepool{ - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { NSScreen* screen = [windowData->osx.nsWindow screen]; @@ -1590,31 +1550,31 @@ void mp_window_set_content_rect(mp_window window, mp_rect rect) // platform surface //-------------------------------------------------------------------- -void* mg_osx_surface_native_layer(mg_surface_data* surface) +void* oc_osx_surface_native_layer(oc_surface_data* surface) { return((void*)surface->layer.caLayer); } -vec2 mg_osx_surface_contents_scaling(mg_surface_data* surface) +oc_vec2 oc_osx_surface_contents_scaling(oc_surface_data* surface) {@autoreleasepool{ f32 contentsScale = [surface->layer.caLayer contentsScale]; - vec2 res = {contentsScale, contentsScale}; + oc_vec2 res = {contentsScale, contentsScale}; return(res); }} -vec2 mg_osx_surface_get_size(mg_surface_data* surface) +oc_vec2 oc_osx_surface_get_size(oc_surface_data* surface) {@autoreleasepool{ CGRect bounds = surface->layer.caLayer.bounds; - vec2 res = {bounds.size.width, bounds.size.height}; + oc_vec2 res = {bounds.size.width, bounds.size.height}; return(res); }} -bool mg_osx_surface_get_hidden(mg_surface_data* surface) +bool oc_osx_surface_get_hidden(oc_surface_data* surface) {@autoreleasepool{ return([surface->layer.caLayer isHidden]); }} -void mg_osx_surface_set_hidden(mg_surface_data* surface, bool hidden) +void oc_osx_surface_set_hidden(oc_surface_data* surface, bool hidden) {@autoreleasepool{ [CATransaction begin]; [CATransaction setDisableActions:YES]; @@ -1622,18 +1582,18 @@ void mg_osx_surface_set_hidden(mg_surface_data* surface, bool hidden) [CATransaction commit]; }} -void mg_surface_cleanup(mg_surface_data* surface) +void oc_surface_cleanup(oc_surface_data* surface) {@autoreleasepool{ [surface->layer.caLayer release]; }} -void mg_surface_init_for_window(mg_surface_data* surface, mp_window_data* window) +void oc_surface_init_for_window(oc_surface_data* surface, oc_window_data* window) {@autoreleasepool{ - surface->nativeLayer = mg_osx_surface_native_layer; - surface->contentsScaling = mg_osx_surface_contents_scaling; - surface->getSize = mg_osx_surface_get_size; - surface->getHidden = mg_osx_surface_get_hidden; - surface->setHidden = mg_osx_surface_set_hidden; + surface->nativeLayer = oc_osx_surface_native_layer; + surface->contentsScaling = oc_osx_surface_contents_scaling; + surface->getSize = oc_osx_surface_get_size; + surface->getHidden = oc_osx_surface_get_hidden; + surface->setHidden = oc_osx_surface_set_hidden; surface->layer.caLayer = [[CALayer alloc] init]; [surface->layer.caLayer retain]; @@ -1651,28 +1611,28 @@ void mg_surface_init_for_window(mg_surface_data* surface, mp_window_data* window //------------------------------------------------------------------------------------------------ // Remote surfaces //------------------------------------------------------------------------------------------------ -mg_surface_id mg_osx_surface_remote_id(mg_surface_data* surface) +oc_surface_id oc_osx_surface_remote_id(oc_surface_data* surface) { - mg_surface_id remoteID = 0; + oc_surface_id remoteID = 0; if(surface->layer.caContext) { @autoreleasepool { - remoteID = (mg_surface_id)[surface->layer.caContext contextId]; + remoteID = (oc_surface_id)[surface->layer.caContext contextId]; } } return(remoteID); } -void mg_surface_init_remote(mg_surface_data* surface, u32 width, u32 height) +void oc_surface_init_remote(oc_surface_data* surface, u32 width, u32 height) {@autoreleasepool{ - surface->nativeLayer = mg_osx_surface_native_layer; - surface->contentsScaling = mg_osx_surface_contents_scaling; - surface->getSize = mg_osx_surface_get_size; - surface->getHidden = mg_osx_surface_get_hidden; - surface->setHidden = mg_osx_surface_set_hidden; - surface->remoteID = mg_osx_surface_remote_id; + surface->nativeLayer = oc_osx_surface_native_layer; + surface->contentsScaling = oc_osx_surface_contents_scaling; + surface->getSize = oc_osx_surface_get_size; + surface->getHidden = oc_osx_surface_get_hidden; + surface->setHidden = oc_osx_surface_set_hidden; + surface->remoteID = oc_osx_surface_remote_id; surface->layer.caLayer = [[CALayer alloc] init]; [surface->layer.caLayer retain]; @@ -1685,21 +1645,21 @@ void mg_surface_init_remote(mg_surface_data* surface, u32 width, u32 height) [surface->layer.caContext setLayer:surface->layer.caLayer]; }} -void mg_osx_surface_host_connect(mg_surface_data* surface, mg_surface_id remoteID) +void oc_osx_surface_host_connect(oc_surface_data* surface, oc_surface_id remoteID) {@autoreleasepool{ [(CALayerHost*)surface->layer.caLayer setContextId: (CAContextID)remoteID]; }} -void mg_surface_init_host(mg_surface_data* surface, mp_window_data* window) +void oc_surface_init_host(oc_surface_data* surface, oc_window_data* window) {@autoreleasepool{ - surface->api = MG_HOST; - surface->nativeLayer = mg_osx_surface_native_layer; - surface->contentsScaling = mg_osx_surface_contents_scaling; - surface->getSize = mg_osx_surface_get_size; - surface->getHidden = mg_osx_surface_get_hidden; - surface->setHidden = mg_osx_surface_set_hidden; - surface->hostConnect = mg_osx_surface_host_connect; + surface->api = OC_HOST; + surface->nativeLayer = oc_osx_surface_native_layer; + surface->contentsScaling = oc_osx_surface_contents_scaling; + surface->getSize = oc_osx_surface_get_size; + surface->getHidden = oc_osx_surface_get_hidden; + surface->setHidden = oc_osx_surface_set_hidden; + surface->hostConnect = oc_osx_surface_host_connect; surface->layer.caLayer = [[CALayerHost alloc] init]; [surface->layer.caLayer retain]; @@ -1711,16 +1671,16 @@ void mg_surface_init_host(mg_surface_data* surface, mp_window_data* window) [window->osx.nsView.layer addSublayer: surface->layer.caLayer]; }} -mg_surface_data* mg_osx_surface_create_host(mp_window windowHandle) +oc_surface_data* oc_osx_surface_create_host(oc_window windowHandle) { - mg_surface_data* surface = 0; - mp_window_data* window = mp_window_ptr_from_handle(windowHandle); + oc_surface_data* surface = 0; + oc_window_data* window = oc_window_ptr_from_handle(windowHandle); if(window) { - surface = malloc_type(mg_surface_data); + surface = oc_malloc_type(oc_surface_data); if(surface) { - mg_surface_init_host(surface, window); + oc_surface_init_host(surface, window); } } return(surface); @@ -1730,20 +1690,20 @@ mg_surface_data* mg_osx_surface_create_host(mp_window windowHandle) // view management //-------------------------------------------------------------------- /* -mp_view mp_view_create(mp_window windowHandle, mp_rect frame) +oc_view oc_view_create(oc_window windowHandle, oc_rect frame) {@autoreleasepool{ - mp_window_data* window = mp_window_ptr_from_handle(windowHandle); + oc_window_data* window = oc_window_ptr_from_handle(windowHandle); if(!window) { - log_error("Can't create view for nil window\n"); - return(mp_view_nil()); + oc_log_error("Can't create view for nil window\n"); + return(oc_view_nil()); } - mp_view_data* view = mp_view_alloc(); + oc_view_data* view = oc_view_alloc(); if(!view) { - log_error("Could not allocate view data\n"); - return(mp_view_nil()); + oc_log_error("Could not allocate view data\n"); + return(oc_view_nil()); } view->window = windowHandle; @@ -1754,18 +1714,18 @@ mp_view mp_view_create(mp_window windowHandle, mp_rect frame) [[window->osx.nsWindow contentView] addSubview: view->nsView]; - return(mp_view_handle_from_ptr(view)); + return(oc_view_handle_from_ptr(view)); }} -void mp_view_destroy(mp_view viewHandle) +void oc_view_destroy(oc_view viewHandle) {@autoreleasepool{ - mp_view_data* view = mp_view_ptr_from_handle(viewHandle); + oc_view_data* view = oc_view_ptr_from_handle(viewHandle); if(!view) { return; } - mp_window_data* window = mp_window_ptr_from_handle(view->window); + oc_window_data* window = oc_window_ptr_from_handle(view->window); if(!window) { return; @@ -1773,12 +1733,12 @@ void mp_view_destroy(mp_view viewHandle) [view->nsView removeFromSuperview]; - mp_view_recycle_ptr(view); + oc_view_recycle_ptr(view); }} -void mp_view_set_frame(mp_view viewHandle, mp_rect frame) +void oc_view_set_frame(oc_view viewHandle, oc_rect frame) { - mp_view_data* view = mp_view_ptr_from_handle(viewHandle); + oc_view_data* view = oc_view_ptr_from_handle(viewHandle); if(!view) { return; @@ -1787,9 +1747,9 @@ void mp_view_set_frame(mp_view viewHandle, mp_rect frame) NSRect nsFrame = {{frame.x, frame.y}, {frame.w, frame.h}}; [view->nsView setFrame: nsFrame]; - if(!mg_surface_is_nil(view->surface)) + if(!oc_surface_is_nil(view->surface)) { - mg_surface_resize(view->surface, frame.w, frame.h); + oc_surface_resize(view->surface, frame.w, frame.h); } } */ @@ -1797,50 +1757,50 @@ void mp_view_set_frame(mp_view viewHandle, mp_rect frame) // Main loop throttle //-------------------------------------------------------------------- -void mp_set_target_fps(u32 fps) +void oc_set_target_fps(u32 fps) { - __mpApp.frameStats.targetFramePeriod = 1./(f64)fps; - __mpApp.frameStats.workTime = 0; - __mpApp.frameStats.remainingTime = 0; + oc_appData.frameStats.targetFramePeriod = 1./(f64)fps; + oc_appData.frameStats.workTime = 0; + oc_appData.frameStats.remainingTime = 0; - if(__mpApp.osx.frameTimer) + if(oc_appData.osx.frameTimer) { - [__mpApp.osx.frameTimer invalidate]; + [oc_appData.osx.frameTimer invalidate]; } - __mpApp.osx.frameTimer = [NSTimer timerWithTimeInterval: __mpApp.frameStats.targetFramePeriod + oc_appData.osx.frameTimer = [NSTimer timerWithTimeInterval: oc_appData.frameStats.targetFramePeriod target: [NSApp delegate] selector:@selector(timerElapsed:) userInfo:nil repeats:YES]; - [[NSRunLoop currentRunLoop] addTimer:__mpApp.osx.frameTimer forMode:NSRunLoopCommonModes]; + [[NSRunLoop currentRunLoop] addTimer:oc_appData.osx.frameTimer forMode:NSRunLoopCommonModes]; } /* -void mp_begin_frame() +void oc_begin_frame() { - __mpApp.frameStats.start = mp_get_elapsed_seconds(); + oc_appData.frameStats.start = oc_get_elapsed_seconds(); LOG_DEBUG("workTime = %.6f (%.6f fps), remaining = %.6f\n", - __mpApp.frameStats.workTime, - 1/__mpApp.frameStats.workTime, - __mpApp.frameStats.remainingTime); + oc_appData.frameStats.workTime, + 1/oc_appData.frameStats.workTime, + oc_appData.frameStats.remainingTime); } -void mp_end_frame() +void oc_end_frame() { - __mpApp.frameStats.workTime = mp_get_elapsed_seconds() - __mpApp.frameStats.start; - __mpApp.frameStats.remainingTime = __mpApp.frameStats.targetFramePeriod - __mpApp.frameStats.workTime; + oc_appData.frameStats.workTime = oc_get_elapsed_seconds() - oc_appData.frameStats.start; + oc_appData.frameStats.remainingTime = oc_appData.frameStats.targetFramePeriod - oc_appData.frameStats.workTime; - while(__mpApp.frameStats.remainingTime > 100e-9) + while(oc_appData.frameStats.remainingTime > 100e-9) { - if(__mpApp.frameStats.remainingTime > 10e-6) + if(oc_appData.frameStats.remainingTime > 10e-6) { - mp_sleep_nanoseconds(__mpApp.frameStats.remainingTime*0.8*1e9); + oc_sleep_nano(oc_appData.frameStats.remainingTime*0.8*1e9); } - __mpApp.frameStats.workTime = mp_get_elapsed_seconds() - __mpApp.frameStats.start; - __mpApp.frameStats.remainingTime = __mpApp.frameStats.targetFramePeriod - __mpApp.frameStats.workTime; + oc_appData.frameStats.workTime = oc_get_elapsed_seconds() - oc_appData.frameStats.start; + oc_appData.frameStats.remainingTime = oc_appData.frameStats.targetFramePeriod - oc_appData.frameStats.workTime; } } */ @@ -1849,14 +1809,14 @@ void mp_end_frame() // Events handling //-------------------------------------------------------------------- -void mp_set_live_resize_callback(mp_live_resize_callback callback, void* data) +void oc_set_live_resize_callback(oc_live_resize_callback callback, void* data) { - __mpApp.liveResizeCallback = callback; - __mpApp.liveResizeData = data; + oc_appData.liveResizeCallback = callback; + oc_appData.liveResizeData = data; } -void mp_pump_events(f64 timeout) +void oc_pump_events(f64 timeout) { @autoreleasepool { @@ -1900,7 +1860,7 @@ void mp_pump_events(f64 timeout) } } -i32 mp_dispatch_on_main_thread_sync(mp_window main_window, mp_dispatch_proc proc, void* user) +i32 oc_dispatch_on_main_thread_sync(oc_window main_window, oc_dispatch_proc proc, void* user) { __block i32 result = 0; dispatch_block_t block = ^{ @@ -1923,12 +1883,11 @@ i32 mp_dispatch_on_main_thread_sync(mp_window main_window, mp_dispatch_proc proc // system dialogs windows //-------------------------------------------------------------------- -str8 mp_open_dialog(mem_arena* arena, - const char* title, - const char* defaultPath, - int filterCount, - const char** filters, - bool directory) +oc_str8 oc_open_dialog(oc_arena* arena, + oc_str8 title, + oc_str8 defaultPath, + oc_str8_list filters, + bool directory) { @autoreleasepool { @@ -1937,13 +1896,15 @@ str8 mp_open_dialog(mem_arena* arena, NSOpenPanel* dialog = [NSOpenPanel openPanel] ; [dialog setLevel:CGShieldingWindowLevel()]; - if(filterCount) + if(filters.eltCount) { NSMutableArray * fileTypesArray = [NSMutableArray array]; - for(int i=0; i < filterCount; i++) - { - NSString * filt = [NSString stringWithUTF8String:filters[i]]; - [fileTypesArray addObject:filt]; + + oc_list_for(&filters.list, elt, oc_str8_elt, listElt) + { + oc_str8 string = elt->string; + NSString * filter = [[NSString alloc] initWithBytes:string.ptr length:string.len encoding:NSUTF8StringEncoding]; + [fileTypesArray addObject:filter]; } [dialog setAllowedFileTypes:fileTypesArray]; } @@ -1959,7 +1920,18 @@ str8 mp_open_dialog(mem_arena* arena, [dialog setAllowsMultipleSelection:FALSE]; - NSString* nsPath = [[NSString stringWithUTF8String:defaultPath?defaultPath:"~"] stringByExpandingTildeInPath]; + + NSString* nsPath = 0;; + if(defaultPath.len) + { + nsPath = [[NSString alloc] initWithBytes: defaultPath.ptr length: defaultPath.len encoding: NSUTF8StringEncoding]; + } + else + { + nsPath = [NSString stringWithUTF8String: "~"]; + } + nsPath = [nsPath stringByExpandingTildeInPath]; + [dialog setDirectoryURL:[NSURL fileURLWithPath:nsPath]]; // Display the dialog box. If the OK pressed, @@ -1973,7 +1945,7 @@ str8 mp_open_dialog(mem_arena* arena, const char* result = [[[files objectAtIndex:0] path] UTF8String]; - str8 path = str8_push_cstring(arena, result); + oc_str8 path = oc_str8_push_cstring(arena, result); [keyWindow makeKeyWindow]; return(path); @@ -1981,17 +1953,15 @@ str8 mp_open_dialog(mem_arena* arena, else { [keyWindow makeKeyWindow]; - return((str8){0, 0}); + return((oc_str8){0, 0}); } } } - -str8 mp_save_dialog(mem_arena* arena, - const char* title, - const char* defaultPath, - int filterCount, - const char** filters) +oc_str8 oc_save_dialog(oc_arena* arena, + oc_str8 title, + oc_str8 defaultPath, + oc_str8_list filters) { @autoreleasepool { @@ -2000,19 +1970,30 @@ str8 mp_save_dialog(mem_arena* arena, NSSavePanel* dialog = [NSSavePanel savePanel] ; [dialog setLevel:CGShieldingWindowLevel()]; - if(filterCount) + if(filters.eltCount) { - NSMutableArray * fileTypesArray = [NSMutableArray array]; - for(int i=0; i < filterCount; i++) - { - NSString * filt = [NSString stringWithUTF8String:filters[i]]; - [fileTypesArray addObject:filt]; - } + NSMutableArray * fileTypesArray = [NSMutableArray array]; - // Enable options in the dialog. + oc_list_for(&filters.list, elt, oc_str8_elt, listElt) + { + oc_str8 string = elt->string; + NSString * filter = [[NSString alloc] initWithBytes:string.ptr length:string.len encoding:NSUTF8StringEncoding]; + [fileTypesArray addObject:filter]; + } [dialog setAllowedFileTypes:fileTypesArray]; } - NSString* nsPath = [[NSString stringWithUTF8String:defaultPath?defaultPath:"~"] stringByExpandingTildeInPath]; + + NSString* nsPath = 0;; + if(defaultPath.len) + { + nsPath = [[NSString alloc] initWithBytes: defaultPath.ptr length: defaultPath.len encoding: NSUTF8StringEncoding]; + } + else + { + nsPath = [NSString stringWithUTF8String: "~"]; + } + nsPath = [nsPath stringByExpandingTildeInPath]; + [dialog setDirectoryURL:[NSURL fileURLWithPath:nsPath]]; // Display the dialog box. If the OK pressed, @@ -2026,22 +2007,21 @@ str8 mp_save_dialog(mem_arena* arena, const char* result = [[files path] UTF8String]; - str8 path = str8_push_cstring(arena, result); + oc_str8 path = oc_str8_push_cstring(arena, result); [keyWindow makeKeyWindow]; return(path); } else { [keyWindow makeKeyWindow]; - return((str8){0, 0}); + return((oc_str8){0, 0}); } } } -int mp_alert_popup(const char* title, - const char* message, - uint32 count, - const char** options) +int oc_alert_popup(oc_str8 title, + oc_str8 message, + oc_str8_list options) { __block int result = 0; @@ -2052,22 +2032,23 @@ int mp_alert_popup(const char* title, NSAlert* alert = [[NSAlert alloc] init]; NSString* string; - for(int i=count-1;i>=0;i--) + + oc_list_for_reverse((oc_list*)&options.list, elt, oc_str8_elt, listElt) { - string = [[NSString alloc] initWithUTF8String:options[i]]; + string = [[NSString alloc] initWithBytes:elt->string.ptr length:elt->string.len encoding: NSUTF8StringEncoding]; [alert addButtonWithTitle:string]; [string release]; } - string = [[NSString alloc] initWithUTF8String:title]; + string = [[NSString alloc] initWithBytes:title.ptr length:title.len encoding: NSUTF8StringEncoding]; [alert setMessageText:string]; [string release]; - string = [[NSString alloc] initWithUTF8String:message]; + string = [[NSString alloc] initWithBytes: message.ptr length: message.len encoding: NSUTF8StringEncoding]; [alert setInformativeText:string]; [string release]; [alert setAlertStyle:NSAlertStyleWarning]; - result = count - ([alert runModal]-NSAlertFirstButtonReturn) - 1; + result = options.eltCount - ([alert runModal]-NSAlertFirstButtonReturn) - 1; [keyWindow makeKeyWindow]; } }; @@ -2088,7 +2069,7 @@ int mp_alert_popup(const char* title, // file system stuff... //TODO: move elsewhere //-------------------------------------------------------------------- -int mp_file_move(str8 from, str8 to) +int oc_file_move(oc_str8 from, oc_str8 to) {@autoreleasepool{ NSString* nsFrom = [[NSString alloc] initWithBytes:from.ptr length:from.len encoding: NSUTF8StringEncoding]; NSString* nsTo = [[NSString alloc] initWithBytes:to.ptr length:to.len encoding: NSUTF8StringEncoding]; @@ -2103,7 +2084,7 @@ int mp_file_move(str8 from, str8 to) } }} -int mp_file_remove(str8 path) +int oc_file_remove(oc_str8 path) {@autoreleasepool{ NSString* nsPath = [[NSString alloc] initWithBytes:path.ptr length:path.len encoding: NSUTF8StringEncoding]; NSError* err; @@ -2117,7 +2098,7 @@ int mp_file_remove(str8 path) } }} -int mp_directory_create(str8 path) +int oc_directory_create(oc_str8 path) {@autoreleasepool{ NSString* nsPath = [[NSString alloc] initWithBytes:path.ptr length:path.len encoding: NSUTF8StringEncoding]; diff --git a/src/app/win32_app.c b/src/app/win32_app.c index 5ba5f96..dd4d962 100644 --- a/src/app/win32_app.c +++ b/src/app/win32_app.c @@ -8,153 +8,153 @@ *****************************************************************/ #include -#include"mp_app.c" +#include"app.c" #include"platform/platform_thread.h" -void mp_init_keys() +void oc_init_keys() { - memset(__mpApp.keyCodes, MP_KEY_UNKNOWN, 256*sizeof(int)); + memset(oc_appData.keyCodes, OC_KEY_UNKNOWN, 256*sizeof(int)); - __mpApp.keyCodes[0x00B] = MP_KEY_0; - __mpApp.keyCodes[0x002] = MP_KEY_1; - __mpApp.keyCodes[0x003] = MP_KEY_2; - __mpApp.keyCodes[0x004] = MP_KEY_3; - __mpApp.keyCodes[0x005] = MP_KEY_4; - __mpApp.keyCodes[0x006] = MP_KEY_5; - __mpApp.keyCodes[0x007] = MP_KEY_6; - __mpApp.keyCodes[0x008] = MP_KEY_7; - __mpApp.keyCodes[0x009] = MP_KEY_8; - __mpApp.keyCodes[0x00A] = MP_KEY_9; - __mpApp.keyCodes[0x01E] = MP_KEY_A; - __mpApp.keyCodes[0x030] = MP_KEY_B; - __mpApp.keyCodes[0x02E] = MP_KEY_C; - __mpApp.keyCodes[0x020] = MP_KEY_D; - __mpApp.keyCodes[0x012] = MP_KEY_E; - __mpApp.keyCodes[0x021] = MP_KEY_F; - __mpApp.keyCodes[0x022] = MP_KEY_G; - __mpApp.keyCodes[0x023] = MP_KEY_H; - __mpApp.keyCodes[0x017] = MP_KEY_I; - __mpApp.keyCodes[0x024] = MP_KEY_J; - __mpApp.keyCodes[0x025] = MP_KEY_K; - __mpApp.keyCodes[0x026] = MP_KEY_L; - __mpApp.keyCodes[0x032] = MP_KEY_M; - __mpApp.keyCodes[0x031] = MP_KEY_N; - __mpApp.keyCodes[0x018] = MP_KEY_O; - __mpApp.keyCodes[0x019] = MP_KEY_P; - __mpApp.keyCodes[0x010] = MP_KEY_Q; - __mpApp.keyCodes[0x013] = MP_KEY_R; - __mpApp.keyCodes[0x01F] = MP_KEY_S; - __mpApp.keyCodes[0x014] = MP_KEY_T; - __mpApp.keyCodes[0x016] = MP_KEY_U; - __mpApp.keyCodes[0x02F] = MP_KEY_V; - __mpApp.keyCodes[0x011] = MP_KEY_W; - __mpApp.keyCodes[0x02D] = MP_KEY_X; - __mpApp.keyCodes[0x015] = MP_KEY_Y; - __mpApp.keyCodes[0x02C] = MP_KEY_Z; - __mpApp.keyCodes[0x028] = MP_KEY_APOSTROPHE; - __mpApp.keyCodes[0x02B] = MP_KEY_BACKSLASH; - __mpApp.keyCodes[0x033] = MP_KEY_COMMA; - __mpApp.keyCodes[0x00D] = MP_KEY_EQUAL; - __mpApp.keyCodes[0x029] = MP_KEY_GRAVE_ACCENT; - __mpApp.keyCodes[0x01A] = MP_KEY_LEFT_BRACKET; - __mpApp.keyCodes[0x00C] = MP_KEY_MINUS; - __mpApp.keyCodes[0x034] = MP_KEY_PERIOD; - __mpApp.keyCodes[0x01B] = MP_KEY_RIGHT_BRACKET; - __mpApp.keyCodes[0x027] = MP_KEY_SEMICOLON; - __mpApp.keyCodes[0x035] = MP_KEY_SLASH; - __mpApp.keyCodes[0x056] = MP_KEY_WORLD_2; - __mpApp.keyCodes[0x00E] = MP_KEY_BACKSPACE; - __mpApp.keyCodes[0x153] = MP_KEY_DELETE; - __mpApp.keyCodes[0x14F] = MP_KEY_END; - __mpApp.keyCodes[0x01C] = MP_KEY_ENTER; - __mpApp.keyCodes[0x001] = MP_KEY_ESCAPE; - __mpApp.keyCodes[0x147] = MP_KEY_HOME; - __mpApp.keyCodes[0x152] = MP_KEY_INSERT; - __mpApp.keyCodes[0x15D] = MP_KEY_MENU; - __mpApp.keyCodes[0x151] = MP_KEY_PAGE_DOWN; - __mpApp.keyCodes[0x149] = MP_KEY_PAGE_UP; - __mpApp.keyCodes[0x045] = MP_KEY_PAUSE; - __mpApp.keyCodes[0x146] = MP_KEY_PAUSE; - __mpApp.keyCodes[0x039] = MP_KEY_SPACE; - __mpApp.keyCodes[0x00F] = MP_KEY_TAB; - __mpApp.keyCodes[0x03A] = MP_KEY_CAPS_LOCK; - __mpApp.keyCodes[0x145] = MP_KEY_NUM_LOCK; - __mpApp.keyCodes[0x046] = MP_KEY_SCROLL_LOCK; - __mpApp.keyCodes[0x03B] = MP_KEY_F1; - __mpApp.keyCodes[0x03C] = MP_KEY_F2; - __mpApp.keyCodes[0x03D] = MP_KEY_F3; - __mpApp.keyCodes[0x03E] = MP_KEY_F4; - __mpApp.keyCodes[0x03F] = MP_KEY_F5; - __mpApp.keyCodes[0x040] = MP_KEY_F6; - __mpApp.keyCodes[0x041] = MP_KEY_F7; - __mpApp.keyCodes[0x042] = MP_KEY_F8; - __mpApp.keyCodes[0x043] = MP_KEY_F9; - __mpApp.keyCodes[0x044] = MP_KEY_F10; - __mpApp.keyCodes[0x057] = MP_KEY_F11; - __mpApp.keyCodes[0x058] = MP_KEY_F12; - __mpApp.keyCodes[0x064] = MP_KEY_F13; - __mpApp.keyCodes[0x065] = MP_KEY_F14; - __mpApp.keyCodes[0x066] = MP_KEY_F15; - __mpApp.keyCodes[0x067] = MP_KEY_F16; - __mpApp.keyCodes[0x068] = MP_KEY_F17; - __mpApp.keyCodes[0x069] = MP_KEY_F18; - __mpApp.keyCodes[0x06A] = MP_KEY_F19; - __mpApp.keyCodes[0x06B] = MP_KEY_F20; - __mpApp.keyCodes[0x06C] = MP_KEY_F21; - __mpApp.keyCodes[0x06D] = MP_KEY_F22; - __mpApp.keyCodes[0x06E] = MP_KEY_F23; - __mpApp.keyCodes[0x076] = MP_KEY_F24; - __mpApp.keyCodes[0x038] = MP_KEY_LEFT_ALT; - __mpApp.keyCodes[0x01D] = MP_KEY_LEFT_CONTROL; - __mpApp.keyCodes[0x02A] = MP_KEY_LEFT_SHIFT; - __mpApp.keyCodes[0x15B] = MP_KEY_LEFT_SUPER; - __mpApp.keyCodes[0x137] = MP_KEY_PRINT_SCREEN; - __mpApp.keyCodes[0x138] = MP_KEY_RIGHT_ALT; - __mpApp.keyCodes[0x11D] = MP_KEY_RIGHT_CONTROL; - __mpApp.keyCodes[0x036] = MP_KEY_RIGHT_SHIFT; - __mpApp.keyCodes[0x15C] = MP_KEY_RIGHT_SUPER; - __mpApp.keyCodes[0x150] = MP_KEY_DOWN; - __mpApp.keyCodes[0x14B] = MP_KEY_LEFT; - __mpApp.keyCodes[0x14D] = MP_KEY_RIGHT; - __mpApp.keyCodes[0x148] = MP_KEY_UP; - __mpApp.keyCodes[0x052] = MP_KEY_KP_0; - __mpApp.keyCodes[0x04F] = MP_KEY_KP_1; - __mpApp.keyCodes[0x050] = MP_KEY_KP_2; - __mpApp.keyCodes[0x051] = MP_KEY_KP_3; - __mpApp.keyCodes[0x04B] = MP_KEY_KP_4; - __mpApp.keyCodes[0x04C] = MP_KEY_KP_5; - __mpApp.keyCodes[0x04D] = MP_KEY_KP_6; - __mpApp.keyCodes[0x047] = MP_KEY_KP_7; - __mpApp.keyCodes[0x048] = MP_KEY_KP_8; - __mpApp.keyCodes[0x049] = MP_KEY_KP_9; - __mpApp.keyCodes[0x04E] = MP_KEY_KP_ADD; - __mpApp.keyCodes[0x053] = MP_KEY_KP_DECIMAL; - __mpApp.keyCodes[0x135] = MP_KEY_KP_DIVIDE; - __mpApp.keyCodes[0x11C] = MP_KEY_KP_ENTER; - __mpApp.keyCodes[0x037] = MP_KEY_KP_MULTIPLY; - __mpApp.keyCodes[0x04A] = MP_KEY_KP_SUBTRACT; + oc_appData.keyCodes[0x00B] = OC_KEY_0; + oc_appData.keyCodes[0x002] = OC_KEY_1; + oc_appData.keyCodes[0x003] = OC_KEY_2; + oc_appData.keyCodes[0x004] = OC_KEY_3; + oc_appData.keyCodes[0x005] = OC_KEY_4; + oc_appData.keyCodes[0x006] = OC_KEY_5; + oc_appData.keyCodes[0x007] = OC_KEY_6; + oc_appData.keyCodes[0x008] = OC_KEY_7; + oc_appData.keyCodes[0x009] = OC_KEY_8; + oc_appData.keyCodes[0x00A] = OC_KEY_9; + oc_appData.keyCodes[0x01E] = OC_KEY_A; + oc_appData.keyCodes[0x030] = OC_KEY_B; + oc_appData.keyCodes[0x02E] = OC_KEY_C; + oc_appData.keyCodes[0x020] = OC_KEY_D; + oc_appData.keyCodes[0x012] = OC_KEY_E; + oc_appData.keyCodes[0x021] = OC_KEY_F; + oc_appData.keyCodes[0x022] = OC_KEY_G; + oc_appData.keyCodes[0x023] = OC_KEY_H; + oc_appData.keyCodes[0x017] = OC_KEY_I; + oc_appData.keyCodes[0x024] = OC_KEY_J; + oc_appData.keyCodes[0x025] = OC_KEY_K; + oc_appData.keyCodes[0x026] = OC_KEY_L; + oc_appData.keyCodes[0x032] = OC_KEY_M; + oc_appData.keyCodes[0x031] = OC_KEY_N; + oc_appData.keyCodes[0x018] = OC_KEY_O; + oc_appData.keyCodes[0x019] = OC_KEY_P; + oc_appData.keyCodes[0x010] = OC_KEY_Q; + oc_appData.keyCodes[0x013] = OC_KEY_R; + oc_appData.keyCodes[0x01F] = OC_KEY_S; + oc_appData.keyCodes[0x014] = OC_KEY_T; + oc_appData.keyCodes[0x016] = OC_KEY_U; + oc_appData.keyCodes[0x02F] = OC_KEY_V; + oc_appData.keyCodes[0x011] = OC_KEY_W; + oc_appData.keyCodes[0x02D] = OC_KEY_X; + oc_appData.keyCodes[0x015] = OC_KEY_Y; + oc_appData.keyCodes[0x02C] = OC_KEY_Z; + oc_appData.keyCodes[0x028] = OC_KEY_APOSTROPHE; + oc_appData.keyCodes[0x02B] = OC_KEY_BACKSLASH; + oc_appData.keyCodes[0x033] = OC_KEY_COMMA; + oc_appData.keyCodes[0x00D] = OC_KEY_EQUAL; + oc_appData.keyCodes[0x029] = OC_KEY_GRAVE_ACCENT; + oc_appData.keyCodes[0x01A] = OC_KEY_LEFT_BRACKET; + oc_appData.keyCodes[0x00C] = OC_KEY_MINUS; + oc_appData.keyCodes[0x034] = OC_KEY_PERIOD; + oc_appData.keyCodes[0x01B] = OC_KEY_RIGHT_BRACKET; + oc_appData.keyCodes[0x027] = OC_KEY_SEMICOLON; + oc_appData.keyCodes[0x035] = OC_KEY_SLASH; + oc_appData.keyCodes[0x056] = OC_KEY_WORLD_2; + oc_appData.keyCodes[0x00E] = OC_KEY_BACKSPACE; + oc_appData.keyCodes[0x153] = OC_KEY_DELETE; + oc_appData.keyCodes[0x14F] = OC_KEY_END; + oc_appData.keyCodes[0x01C] = OC_KEY_ENTER; + oc_appData.keyCodes[0x001] = OC_KEY_ESCAPE; + oc_appData.keyCodes[0x147] = OC_KEY_HOME; + oc_appData.keyCodes[0x152] = OC_KEY_INSERT; + oc_appData.keyCodes[0x15D] = OC_KEY_MENU; + oc_appData.keyCodes[0x151] = OC_KEY_PAGE_DOWN; + oc_appData.keyCodes[0x149] = OC_KEY_PAGE_UP; + oc_appData.keyCodes[0x045] = OC_KEY_PAUSE; + oc_appData.keyCodes[0x146] = OC_KEY_PAUSE; + oc_appData.keyCodes[0x039] = OC_KEY_SPACE; + oc_appData.keyCodes[0x00F] = OC_KEY_TAB; + oc_appData.keyCodes[0x03A] = OC_KEY_CAPS_LOCK; + oc_appData.keyCodes[0x145] = OC_KEY_NUM_LOCK; + oc_appData.keyCodes[0x046] = OC_KEY_SCROLL_LOCK; + oc_appData.keyCodes[0x03B] = OC_KEY_F1; + oc_appData.keyCodes[0x03C] = OC_KEY_F2; + oc_appData.keyCodes[0x03D] = OC_KEY_F3; + oc_appData.keyCodes[0x03E] = OC_KEY_F4; + oc_appData.keyCodes[0x03F] = OC_KEY_F5; + oc_appData.keyCodes[0x040] = OC_KEY_F6; + oc_appData.keyCodes[0x041] = OC_KEY_F7; + oc_appData.keyCodes[0x042] = OC_KEY_F8; + oc_appData.keyCodes[0x043] = OC_KEY_F9; + oc_appData.keyCodes[0x044] = OC_KEY_F10; + oc_appData.keyCodes[0x057] = OC_KEY_F11; + oc_appData.keyCodes[0x058] = OC_KEY_F12; + oc_appData.keyCodes[0x064] = OC_KEY_F13; + oc_appData.keyCodes[0x065] = OC_KEY_F14; + oc_appData.keyCodes[0x066] = OC_KEY_F15; + oc_appData.keyCodes[0x067] = OC_KEY_F16; + oc_appData.keyCodes[0x068] = OC_KEY_F17; + oc_appData.keyCodes[0x069] = OC_KEY_F18; + oc_appData.keyCodes[0x06A] = OC_KEY_F19; + oc_appData.keyCodes[0x06B] = OC_KEY_F20; + oc_appData.keyCodes[0x06C] = OC_KEY_F21; + oc_appData.keyCodes[0x06D] = OC_KEY_F22; + oc_appData.keyCodes[0x06E] = OC_KEY_F23; + oc_appData.keyCodes[0x076] = OC_KEY_F24; + oc_appData.keyCodes[0x038] = OC_KEY_LEFT_ALT; + oc_appData.keyCodes[0x01D] = OC_KEY_LEFT_CONTROL; + oc_appData.keyCodes[0x02A] = OC_KEY_LEFT_SHIFT; + oc_appData.keyCodes[0x15B] = OC_KEY_LEFT_SUPER; + oc_appData.keyCodes[0x137] = OC_KEY_PRINT_SCREEN; + oc_appData.keyCodes[0x138] = OC_KEY_RIGHT_ALT; + oc_appData.keyCodes[0x11D] = OC_KEY_RIGHT_CONTROL; + oc_appData.keyCodes[0x036] = OC_KEY_RIGHT_SHIFT; + oc_appData.keyCodes[0x15C] = OC_KEY_RIGHT_SUPER; + oc_appData.keyCodes[0x150] = OC_KEY_DOWN; + oc_appData.keyCodes[0x14B] = OC_KEY_LEFT; + oc_appData.keyCodes[0x14D] = OC_KEY_RIGHT; + oc_appData.keyCodes[0x148] = OC_KEY_UP; + oc_appData.keyCodes[0x052] = OC_KEY_KP_0; + oc_appData.keyCodes[0x04F] = OC_KEY_KP_1; + oc_appData.keyCodes[0x050] = OC_KEY_KP_2; + oc_appData.keyCodes[0x051] = OC_KEY_KP_3; + oc_appData.keyCodes[0x04B] = OC_KEY_KP_4; + oc_appData.keyCodes[0x04C] = OC_KEY_KP_5; + oc_appData.keyCodes[0x04D] = OC_KEY_KP_6; + oc_appData.keyCodes[0x047] = OC_KEY_KP_7; + oc_appData.keyCodes[0x048] = OC_KEY_KP_8; + oc_appData.keyCodes[0x049] = OC_KEY_KP_9; + oc_appData.keyCodes[0x04E] = OC_KEY_KP_ADD; + oc_appData.keyCodes[0x053] = OC_KEY_KP_DECIMAL; + oc_appData.keyCodes[0x135] = OC_KEY_KP_DIVIDE; + oc_appData.keyCodes[0x11C] = OC_KEY_KP_ENTER; + oc_appData.keyCodes[0x037] = OC_KEY_KP_MULTIPLY; + oc_appData.keyCodes[0x04A] = OC_KEY_KP_SUBTRACT; - memset(__mpApp.nativeKeys, 0, sizeof(int)*MP_KEY_COUNT); + memset(oc_appData.nativeKeys, 0, sizeof(int)*OC_KEY_COUNT); for(int nativeKey=0; nativeKey<256; nativeKey++) { - mp_key_code mpKey = __mpApp.keyCodes[nativeKey]; + oc_key_code mpKey = oc_appData.keyCodes[nativeKey]; if(mpKey) { - __mpApp.nativeKeys[mpKey] = nativeKey; + oc_appData.nativeKeys[mpKey] = nativeKey; } } } -void mp_init() +void oc_init() { - if(!__mpApp.init) + if(!oc_appData.init) { - memset(&__mpApp, 0, sizeof(__mpApp)); + memset(&oc_appData, 0, sizeof(oc_appData)); - mp_init_common(); - mp_init_keys(); + oc_init_common(); + oc_init_keys(); - __mpApp.win32.savedConsoleCodePage = GetConsoleOutputCP(); + oc_appData.win32.savedConsoleCodePage = GetConsoleOutputCP(); SetConsoleOutputCP(CP_UTF8); DWORD mode; @@ -166,63 +166,63 @@ void mp_init() u32 wheelScrollLines = 3; SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheelScrollLines, 0); - __mpApp.win32.wheelScrollLines = wheelScrollLines; + oc_appData.win32.wheelScrollLines = wheelScrollLines; } } -void mp_terminate() +void oc_terminate() { - if(__mpApp.init) + if(oc_appData.init) { - SetConsoleOutputCP(__mpApp.win32.savedConsoleCodePage); + SetConsoleOutputCP(oc_appData.win32.savedConsoleCodePage); - mp_terminate_common(); - __mpApp = (mp_app){0}; + oc_terminate_common(); + oc_appData = (oc_app){0}; } } -static mp_key_code mp_convert_win32_key(int code) +static oc_key_code oc_convert_win32_key(int code) { - return(__mpApp.keyCodes[code]); + return(oc_appData.keyCodes[code]); } -static mp_keymod_flags mp_get_mod_keys() +static oc_keymod_flags oc_get_mod_keys() { - mp_keymod_flags mods = 0; + oc_keymod_flags mods = 0; if(GetKeyState(VK_SHIFT) & 0x8000) { - mods |= MP_KEYMOD_SHIFT; + mods |= OC_KEYMOD_SHIFT; } if(GetKeyState(VK_CONTROL) & 0x8000) { - mods |= MP_KEYMOD_CTRL; - mods |= MP_KEYMOD_MAIN_MODIFIER; + mods |= OC_KEYMOD_CTRL; + mods |= OC_KEYMOD_MAIN_MODIFIER; } if(GetKeyState(VK_MENU) & 0x8000) { - mods |= MP_KEYMOD_ALT; + mods |= OC_KEYMOD_ALT; } if((GetKeyState(VK_LWIN) | GetKeyState(VK_RWIN)) & 0x8000) { - mods |= MP_KEYMOD_CMD; + mods |= OC_KEYMOD_CMD; } return(mods); } -static void process_mouse_event(mp_window_data* window, mp_key_action action, mp_key_code button) +static void oc_win32_process_mouse_event(oc_window_data* window, oc_key_action action, oc_key_code button) { - if(action == MP_KEY_PRESS) + if(action == OC_KEY_PRESS) { - if(!__mpApp.win32.mouseCaptureMask) + if(!oc_appData.win32.mouseCaptureMask) { SetCapture(window->win32.hWnd); } - __mpApp.win32.mouseCaptureMask |= (1<win32.hWnd, &clientRect); @@ -266,7 +266,7 @@ static void win32_update_child_layers(mp_window_data* window) HWND insertAfter = window->win32.hWnd; - for_list(&window->win32.layers, layer, mp_layer, listElt) + oc_list_for(&window->win32.layers, layer, oc_layer, listElt) { SetWindowPos(layer->hWnd, insertAfter, @@ -280,21 +280,21 @@ static void win32_update_child_layers(mp_window_data* window) } } -LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT result = 0; - mp_window_data* mpWindow = GetPropW(windowHandle, L"MilePost"); + oc_window_data* mpWindow = GetPropW(windowHandle, L"MilePost"); //TODO: put messages in queue switch(message) { case WM_CLOSE: { - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_CLOSE; - mp_queue_event(&event); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_CLOSE; + oc_queue_event(&event); } break; case WM_DPICHANGED: @@ -317,7 +317,7 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) //TODO: enter/exit size & move case WM_WINDOWPOSCHANGED: { - win32_update_child_layers(mpWindow); + oc_win32_update_child_layers(mpWindow); result = DefWindowProc(windowHandle, message, wParam, lParam); } break; @@ -326,32 +326,32 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) { RECT* rect = (RECT*)lParam; - mp_event event = {0}; - event.type = message == WM_SIZING ? MP_EVENT_WINDOW_RESIZE : MP_EVENT_WINDOW_MOVE; - event.window = mp_window_handle_from_ptr(mpWindow); + oc_event event = {0}; + event.type = message == WM_SIZING ? OC_EVENT_WINDOW_RESIZE : OC_EVENT_WINDOW_MOVE; + event.window = oc_window_handle_from_ptr(mpWindow); - event.move.frame = mp_window_get_frame_rect(event.window); - event.move.content = mp_window_get_content_rect(event.window); + event.move.frame = oc_window_get_frame_rect(event.window); + event.move.content = oc_window_get_content_rect(event.window); - mp_queue_event(&event); + oc_queue_event(&event); - win32_update_child_layers(mpWindow); + oc_win32_update_child_layers(mpWindow); } break; case WM_SETFOCUS: { - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_FOCUS; - mp_queue_event(&event); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_FOCUS; + oc_queue_event(&event); } break; case WM_KILLFOCUS: { - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_WINDOW_UNFOCUS; - mp_queue_event(&event); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_WINDOW_UNFOCUS; + oc_queue_event(&event); } break; case WM_SIZE: @@ -361,49 +361,49 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) { mpWindow->minimized = minimized; - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); if(minimized) { - event.type = MP_EVENT_WINDOW_HIDE; + event.type = OC_EVENT_WINDOW_HIDE; } else if(mpWindow->minimized) { - event.type = MP_EVENT_WINDOW_SHOW; + event.type = OC_EVENT_WINDOW_SHOW; } - mp_queue_event(&event); + oc_queue_event(&event); } } break; case WM_LBUTTONDOWN: { - process_mouse_event(mpWindow, MP_KEY_PRESS, MP_MOUSE_LEFT); + oc_win32_process_mouse_event(mpWindow, OC_KEY_PRESS, OC_MOUSE_LEFT); } break; case WM_RBUTTONDOWN: { - process_mouse_event(mpWindow, MP_KEY_PRESS, MP_MOUSE_RIGHT); + oc_win32_process_mouse_event(mpWindow, OC_KEY_PRESS, OC_MOUSE_RIGHT); } break; case WM_MBUTTONDOWN: { - process_mouse_event(mpWindow, MP_KEY_PRESS, MP_MOUSE_MIDDLE); + oc_win32_process_mouse_event(mpWindow, OC_KEY_PRESS, OC_MOUSE_MIDDLE); } break; case WM_LBUTTONUP: { - process_mouse_event(mpWindow, MP_KEY_RELEASE, MP_MOUSE_LEFT); + oc_win32_process_mouse_event(mpWindow, OC_KEY_RELEASE, OC_MOUSE_LEFT); } break; case WM_RBUTTONUP: { - process_mouse_event(mpWindow, MP_KEY_RELEASE, MP_MOUSE_RIGHT); + oc_win32_process_mouse_event(mpWindow, OC_KEY_RELEASE, OC_MOUSE_RIGHT); } break; case WM_MBUTTONUP: { - process_mouse_event(mpWindow, MP_KEY_RELEASE, MP_MOUSE_MIDDLE); + oc_win32_process_mouse_event(mpWindow, OC_KEY_RELEASE, OC_MOUSE_MIDDLE); } break; case WM_MOUSEMOVE: @@ -414,22 +414,22 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) u32 dpi = GetDpiForWindow(mpWindow->win32.hWnd); f32 scaling = (f32)dpi/96.; - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_MOUSE_MOVE; + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_MOUSE_MOVE; event.mouse.x = LOWORD(lParam) / scaling; event.mouse.y = HIWORD(lParam) / scaling; - if(__mpApp.win32.mouseTracked || __mpApp.win32.mouseCaptureMask) + if(oc_appData.win32.mouseTracked || oc_appData.win32.mouseCaptureMask) { - event.mouse.deltaX = event.mouse.x - __mpApp.win32.lastMousePos.x; - event.mouse.deltaY = event.mouse.y - __mpApp.win32.lastMousePos.y; + event.mouse.deltaX = event.mouse.x - oc_appData.win32.lastMousePos.x; + event.mouse.deltaY = event.mouse.y - oc_appData.win32.lastMousePos.y; } - __mpApp.win32.lastMousePos = (vec2){event.mouse.x, event.mouse.y}; + oc_appData.win32.lastMousePos = (oc_vec2){event.mouse.x, event.mouse.y}; - if(!__mpApp.win32.mouseTracked) + if(!oc_appData.win32.mouseTracked) { - __mpApp.win32.mouseTracked = true; + oc_appData.win32.mouseTracked = true; TRACKMOUSEEVENT track; memset(&track, 0, sizeof(track)); @@ -438,71 +438,71 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) track.hwndTrack = mpWindow->win32.hWnd; TrackMouseEvent(&track); - mp_event enter = {.window = event.window, - .type = MP_EVENT_MOUSE_ENTER, + oc_event enter = {.window = event.window, + .type = OC_EVENT_MOUSE_ENTER, .mouse.x = event.mouse.x, .mouse.y = event.mouse.y}; - mp_queue_event(&enter); + oc_queue_event(&enter); } - mp_queue_event(&event); + oc_queue_event(&event); } break; case WM_MOUSELEAVE: { - __mpApp.win32.mouseTracked = false; + oc_appData.win32.mouseTracked = false; - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_MOUSE_LEAVE; - mp_queue_event(&event); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_MOUSE_LEAVE; + oc_queue_event(&event); } break; case WM_MOUSEWHEEL: { - process_wheel_event(mpWindow, 0, (float)((i16)HIWORD(wParam))); + oc_win32_process_wheel_event(mpWindow, 0, (float)((i16)HIWORD(wParam))); } break; case WM_MOUSEHWHEEL: { - process_wheel_event(mpWindow, (float)((i16)HIWORD(wParam)), 0); + oc_win32_process_wheel_event(mpWindow, (float)((i16)HIWORD(wParam)), 0); } break; case WM_KEYDOWN: case WM_SYSKEYDOWN: { - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_KEYBOARD_KEY; - event.key.action = (lParam & 0x40000000) ? MP_KEY_REPEAT : MP_KEY_PRESS; - event.key.code = mp_convert_win32_key(HIWORD(lParam) & 0x1ff); - event.key.mods = mp_get_mod_keys(); - mp_queue_event(&event); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_KEYBOARD_KEY; + event.key.action = (lParam & 0x40000000) ? OC_KEY_REPEAT : OC_KEY_PRESS; + event.key.code = oc_convert_win32_key(HIWORD(lParam) & 0x1ff); + event.key.mods = oc_get_mod_keys(); + oc_queue_event(&event); } break; case WM_KEYUP: case WM_SYSKEYUP: { - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_KEYBOARD_KEY; - event.key.action = MP_KEY_RELEASE; - event.key.code = mp_convert_win32_key(HIWORD(lParam) & 0x1ff); - event.key.mods = mp_get_mod_keys(); - mp_queue_event(&event); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_KEYBOARD_KEY; + event.key.action = OC_KEY_RELEASE; + event.key.code = oc_convert_win32_key(HIWORD(lParam) & 0x1ff); + event.key.mods = oc_get_mod_keys(); + oc_queue_event(&event); } break; case WM_CHAR: { if((u32)wParam >= 32) { - mp_event event = {0}; - event.window = mp_window_handle_from_ptr(mpWindow); - event.type = MP_EVENT_KEYBOARD_CHAR; - event.character.codepoint = (utf32)wParam; - str8 seq = utf8_encode(event.character.sequence, event.character.codepoint); + oc_event event = {0}; + event.window = oc_window_handle_from_ptr(mpWindow); + event.type = OC_EVENT_KEYBOARD_CHAR; + event.character.codepoint = (oc_utf32)wParam; + oc_str8 seq = oc_utf8_encode(event.character.sequence, event.character.codepoint); event.character.seqLen = seq.len; - mp_queue_event(&event); + oc_queue_event(&event); } } break; @@ -512,7 +512,7 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) { u32 wheelScrollLines; if(SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &wheelScrollLines, 0) != 0) { - __mpApp.win32.wheelScrollLines = wheelScrollLines; + oc_appData.win32.wheelScrollLines = wheelScrollLines; } } } break; @@ -522,9 +522,9 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) //TODO } break; - case MP_WM_USER_DISPATCH_PROC: + case OC_WM_USER_DISPATCH_PROC: { - mp_dispatch_proc proc = (mp_dispatch_proc)wParam; + oc_dispatch_proc proc = (oc_dispatch_proc)wParam; void* user = (void*)lParam; result = proc(user); } break; @@ -542,22 +542,22 @@ LRESULT WinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lParam) // app management //-------------------------------------------------------------------- -bool mp_should_quit() +bool oc_should_quit() { - return(__mpApp.shouldQuit); + return(oc_appData.shouldQuit); } -void mp_cancel_quit() +void oc_cancel_quit() { - __mpApp.shouldQuit = false; + oc_appData.shouldQuit = false; } -void mp_request_quit() +void oc_request_quit() { - __mpApp.shouldQuit = true; + oc_appData.shouldQuit = true; } -void mp_pump_events(f64 timeout) +void oc_pump_events(f64 timeout) { MSG message; @@ -577,12 +577,12 @@ void mp_pump_events(f64 timeout) } } -i32 mp_dispatch_on_main_thread_sync(mp_window main_window, mp_dispatch_proc proc, void* user) +i32 oc_dispatch_on_main_thread_sync(oc_window main_window, oc_dispatch_proc proc, void* user) { - mp_window_data* window_data = mp_window_ptr_from_handle(main_window); - DEBUG_ASSERT(window_data != NULL); + oc_window_data* window_data = oc_window_ptr_from_handle(main_window); + OC_DEBUG_ASSERT(window_data != NULL); - LRESULT result = SendMessage(window_data->win32.hWnd, MP_WM_USER_DISPATCH_PROC, (WPARAM)proc, (LPARAM)user); + LRESULT result = SendMessage(window_data->win32.hWnd, OC_WM_USER_DISPATCH_PROC, (WPARAM)proc, (LPARAM)user); return result; } @@ -596,10 +596,10 @@ i32 mp_dispatch_on_main_thread_sync(mp_window main_window, mp_dispatch_proc proc #include #undef interface -mp_window mp_window_create(mp_rect rect, const char* title, mp_window_style style) +oc_window oc_window_create(oc_rect rect, oc_str8 title, oc_window_style style) { WNDCLASS windowClass = {.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC, - .lpfnWndProc = WinProc, + .lpfnWndProc = oc_win32_win_proc, .hInstance = GetModuleHandleW(NULL), .lpszClassName = "ApplicationWindowClass", .hCursor = LoadCursor(0, IDC_ARROW)}; @@ -627,13 +627,18 @@ mp_window mp_window_create(mp_rect rect, const char* title, mp_window_style styl DWORD winStyle = WS_OVERLAPPEDWINDOW; AdjustWindowRect(&frame, winStyle, FALSE); - HWND windowHandle = CreateWindow("ApplicationWindowClass", "Test Window", + oc_arena_scope scratch = oc_scratch_begin(); + const char* titleCString = oc_str8_to_cstring(scratch.arena, title); + + HWND windowHandle = CreateWindow("ApplicationWindowClass", titleCString, winStyle, frame.left, frame.top, frame.right-frame.left, frame.bottom-frame.top, 0, 0, windowClass.hInstance, 0); + oc_scratch_end(scratch); + if(!windowHandle) { //TODO: error @@ -644,30 +649,30 @@ mp_window mp_window_create(mp_rect rect, const char* title, mp_window_style styl //TODO: return wrapped window quit:; - mp_window_data* window = mp_window_alloc(); + oc_window_data* window = oc_window_alloc(); window->win32.hWnd = windowHandle; - window->win32.layers = (list_info){0}; + window->win32.layers = (oc_list){0}; SetPropW(windowHandle, L"MilePost", window); - return(mp_window_handle_from_ptr(window)); + return(oc_window_handle_from_ptr(window)); } -void mp_window_destroy(mp_window window) +void oc_window_destroy(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { DestroyWindow(windowData->win32.hWnd); //TODO: check when to unregister class - mp_window_recycle_ptr(windowData); + oc_window_recycle_ptr(windowData); } } -void* mp_window_native_pointer(mp_window window) +void* oc_window_native_pointer(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return(windowData->win32.hWnd); @@ -678,9 +683,9 @@ void* mp_window_native_pointer(mp_window window) } } -bool mp_window_should_close(mp_window window) +bool oc_window_should_close(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return(windowData->shouldClose); @@ -691,9 +696,9 @@ bool mp_window_should_close(mp_window window) } } -void mp_window_request_close(mp_window window) +void oc_window_request_close(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { windowData->shouldClose = true; @@ -701,9 +706,9 @@ void mp_window_request_close(mp_window window) } } -void mp_window_cancel_close(mp_window window) +void oc_window_cancel_close(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { windowData->shouldClose = false; @@ -711,9 +716,9 @@ void mp_window_cancel_close(mp_window window) } -bool mp_window_is_hidden(mp_window window) +bool oc_window_is_hidden(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return(IsWindowVisible(windowData->win32.hWnd)); @@ -724,27 +729,27 @@ bool mp_window_is_hidden(mp_window window) } } -void mp_window_hide(mp_window window) +void oc_window_hide(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { ShowWindow(windowData->win32.hWnd, SW_HIDE); } } -void mp_window_show(mp_window window) +void oc_window_show(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { ShowWindow(windowData->win32.hWnd, SW_NORMAL); } } -bool mp_window_is_minimized(mp_window window) +bool oc_window_is_minimized(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return(windowData->minimized); @@ -755,36 +760,36 @@ bool mp_window_is_minimized(mp_window window) } } -void mp_window_minimize(mp_window window) +void oc_window_minimize(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { ShowWindow(windowData->win32.hWnd, SW_MINIMIZE); } } -void mp_window_maximize(mp_window window) +void oc_window_maximize(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { ShowWindow(windowData->win32.hWnd, SW_MAXIMIZE); } } -void mp_window_restore(mp_window window) +void oc_window_restore(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { ShowWindow(windowData->win32.hWnd, SW_RESTORE); } } -bool mp_window_has_focus(mp_window window) +bool oc_window_has_focus(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { return(GetActiveWindow() == windowData->win32.hWnd); @@ -795,36 +800,36 @@ bool mp_window_has_focus(mp_window window) } } -void mp_window_focus(mp_window window) +void oc_window_focus(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { SetFocus(windowData->win32.hWnd); } } -void mp_window_unfocus(mp_window window) +void oc_window_unfocus(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { SetFocus(0); } } -void mp_window_send_to_back(mp_window window) +void oc_window_send_to_back(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { SetWindowPos(windowData->win32.hWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } } -void mp_window_bring_to_front(mp_window window) +void oc_window_bring_to_front(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { if(!IsWindowVisible(windowData->win32.hWnd)) @@ -835,10 +840,10 @@ void mp_window_bring_to_front(mp_window window) } } -mp_rect mp_window_get_frame_rect(mp_window window) +oc_rect oc_window_get_frame_rect(oc_window window) { - mp_rect rect = {0}; - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_rect rect = {0}; + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { //NOTE: GetWindowRect() includes the drop shadow, which we don't want, so we call @@ -855,7 +860,7 @@ mp_rect mp_window_get_frame_rect(mp_window window) sizeof(RECT)); if(res == S_OK) { - rect = (mp_rect){ + rect = (oc_rect){ frame.left / scale, frame.top / scale, (frame.right - frame.left)/scale, @@ -865,7 +870,7 @@ mp_rect mp_window_get_frame_rect(mp_window window) return(rect); } -mp_rect win32_get_drop_shadow_offsets(HWND hWnd) +static oc_rect oc_win32_get_drop_shadow_offsets(HWND hWnd) { RECT frameIncludingShadow; RECT frameExcludingShadow; @@ -876,7 +881,7 @@ mp_rect win32_get_drop_shadow_offsets(HWND hWnd) &frameExcludingShadow, sizeof(RECT)); - mp_rect extents = { + oc_rect extents = { .x = frameIncludingShadow.left - frameExcludingShadow.left, .y = frameIncludingShadow.top - frameExcludingShadow.top, .w = frameIncludingShadow.right - frameExcludingShadow.right, @@ -886,16 +891,16 @@ mp_rect win32_get_drop_shadow_offsets(HWND hWnd) return(extents); } -void mp_window_set_frame_rect(mp_window window, mp_rect rect) +void oc_window_set_frame_rect(oc_window window, oc_rect rect) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { u32 dpi = GetDpiForWindow(windowData->win32.hWnd); f32 scale = (float)dpi/96.; //NOTE compute the size of the drop shadow to add it in setwindowpos - mp_rect shadowOffsets = win32_get_drop_shadow_offsets(windowData->win32.hWnd); + oc_rect shadowOffsets = oc_win32_get_drop_shadow_offsets(windowData->win32.hWnd); RECT frame = { rect.x * scale + shadowOffsets.x, @@ -914,10 +919,10 @@ void mp_window_set_frame_rect(mp_window window, mp_rect rect) } } -mp_rect mp_window_get_content_rect(mp_window window) +oc_rect oc_window_get_content_rect(oc_window window) { - mp_rect rect = {0}; - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_rect rect = {0}; + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { RECT client; @@ -929,7 +934,7 @@ mp_rect mp_window_get_content_rect(mp_window window) POINT origin = {0, 0}; ClientToScreen(windowData->win32.hWnd, &origin); - rect = (mp_rect){ + rect = (oc_rect){ origin.x/scale, origin.y/scale, (client.right - client.left)/scale, @@ -939,9 +944,9 @@ mp_rect mp_window_get_content_rect(mp_window window) return(rect); } -void mp_window_set_content_rect(mp_window window, mp_rect rect) +void oc_window_set_content_rect(oc_window window, oc_rect rect) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { u32 dpi = GetDpiForWindow(windowData->win32.hWnd); @@ -967,13 +972,13 @@ void mp_window_set_content_rect(mp_window window, mp_rect rect) } } -void mp_window_center(mp_window window) +void oc_window_center(oc_window window) { - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { - mp_rect frame = mp_window_get_frame_rect(window); + oc_rect frame = oc_window_get_frame_rect(window); HMONITOR monitor = MonitorFromWindow(windowData->win32.hWnd, MONITOR_DEFAULTTOPRIMARY); if(monitor) @@ -994,7 +999,7 @@ void mp_window_center(mp_window window) frame.x = monX + 0.5*(monW - frame.w); frame.y = monY + 0.5*(monH - frame.h); - mp_window_set_frame_rect(window, frame); + oc_window_set_frame_rect(window, frame); } } } @@ -1004,7 +1009,7 @@ void mp_window_center(mp_window window) // clipboard functions //-------------------------------------------------------------------------------- -MP_API void mp_clipboard_clear(void) +void oc_clipboard_clear(void) { if(OpenClipboard(NULL)) { @@ -1013,7 +1018,7 @@ MP_API void mp_clipboard_clear(void) } } -MP_API void mp_clipboard_set_string(str8 string) +void oc_clipboard_set_string(oc_str8 string) { if(OpenClipboard(NULL)) { @@ -1037,9 +1042,9 @@ MP_API void mp_clipboard_set_string(str8 string) } } -MP_API str8 mp_clipboard_get_string(mem_arena* arena) +oc_str8 oc_clipboard_get_string(oc_arena* arena) { - str8 string = {0}; + oc_str8 string = {0}; if(OpenClipboard(NULL)) { @@ -1052,7 +1057,7 @@ MP_API str8 mp_clipboard_get_string(mem_arena* arena) u64 size = WideCharToMultiByte(CP_UTF8, 0, (wchar_t*)memory, -1, 0, 0, 0, 0); if(size) { - string.ptr = mem_arena_alloc(arena, size); + string.ptr = oc_arena_push(arena, size); string.len = size - 1; WideCharToMultiByte(CP_UTF8, 0, (wchar_t*)memory, -1, string.ptr, size, 0, 0); GlobalUnlock(handle); @@ -1064,10 +1069,10 @@ MP_API str8 mp_clipboard_get_string(mem_arena* arena) return(string); } -MP_API str8 mp_clipboard_copy_string(str8 backing) +oc_str8 oc_clipboard_copy_string(oc_str8 backing) { //TODO - return((str8){0}); + return((oc_str8){0}); } @@ -1077,48 +1082,48 @@ MP_API str8 mp_clipboard_copy_string(str8 backing) #include"graphics/graphics_surface.h" -vec2 mg_win32_surface_contents_scaling(mg_surface_data* surface) +oc_vec2 oc_win32_surface_contents_scaling(oc_surface_data* surface) { u32 dpi = GetDpiForWindow(surface->layer.hWnd); - vec2 contentsScaling = (vec2){(float)dpi/96., (float)dpi/96.}; + oc_vec2 contentsScaling = (oc_vec2){(float)dpi/96., (float)dpi/96.}; return(contentsScaling); } -vec2 mg_win32_surface_get_size(mg_surface_data* surface) +oc_vec2 oc_win32_surface_get_size(oc_surface_data* surface) { - vec2 size = {0}; + oc_vec2 size = {0}; RECT rect; if(GetClientRect(surface->layer.hWnd, &rect)) { u32 dpi = GetDpiForWindow(surface->layer.hWnd); f32 scale = (float)dpi/96.; - size = (vec2){(rect.right - rect.left)/scale, (rect.bottom - rect.top)/scale}; + size = (oc_vec2){(rect.right - rect.left)/scale, (rect.bottom - rect.top)/scale}; } return(size); } -bool mg_win32_surface_get_hidden(mg_surface_data* surface) +bool oc_win32_surface_get_hidden(oc_surface_data* surface) { bool hidden = !IsWindowVisible(surface->layer.hWnd); return(hidden); } -void mg_win32_surface_set_hidden(mg_surface_data* surface, bool hidden) +void oc_win32_surface_set_hidden(oc_surface_data* surface, bool hidden) { ShowWindow(surface->layer.hWnd, hidden ? SW_HIDE : SW_NORMAL); } -void* mg_win32_surface_native_layer(mg_surface_data* surface) +void* oc_win32_surface_native_layer(oc_surface_data* surface) { return((void*)surface->layer.hWnd); } -mg_surface_id mg_win32_surface_remote_id(mg_surface_data* surface) +oc_surface_id oc_win32_surface_remote_id(oc_surface_data* surface) { - return((mg_surface_id)surface->layer.hWnd); + return((oc_surface_id)surface->layer.hWnd); } -void mg_win32_surface_host_connect(mg_surface_data* surface, mg_surface_id remoteID) +void oc_win32_surface_host_connect(oc_surface_data* surface, oc_surface_id remoteID) { HWND dstWnd = surface->layer.hWnd; HWND srcWnd = (HWND)remoteID; @@ -1138,9 +1143,9 @@ void mg_win32_surface_host_connect(mg_surface_data* surface, mg_surface_id remot SWP_NOACTIVATE | SWP_NOZORDER); } -void mg_surface_cleanup(mg_surface_data* surface) +void oc_surface_cleanup(oc_surface_data* surface) { - list_remove(&surface->layer.parent->win32.layers, &surface->layer.listElt); + oc_list_remove(&surface->layer.parent->win32.layers, &surface->layer.listElt); DestroyWindow(surface->layer.hWnd); } @@ -1156,13 +1161,13 @@ LRESULT LayerWinProc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM lPar } } -void mg_surface_init_for_window(mg_surface_data* surface, mp_window_data* window) +void oc_surface_init_for_window(oc_surface_data* surface, oc_window_data* window) { - surface->contentsScaling = mg_win32_surface_contents_scaling; - surface->getSize = mg_win32_surface_get_size; - surface->getHidden = mg_win32_surface_get_hidden; - surface->setHidden = mg_win32_surface_set_hidden; - surface->nativeLayer = mg_win32_surface_native_layer; + surface->contentsScaling = oc_win32_surface_contents_scaling; + surface->getSize = oc_win32_surface_get_size; + surface->getHidden = oc_win32_surface_get_hidden; + surface->setHidden = oc_win32_surface_set_hidden; + surface->nativeLayer = oc_win32_surface_native_layer; //NOTE(martin): create a child window for the surface WNDCLASS layerWindowClass = {.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC, @@ -1201,21 +1206,21 @@ void mg_surface_init_for_window(mg_surface_data* surface, mp_window_data* window DeleteObject(region); if(res != S_OK) { - log_error("couldn't enable blur behind\n"); + oc_log_error("couldn't enable blur behind\n"); } surface->layer.parent = window; - list_append(&window->win32.layers, &surface->layer.listElt); + oc_list_append(&window->win32.layers, &surface->layer.listElt); } -void mg_surface_init_remote(mg_surface_data* surface, u32 width, u32 height) +void oc_surface_init_remote(oc_surface_data* surface, u32 width, u32 height) { - surface->contentsScaling = mg_win32_surface_contents_scaling; - surface->getSize = mg_win32_surface_get_size; - surface->getHidden = mg_win32_surface_get_hidden; - surface->setHidden = mg_win32_surface_set_hidden; - surface->nativeLayer = mg_win32_surface_native_layer; - surface->remoteID = mg_win32_surface_remote_id; + surface->contentsScaling = oc_win32_surface_contents_scaling; + surface->getSize = oc_win32_surface_get_size; + surface->getHidden = oc_win32_surface_get_hidden; + surface->setHidden = oc_win32_surface_set_hidden; + surface->nativeLayer = oc_win32_surface_native_layer; + surface->remoteID = oc_win32_surface_remote_id; WNDCLASS layerWindowClass = {.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC, .lpfnWndProc = DefWindowProc, @@ -1251,20 +1256,20 @@ void mg_surface_init_remote(mg_surface_data* surface, u32 width, u32 height) DestroyWindow(tmpParent); } -mg_surface_data* mg_win32_surface_create_host(mp_window window) +oc_surface_data* oc_win32_surface_create_host(oc_window window) { - mg_surface_data* surface = 0; - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_surface_data* surface = 0; + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { - surface = malloc_type(mg_surface_data); + surface = oc_malloc_type(oc_surface_data); if(surface) { - memset(surface, 0, sizeof(mg_surface_data)); - mg_surface_init_for_window(surface, windowData); + memset(surface, 0, sizeof(oc_surface_data)); + oc_surface_init_for_window(surface, windowData); - surface->api = MG_HOST; - surface->hostConnect = mg_win32_surface_host_connect; + surface->api = OC_HOST; + surface->hostConnect = oc_win32_surface_host_connect; } } return(surface); @@ -1283,14 +1288,13 @@ mg_surface_data* mg_win32_surface_create_host(mp_window window) #undef interface -MP_API str8 mp_open_dialog(mem_arena* arena, - const char* title, - const char* defaultPath, - int filterCount, - const char** filters, - bool directory) +oc_str8 oc_open_dialog(oc_arena* arena, + oc_str8 title, + oc_str8 defaultPath, + oc_str8_list filters, + bool directory) { - str8 res = {0}; + oc_str8 res = {0}; HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if(SUCCEEDED(hr)) { @@ -1305,36 +1309,40 @@ MP_API str8 mp_open_dialog(mem_arena* arena, dialog->lpVtbl->SetOptions(dialog, opt | FOS_PICKFOLDERS); } - if(filterCount && filters) + if(filters.eltCount) { - mem_arena_scope tmp = mem_arena_scope_begin(arena); - COMDLG_FILTERSPEC* filterSpecs = mem_arena_alloc_array(arena, COMDLG_FILTERSPEC, filterCount); - for(int i=0; istring); + oc_str8 filter = oc_str8_list_join(arena, list); int filterWideSize = 1 + MultiByteToWideChar(CP_UTF8, 0, filter.ptr, filter.len, NULL, 0); - filterSpecs[i].pszSpec = mem_arena_alloc_array(arena, wchar_t, filterWideSize); + filterSpecs[i].pszSpec = oc_arena_push_array(arena, wchar_t, filterWideSize); MultiByteToWideChar(CP_UTF8, 0, filter.ptr, filter.len, (LPWSTR)filterSpecs[i].pszSpec, filterWideSize); ((LPWSTR)(filterSpecs[i].pszSpec))[filterWideSize-1] = 0; filterSpecs[i].pszName = filterSpecs[i].pszSpec; + i++; } - hr = dialog->lpVtbl->SetFileTypes(dialog, filterCount, filterSpecs); + hr = dialog->lpVtbl->SetFileTypes(dialog, i, filterSpecs); - mem_arena_scope_end(tmp); + oc_arena_scope_end(tmp); } - if(defaultPath) + if(defaultPath.len) { - mem_arena_scope tmp = mem_arena_scope_begin(arena); - int pathWideSize = MultiByteToWideChar(CP_UTF8, 0, defaultPath, -1, NULL, 0); - LPWSTR pathWide = mem_arena_alloc_array(arena, wchar_t, pathWideSize); - MultiByteToWideChar(CP_UTF8, 0, defaultPath, -1, pathWide, pathWideSize); + oc_arena_scope tmp = oc_arena_scope_begin(arena); + int pathWideSize = MultiByteToWideChar(CP_UTF8, 0, defaultPath.ptr, defaultPath.len, NULL, 0); + LPWSTR pathWide = oc_arena_push_array(arena, wchar_t, pathWideSize+1); + MultiByteToWideChar(CP_UTF8, 0, defaultPath.ptr, defaultPath.len, pathWide, pathWideSize); + pathWide[pathWideSize] = '\0'; IShellItem* item = 0; hr = SHCreateItemFromParsingName(pathWide, NULL, &IID_IShellItem, (void**)&item); @@ -1343,7 +1351,7 @@ MP_API str8 mp_open_dialog(mem_arena* arena, hr = dialog->lpVtbl->SetFolder(dialog, item); item->lpVtbl->Release(item); } - mem_arena_scope_end(tmp); + oc_arena_scope_end(tmp); } hr = dialog->lpVtbl->Show(dialog, NULL); @@ -1358,12 +1366,12 @@ MP_API str8 mp_open_dialog(mem_arena* arena, if(SUCCEEDED(hr)) { - int utf8Size = WideCharToMultiByte(CP_UTF8, 0, filePath, -1, NULL, 0, NULL, NULL); - if(utf8Size > 0) + int oc_utf8Size = WideCharToMultiByte(CP_UTF8, 0, filePath, -1, NULL, 0, NULL, NULL); + if(oc_utf8Size > 0) { - res.ptr = mem_arena_alloc(arena, utf8Size); - res.len = utf8Size-1; - WideCharToMultiByte(CP_UTF8, 0, filePath, -1, res.ptr, utf8Size, NULL, NULL); + res.ptr = oc_arena_push(arena, oc_utf8Size); + res.len = oc_utf8Size-1; + WideCharToMultiByte(CP_UTF8, 0, filePath, -1, res.ptr, oc_utf8Size, NULL, NULL); } CoTaskMemFree(filePath); } @@ -1376,13 +1384,12 @@ MP_API str8 mp_open_dialog(mem_arena* arena, return(res); } -MP_API str8 mp_save_dialog(mem_arena* arena, - const char* title, - const char* defaultPath, - int filterCount, - const char** filters) +oc_str8 oc_save_dialog(oc_arena* arena, + oc_str8 title, + oc_str8 defaultPath, + oc_str8_list filters) { - str8 res = {0}; + oc_str8 res = {0}; HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if(SUCCEEDED(hr)) { @@ -1390,36 +1397,40 @@ MP_API str8 mp_save_dialog(mem_arena* arena, hr = CoCreateInstance(&CLSID_FileSaveDialog, NULL, CLSCTX_ALL, &IID_IFileSaveDialog, (void**)&dialog); if(SUCCEEDED(hr)) { - if(filterCount && filters) + if(filters.eltCount) { - mem_arena_scope tmp = mem_arena_scope_begin(arena); - COMDLG_FILTERSPEC* filterSpecs = mem_arena_alloc_array(arena, COMDLG_FILTERSPEC, filterCount); - for(int i=0; istring); + oc_str8 filter = oc_str8_list_join(arena, list); int filterWideSize = 1 + MultiByteToWideChar(CP_UTF8, 0, filter.ptr, filter.len, NULL, 0); - filterSpecs[i].pszSpec = mem_arena_alloc_array(arena, wchar_t, filterWideSize); + filterSpecs[i].pszSpec = oc_arena_push_array(arena, wchar_t, filterWideSize); MultiByteToWideChar(CP_UTF8, 0, filter.ptr, filter.len, (LPWSTR)filterSpecs[i].pszSpec, filterWideSize); ((LPWSTR)(filterSpecs[i].pszSpec))[filterWideSize-1] = 0; filterSpecs[i].pszName = filterSpecs[i].pszSpec; + i++; } - hr = dialog->lpVtbl->SetFileTypes(dialog, filterCount, filterSpecs); + hr = dialog->lpVtbl->SetFileTypes(dialog, i, filterSpecs); - mem_arena_scope_end(tmp); + oc_arena_scope_end(tmp); } - if(defaultPath) + if(defaultPath.len) { - mem_arena_scope tmp = mem_arena_scope_begin(arena); - int pathWideSize = MultiByteToWideChar(CP_UTF8, 0, defaultPath, -1, NULL, 0); - LPWSTR pathWide = mem_arena_alloc_array(arena, wchar_t, pathWideSize); - MultiByteToWideChar(CP_UTF8, 0, defaultPath, -1, pathWide, pathWideSize); + oc_arena_scope tmp = oc_arena_scope_begin(arena); + int pathWideSize = MultiByteToWideChar(CP_UTF8, 0, defaultPath.ptr, defaultPath.len, NULL, 0); + LPWSTR pathWide = oc_arena_push_array(arena, wchar_t, pathWideSize + 1); + MultiByteToWideChar(CP_UTF8, 0, defaultPath.ptr, defaultPath.len, pathWide, pathWideSize); + pathWide[pathWideSize] = '\0'; IShellItem* item = 0; hr = SHCreateItemFromParsingName(pathWide, NULL, &IID_IShellItem, (void**)&item); @@ -1428,7 +1439,7 @@ MP_API str8 mp_save_dialog(mem_arena* arena, hr = dialog->lpVtbl->SetFolder(dialog, item); item->lpVtbl->Release(item); } - mem_arena_scope_end(tmp); + oc_arena_scope_end(tmp); } hr = dialog->lpVtbl->Show(dialog, NULL); @@ -1443,12 +1454,12 @@ MP_API str8 mp_save_dialog(mem_arena* arena, if(SUCCEEDED(hr)) { - int utf8Size = WideCharToMultiByte(CP_UTF8, 0, filePath, -1, NULL, 0, NULL, NULL); - if(utf8Size > 0) + int oc_utf8Size = WideCharToMultiByte(CP_UTF8, 0, filePath, -1, NULL, 0, NULL, NULL); + if(oc_utf8Size > 0) { - res.ptr = mem_arena_alloc(arena, utf8Size); - res.len = utf8Size-1; - WideCharToMultiByte(CP_UTF8, 0, filePath, -1, res.ptr, utf8Size, NULL, NULL); + res.ptr = oc_arena_push(arena, oc_utf8Size); + res.len = oc_utf8Size-1; + WideCharToMultiByte(CP_UTF8, 0, filePath, -1, res.ptr, oc_utf8Size, NULL, NULL); } CoTaskMemFree(filePath); } @@ -1463,32 +1474,36 @@ MP_API str8 mp_save_dialog(mem_arena* arena, #include -MP_API int mp_alert_popup(const char* title, - const char* message, - u32 count, - const char** options) +int oc_alert_popup(oc_str8 title, + oc_str8 message, + oc_str8_list options) { - mem_arena* scratch = mem_scratch(); - mem_arena_scope tmp = mem_arena_scope_begin(scratch); - TASKDIALOG_BUTTON* buttons = mem_arena_alloc_array(scratch, TASKDIALOG_BUTTON, count); + oc_arena_scope scratch = oc_scratch_begin(); + TASKDIALOG_BUTTON* buttons = oc_arena_push_array(scratch.arena, TASKDIALOG_BUTTON, options.eltCount); - for(int i=0; istring.ptr, elt->string.len, NULL, 0); + wchar_t* textWide = oc_arena_push_array(scratch.arena, wchar_t, textWideSize + 1); + MultiByteToWideChar(CP_UTF8, 0, elt->string.ptr, elt->string.len, textWide, textWideSize); + textWide[textWideSize] = '\0'; buttons[i].nButtonID = i+1; buttons[i].pszButtonText = textWide; + + i++; } - int titleWideSize = MultiByteToWideChar(CP_UTF8, 0, title, -1, NULL, 0); - wchar_t* titleWide = mem_arena_alloc_array(scratch, wchar_t, titleWideSize); - MultiByteToWideChar(CP_UTF8, 0, title, -1, titleWide, titleWideSize); + int titleWideSize = MultiByteToWideChar(CP_UTF8, 0, title.ptr, title.len, NULL, 0); + wchar_t* titleWide = oc_arena_push_array(scratch.arena, wchar_t, titleWideSize + 1); + MultiByteToWideChar(CP_UTF8, 0, title.ptr, title.len, titleWide, titleWideSize); + titleWide[titleWideSize] = '\0'; - int messageWideSize = MultiByteToWideChar(CP_UTF8, 0, message, -1, NULL, 0); - wchar_t* messageWide = mem_arena_alloc_array(scratch, wchar_t, messageWideSize); - MultiByteToWideChar(CP_UTF8, 0, message, -1, messageWide, messageWideSize); + int messageWideSize = MultiByteToWideChar(CP_UTF8, 0, message.ptr, message.len, NULL, 0); + wchar_t* messageWide = oc_arena_push_array(scratch.arena, wchar_t, messageWideSize + 1); + MultiByteToWideChar(CP_UTF8, 0, message.ptr, message.len, messageWide, messageWideSize); + messageWide[messageWideSize] = '\0'; TASKDIALOGCONFIG config = { @@ -1502,7 +1517,7 @@ MP_API int mp_alert_popup(const char* title, .pszMainIcon = TD_WARNING_ICON, .pszMainInstruction = messageWide, .pszContent = NULL, - .cButtons = count, + .cButtons = options.eltCount, .pButtons = buttons, .nDefaultButton = 0, }; @@ -1521,6 +1536,6 @@ MP_API int mp_alert_popup(const char* title, } } - mem_arena_scope_end(tmp); + oc_scratch_end(scratch); return(button); } diff --git a/src/app/win32_app.h b/src/app/win32_app.h index ab574df..45a0ca7 100644 --- a/src/app/win32_app.h +++ b/src/app/win32_app.h @@ -10,45 +10,45 @@ #ifndef __WIN32_APP_H_ #define __WIN32_APP_H_ -#include"mp_app.h" +#include"app.h" #define WIN32_LEAN_AND_MEAN #define UNICODE #include -typedef struct win32_window_data +typedef struct oc_win32_window_data { HWND hWnd; - list_info layers; -} win32_window_data; + oc_list layers; +} oc_win32_window_data; -typedef struct mp_window_data mp_window_data; -typedef struct mp_layer +typedef struct oc_window_data oc_window_data; +typedef struct oc_layer { - mp_window_data* parent; - list_elt listElt; + oc_window_data* parent; + oc_list_elt listElt; HWND hWnd; -} mp_layer; +} oc_layer; -#define MP_PLATFORM_WINDOW_DATA win32_window_data win32; +#define OC_PLATFORM_WINDOW_DATA oc_win32_window_data win32; -typedef struct win32_app_data +typedef struct oc_win32_app_data { u32 savedConsoleCodePage; int mouseCaptureMask; bool mouseTracked; - vec2 lastMousePos; + oc_vec2 lastMousePos; u32 wheelScrollLines; -} win32_app_data; +} oc_win32_app_data; -#define MP_PLATFORM_APP_DATA win32_app_data win32; +#define OC_PLATFORM_APP_DATA oc_win32_app_data win32; -enum MP_WM_USER +enum OC_WM_USER { - MP_WM_USER_DISPATCH_PROC = 0x0400, // WM_USER messages are defined from 0x400 to 0x7FFF + OC_WM_USER_DISPATCH_PROC = 0x0400, // WM_USER messages are defined from 0x400 to 0x7FFF }; #endif __WIN32_APP_H_ diff --git a/src/graphics/egl_surface.c b/src/graphics/egl_surface.c index dd2e28e..132078d 100644 --- a/src/graphics/egl_surface.c +++ b/src/graphics/egl_surface.c @@ -10,47 +10,47 @@ #define EGL_EGLEXT_PROTOTYPES #include #include -#include"app/mp_app_internal.h" +#include"app/app_internal.h" #include"graphics_surface.h" #include"gl_loader.h" -#if PLATFORM_MACOS +#if OC_PLATFORM_MACOS //NOTE: EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE on osx defaults to CGL backend, which doesn't handle SwapInterval correctly - #define MG_EGL_PLATFORM_ANGLE_TYPE EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE + #define OC_EGL_PLATFORM_ANGLE_TYPE EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE //NOTE: hardcode GLES versions for now //TODO: use version hints, once we have all api versions correctly categorized by glapi.py - #define MG_GLES_VERSION_MAJOR 3 - #define MG_GLES_VERSION_MINOR 0 - #define mg_gl_load_gles mg_gl_load_gles31 + #define OC_GLES_VERSION_MAJOR 3 + #define OC_GLES_VERSION_MINOR 0 + #define oc_gl_load_gles oc_gl_load_gles31 #else - #define MG_EGL_PLATFORM_ANGLE_TYPE EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE - #define MG_GLES_VERSION_MAJOR 3 - #define MG_GLES_VERSION_MINOR 1 - #define mg_gl_load_gles mg_gl_load_gles32 + #define OC_EGL_PLATFORM_ANGLE_TYPE EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE + #define OC_GLES_VERSION_MAJOR 3 + #define OC_GLES_VERSION_MINOR 1 + #define oc_gl_load_gles oc_gl_load_gles32 #endif -typedef struct mg_egl_surface +typedef struct oc_egl_surface { - mg_surface_data interface; + oc_surface_data interface; EGLDisplay eglDisplay; EGLConfig eglConfig; EGLContext eglContext; EGLSurface eglSurface; - mg_gl_api api; + oc_gl_api api; -} mg_egl_surface; +} oc_egl_surface; -void mg_egl_surface_destroy(mg_surface_data* interface) +void oc_egl_surface_destroy(oc_surface_data* interface) { - mg_egl_surface* surface = (mg_egl_surface*)interface; + oc_egl_surface* surface = (oc_egl_surface*)interface; - if(&surface->api == mg_gl_get_api()) + if(&surface->api == oc_gl_get_api()) { - mg_gl_deselect_api(); + oc_gl_deselect_api(); } if(eglGetCurrentContext() == surface->eglContext) { @@ -59,50 +59,50 @@ void mg_egl_surface_destroy(mg_surface_data* interface) eglDestroyContext(surface->eglDisplay, surface->eglContext); eglDestroySurface(surface->eglDisplay, surface->eglSurface); - mg_surface_cleanup((mg_surface_data*)surface); + oc_surface_cleanup((oc_surface_data*)surface); free(surface); } -void mg_egl_surface_prepare(mg_surface_data* interface) +void oc_egl_surface_prepare(oc_surface_data* interface) { - mg_egl_surface* surface = (mg_egl_surface*)interface; + oc_egl_surface* surface = (oc_egl_surface*)interface; eglMakeCurrent(surface->eglDisplay, surface->eglSurface, surface->eglSurface, surface->eglContext); - mg_gl_select_api(&surface->api); + oc_gl_select_api(&surface->api); } -void mg_egl_surface_present(mg_surface_data* interface) +void oc_egl_surface_present(oc_surface_data* interface) { - mg_egl_surface* surface = (mg_egl_surface*)interface; + oc_egl_surface* surface = (oc_egl_surface*)interface; eglSwapBuffers(surface->eglDisplay, surface->eglSurface); } -void mg_egl_surface_deselect(mg_surface_data* interface) +void oc_egl_surface_deselect(oc_surface_data* interface) { - mg_egl_surface* surface = (mg_egl_surface*)interface; + oc_egl_surface* surface = (oc_egl_surface*)interface; eglMakeCurrent(surface->eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - mg_gl_deselect_api(); + oc_gl_deselect_api(); } -void mg_egl_surface_swap_interval(mg_surface_data* interface, int swap) +void oc_egl_surface_swap_interval(oc_surface_data* interface, int swap) { - mg_egl_surface* surface = (mg_egl_surface*)interface; + oc_egl_surface* surface = (oc_egl_surface*)interface; eglSwapInterval(surface->eglDisplay, swap); } -void mg_egl_surface_init(mg_egl_surface* surface) +void oc_egl_surface_init(oc_egl_surface* surface) { - void* nativeLayer = surface->interface.nativeLayer((mg_surface_data*)surface); + void* nativeLayer = surface->interface.nativeLayer((oc_surface_data*)surface); - surface->interface.api = MG_GLES; + surface->interface.api = OC_GLES; - surface->interface.destroy = mg_egl_surface_destroy; - surface->interface.prepare = mg_egl_surface_prepare; - surface->interface.present = mg_egl_surface_present; - surface->interface.deselect = mg_egl_surface_deselect; - surface->interface.swapInterval = mg_egl_surface_swap_interval; + surface->interface.destroy = oc_egl_surface_destroy; + surface->interface.prepare = oc_egl_surface_prepare; + surface->interface.present = oc_egl_surface_present; + surface->interface.deselect = oc_egl_surface_deselect; + surface->interface.swapInterval = oc_egl_surface_swap_interval; EGLAttrib displayAttribs[] = { - EGL_PLATFORM_ANGLE_TYPE_ANGLE, MG_EGL_PLATFORM_ANGLE_TYPE, + EGL_PLATFORM_ANGLE_TYPE_ANGLE, OC_EGL_PLATFORM_ANGLE_TYPE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE, EGL_NONE}; @@ -133,8 +133,8 @@ void mg_egl_surface_init(mg_egl_surface* surface) eglBindAPI(EGL_OPENGL_ES_API); EGLint contextAttributes[] = { - EGL_CONTEXT_MAJOR_VERSION_KHR, MG_GLES_VERSION_MAJOR, - EGL_CONTEXT_MINOR_VERSION_KHR, MG_GLES_VERSION_MINOR, + EGL_CONTEXT_MAJOR_VERSION_KHR, OC_GLES_VERSION_MAJOR, + EGL_CONTEXT_MINOR_VERSION_KHR, OC_GLES_VERSION_MINOR, EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM, EGL_TRUE, EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE, EGL_TRUE, EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE, EGL_FALSE, @@ -143,41 +143,41 @@ void mg_egl_surface_init(mg_egl_surface* surface) surface->eglContext = eglCreateContext(surface->eglDisplay, surface->eglConfig, EGL_NO_CONTEXT, contextAttributes); eglMakeCurrent(surface->eglDisplay, surface->eglSurface, surface->eglSurface, surface->eglContext); - mg_gl_load_gles(&surface->api, (mg_gl_load_proc)eglGetProcAddress); + oc_gl_load_gles(&surface->api, (oc_gl_load_proc)eglGetProcAddress); eglSwapInterval(surface->eglDisplay, 1); } -mg_surface_data* mg_egl_surface_create_remote(u32 width, u32 height) +oc_surface_data* oc_egl_surface_create_remote(u32 width, u32 height) { - mg_egl_surface* surface = 0; + oc_egl_surface* surface = 0; - surface = malloc_type(mg_egl_surface); + surface = oc_malloc_type(oc_egl_surface); if(surface) { - memset(surface, 0, sizeof(mg_egl_surface)); + memset(surface, 0, sizeof(oc_egl_surface)); - mg_surface_init_remote((mg_surface_data*)surface, width, height); - mg_egl_surface_init(surface); + oc_surface_init_remote((oc_surface_data*)surface, width, height); + oc_egl_surface_init(surface); } - return((mg_surface_data*)surface); + return((oc_surface_data*)surface); } -mg_surface_data* mg_egl_surface_create_for_window(mp_window window) +oc_surface_data* oc_egl_surface_create_for_window(oc_window window) { - mg_egl_surface* surface = 0; - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_egl_surface* surface = 0; + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { - surface = malloc_type(mg_egl_surface); + surface = oc_malloc_type(oc_egl_surface); if(surface) { - memset(surface, 0, sizeof(mg_egl_surface)); + memset(surface, 0, sizeof(oc_egl_surface)); - mg_surface_init_for_window((mg_surface_data*)surface, windowData); - mg_egl_surface_init(surface); + oc_surface_init_for_window((oc_surface_data*)surface, windowData); + oc_egl_surface_init(surface); } } - return((mg_surface_data*)surface); + return((oc_surface_data*)surface); } diff --git a/src/graphics/egl_surface.h b/src/graphics/egl_surface.h index 1846cf8..1b53f5e 100644 --- a/src/graphics/egl_surface.h +++ b/src/graphics/egl_surface.h @@ -10,9 +10,9 @@ #define __EGL_SURFACE_H_ #include"graphics_surface.h" -#include"app/mp_app.h" +#include"app/app.h" -mg_surface_data* mg_egl_surface_create_for_window(mp_window window); -mg_surface_data* mg_egl_surface_create_remote(u32 width, u32 height); +oc_surface_data* oc_egl_surface_create_for_window(oc_window window); +oc_surface_data* oc_egl_surface_create_remote(u32 width, u32 height); #endif // __EGL_SURFACE_H_ diff --git a/src/graphics/gl_api.h b/src/graphics/gl_api.h index d3e52fc..b09775f 100644 --- a/src/graphics/gl_api.h +++ b/src/graphics/gl_api.h @@ -1,1123 +1,1123 @@ -/******************************************************** -* -* @file: gl_api.h -* @note: auto-generated by glapi.py from gl.xml -* @date: 11/082023 -* -*********************************************************/ -#ifndef __GL_API_H__ -#define __GL_API_H__ - -#include"GL/glcorearb.h" -#include"GLES3/gl32.h" - -typedef struct mg_gl_api -{ - const char* name; - PFNGLGETPROGRAMBINARYPROC GetProgramBinary; - PFNGLFRONTFACEPROC FrontFace; - PFNGLDISABLEIPROC Disablei; - PFNGLBEGINCONDITIONALRENDERPROC BeginConditionalRender; - PFNGLCOPYTEXSUBIMAGE3DPROC CopyTexSubImage3D; - PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC CompressedTexSubImage1D; - PFNGLVERTEXATTRIBI4USVPROC VertexAttribI4usv; - PFNGLVERTEXATTRIB2SVPROC VertexAttrib2sv; - PFNGLUNIFORMMATRIX2X3FVPROC UniformMatrix2x3fv; - PFNGLMULTIDRAWARRAYSINDIRECTPROC MultiDrawArraysIndirect; - PFNGLCOLORMASKIPROC ColorMaski; - PFNGLBINDVERTEXARRAYPROC BindVertexArray; - PFNGLPROGRAMUNIFORM3DPROC ProgramUniform3d; - PFNGLGETBUFFERPARAMETERI64VPROC GetBufferParameteri64v; - PFNGLUNIFORM4IPROC Uniform4i; - PFNGLGETATTACHEDSHADERSPROC GetAttachedShaders; - PFNGLATTACHSHADERPROC AttachShader; - PFNGLVERTEXATTRIBI2UIPROC VertexAttribI2ui; - PFNGLCLEARCOLORPROC ClearColor; - PFNGLTEXPARAMETERIIVPROC TexParameterIiv; - PFNGLPROGRAMUNIFORM4DPROC ProgramUniform4d; - PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC DrawTransformFeedbackStream; - PFNGLVERTEXATTRIBI4IVPROC VertexAttribI4iv; - PFNGLCOPYBUFFERSUBDATAPROC CopyBufferSubData; - PFNGLDEBUGMESSAGEINSERTPROC DebugMessageInsert; - PFNGLVIEWPORTINDEXEDFPROC ViewportIndexedf; - PFNGLPROGRAMUNIFORM1FVPROC ProgramUniform1fv; - PFNGLOBJECTPTRLABELPROC ObjectPtrLabel; - PFNGLSTENCILMASKSEPARATEPROC StencilMaskSeparate; - PFNGLUNIFORMMATRIX3X4DVPROC UniformMatrix3x4dv; - PFNGLFRAMEBUFFERTEXTURE1DPROC FramebufferTexture1D; - PFNGLVIEWPORTPROC Viewport; - PFNGLGENTEXTURESPROC GenTextures; - PFNGLUNIFORMBLOCKBINDINGPROC UniformBlockBinding; - PFNGLVERTEXATTRIB3SVPROC VertexAttrib3sv; - PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC ProgramUniformMatrix3x4fv; - PFNGLVERTEXATTRIB2FPROC VertexAttrib2f; - PFNGLGETACTIVEUNIFORMPROC GetActiveUniform; - PFNGLSCISSORINDEXEDPROC ScissorIndexed; - PFNGLTEXPARAMETERFPROC TexParameterf; - PFNGLBINDSAMPLERPROC BindSampler; - PFNGLMULTIDRAWELEMENTSINDIRECTPROC MultiDrawElementsIndirect; - PFNGLCLEARTEXSUBIMAGEPROC ClearTexSubImage; - PFNGLISENABLEDIPROC IsEnabledi; - PFNGLSCISSORPROC Scissor; - PFNGLPROGRAMBINARYPROC ProgramBinary; - PFNGLDISABLEPROC Disable; - PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC GetActiveUniformBlockName; - PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC DrawRangeElementsBaseVertex; - PFNGLDEBUGMESSAGECALLBACKPROC DebugMessageCallback; - PFNGLBLENDEQUATIONIPROC BlendEquationi; - PFNGLVERTEXATTRIBI4UIVPROC VertexAttribI4uiv; - PFNGLBLENDFUNCIPROC BlendFunci; - PFNGLVALIDATEPROGRAMPIPELINEPROC ValidateProgramPipeline; - PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays; - PFNGLGENRENDERBUFFERSPROC GenRenderbuffers; - PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus; - PFNGLUNIFORM1UIPROC Uniform1ui; - PFNGLPROGRAMUNIFORM3UIPROC ProgramUniform3ui; - PFNGLVERTEXATTRIB4BVPROC VertexAttrib4bv; - PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC GetProgramResourceLocationIndex; - PFNGLPROGRAMUNIFORM3FVPROC ProgramUniform3fv; - PFNGLPOLYGONOFFSETPROC PolygonOffset; - PFNGLISPROGRAMPROC IsProgram; - PFNGLCLEARDEPTHFPROC ClearDepthf; - PFNGLENDCONDITIONALRENDERPROC EndConditionalRender; - PFNGLGETOBJECTLABELPROC GetObjectLabel; - PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC ProgramUniformMatrix4x2fv; - PFNGLVERTEXATTRIBI3IPROC VertexAttribI3i; - PFNGLGENSAMPLERSPROC GenSamplers; - PFNGLVERTEXATTRIBI2UIVPROC VertexAttribI2uiv; - PFNGLSTENCILOPSEPARATEPROC StencilOpSeparate; - PFNGLGETPROGRAMINTERFACEIVPROC GetProgramInterfaceiv; - PFNGLGETOBJECTPTRLABELPROC GetObjectPtrLabel; - PFNGLUNIFORMMATRIX2FVPROC UniformMatrix2fv; - PFNGLGETINTEGER64VPROC GetInteger64v; - PFNGLGETSTRINGPROC GetString; - PFNGLISSYNCPROC IsSync; - PFNGLCOPYTEXIMAGE1DPROC CopyTexImage1D; - PFNGLSAMPLERPARAMETERIIVPROC SamplerParameterIiv; - PFNGLVERTEXATTRIB3FVPROC VertexAttrib3fv; - PFNGLBEGINQUERYPROC BeginQuery; - PFNGLGETBUFFERPOINTERVPROC GetBufferPointerv; - PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer; - PFNGLGETSAMPLERPARAMETERIVPROC GetSamplerParameteriv; - PFNGLPOINTPARAMETERIPROC PointParameteri; - PFNGLPOLYGONMODEPROC PolygonMode; - PFNGLDRAWELEMENTSINDIRECTPROC DrawElementsIndirect; - PFNGLTEXIMAGE2DMULTISAMPLEPROC TexImage2DMultisample; - PFNGLVERTEXATTRIBL3DPROC VertexAttribL3d; - PFNGLPROGRAMUNIFORM4IPROC ProgramUniform4i; - PFNGLGETUNIFORMFVPROC GetUniformfv; - PFNGLDEBUGMESSAGECONTROLPROC DebugMessageControl; - PFNGLTEXPARAMETERIVPROC TexParameteriv; - PFNGLISBUFFERPROC IsBuffer; - PFNGLPROGRAMUNIFORMMATRIX3DVPROC ProgramUniformMatrix3dv; - PFNGLBINDFRAMEBUFFERPROC BindFramebuffer; - PFNGLBUFFERSTORAGEPROC BufferStorage; - PFNGLPROGRAMUNIFORM4FVPROC ProgramUniform4fv; - PFNGLBINDTEXTURESPROC BindTextures; - PFNGLCOMPRESSEDTEXIMAGE3DPROC CompressedTexImage3D; - PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC ProgramUniformMatrix4x2dv; - PFNGLPUSHDEBUGGROUPPROC PushDebugGroup; - PFNGLSAMPLERPARAMETERIVPROC SamplerParameteriv; - PFNGLVERTEXATTRIBI2IPROC VertexAttribI2i; - PFNGLBINDTRANSFORMFEEDBACKPROC BindTransformFeedback; - PFNGLGETRENDERBUFFERPARAMETERIVPROC GetRenderbufferParameteriv; - PFNGLUNIFORM2FVPROC Uniform2fv; - PFNGLVERTEXATTRIB1DVPROC VertexAttrib1dv; - PFNGLSAMPLERPARAMETERIPROC SamplerParameteri; - PFNGLTEXBUFFERRANGEPROC TexBufferRange; - PFNGLGETSHADERIVPROC GetShaderiv; - PFNGLSTENCILMASKPROC StencilMask; - PFNGLVERTEXATTRIB3FPROC VertexAttrib3f; - PFNGLGETPROGRAMPIPELINEIVPROC GetProgramPipelineiv; - PFNGLDELETEQUERIESPROC DeleteQueries; - PFNGLPROGRAMUNIFORM3UIVPROC ProgramUniform3uiv; - PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC ProgramUniformMatrix2x4fv; - PFNGLUNIFORM1FPROC Uniform1f; - PFNGLTEXSUBIMAGE1DPROC TexSubImage1D; - PFNGLCLEARBUFFERIVPROC ClearBufferiv; - PFNGLPROGRAMUNIFORM4UIVPROC ProgramUniform4uiv; - PFNGLINVALIDATETEXIMAGEPROC InvalidateTexImage; - PFNGLCLEARBUFFERSUBDATAPROC ClearBufferSubData; - PFNGLCLEARTEXIMAGEPROC ClearTexImage; - PFNGLVERTEXATTRIB4DPROC VertexAttrib4d; - PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC RenderbufferStorageMultisample; - PFNGLFRAMEBUFFERTEXTURELAYERPROC FramebufferTextureLayer; - PFNGLUNIFORM2FPROC Uniform2f; - PFNGLVERTEXATTRIBL4DPROC VertexAttribL4d; - PFNGLTEXIMAGE2DPROC TexImage2D; - PFNGLLOGICOPPROC LogicOp; - PFNGLBINDTEXTUREPROC BindTexture; - PFNGLVERTEXATTRIB1FVPROC VertexAttrib1fv; - PFNGLPROGRAMUNIFORMMATRIX3FVPROC ProgramUniformMatrix3fv; - PFNGLGETFRAGDATAINDEXPROC GetFragDataIndex; - PFNGLUNIFORMMATRIX2X3DVPROC UniformMatrix2x3dv; - PFNGLGETVERTEXATTRIBLDVPROC GetVertexAttribLdv; - PFNGLBINDRENDERBUFFERPROC BindRenderbuffer; - PFNGLUNIFORM1DPROC Uniform1d; - PFNGLUNIFORMMATRIX2X4FVPROC UniformMatrix2x4fv; - PFNGLMINSAMPLESHADINGPROC MinSampleShading; - PFNGLCOPYTEXSUBIMAGE1DPROC CopyTexSubImage1D; - PFNGLTEXIMAGE1DPROC TexImage1D; - PFNGLVERTEXATTRIB1FPROC VertexAttrib1f; - PFNGLLINEWIDTHPROC LineWidth; - PFNGLPOINTPARAMETERFPROC PointParameterf; - PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC DrawElementsInstancedBaseVertexBaseInstance; - PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC GetActiveSubroutineUniformiv; - PFNGLUNIFORM4UIPROC Uniform4ui; - PFNGLVERTEXATTRIBBINDINGPROC VertexAttribBinding; - PFNGLGETTEXPARAMETERIVPROC GetTexParameteriv; - PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage; - PFNGLVERTEXATTRIB4IVPROC VertexAttrib4iv; - PFNGLUNIFORMMATRIX3FVPROC UniformMatrix3fv; - PFNGLGETBOOLEANVPROC GetBooleanv; - PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC ProgramUniformMatrix2x3dv; - PFNGLPROGRAMUNIFORMMATRIX4DVPROC ProgramUniformMatrix4dv; - PFNGLUNIFORM2IVPROC Uniform2iv; - PFNGLBUFFERDATAPROC BufferData; - PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC GetActiveSubroutineUniformName; - PFNGLGETSTRINGIPROC GetStringi; - PFNGLBINDIMAGETEXTUREPROC BindImageTexture; - PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC ProgramUniformMatrix3x2dv; - PFNGLVERTEXATTRIBL4DVPROC VertexAttribL4dv; - PFNGLTEXSTORAGE3DMULTISAMPLEPROC TexStorage3DMultisample; - PFNGLDEPTHRANGEARRAYVPROC DepthRangeArrayv; - PFNGLGETUNIFORMIVPROC GetUniformiv; - PFNGLDELETETEXTURESPROC DeleteTextures; - PFNGLCREATESHADERPROC CreateShader; - PFNGLVERTEXATTRIB4SPROC VertexAttrib4s; - PFNGLPRIMITIVEBOUNDINGBOXPROC PrimitiveBoundingBox; - PFNGLDRAWBUFFERSPROC DrawBuffers; - PFNGLVERTEXATTRIB2DVPROC VertexAttrib2dv; - PFNGLTEXPARAMETERIUIVPROC TexParameterIuiv; - PFNGLQUERYCOUNTERPROC QueryCounter; - PFNGLVERTEXATTRIBL1DVPROC VertexAttribL1dv; - PFNGLPROGRAMUNIFORM1DPROC ProgramUniform1d; - PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers; - PFNGLPOPDEBUGGROUPPROC PopDebugGroup; - PFNGLMULTIDRAWARRAYSPROC MultiDrawArrays; - PFNGLGETACTIVEUNIFORMSIVPROC GetActiveUniformsiv; - PFNGLFLUSHPROC Flush; - PFNGLUNMAPBUFFERPROC UnmapBuffer; - PFNGLFRAMEBUFFERTEXTURE3DPROC FramebufferTexture3D; - PFNGLUNIFORM1FVPROC Uniform1fv; - PFNGLISFRAMEBUFFERPROC IsFramebuffer; - PFNGLVALIDATEPROGRAMPROC ValidateProgram; - PFNGLGETVERTEXATTRIBPOINTERVPROC GetVertexAttribPointerv; - PFNGLREADNPIXELSPROC ReadnPixels; - PFNGLVERTEXATTRIBP2UIPROC VertexAttribP2ui; - PFNGLPROGRAMUNIFORM2IPROC ProgramUniform2i; - PFNGLPATCHPARAMETERIPROC PatchParameteri; - PFNGLVERTEXATTRIB4NUBPROC VertexAttrib4Nub; - PFNGLGENQUERIESPROC GenQueries; - PFNGLPROGRAMUNIFORM2UIPROC ProgramUniform2ui; - PFNGLBINDSAMPLERSPROC BindSamplers; - PFNGLDISABLEVERTEXATTRIBARRAYPROC DisableVertexAttribArray; - PFNGLENABLEIPROC Enablei; - PFNGLGETSYNCIVPROC GetSynciv; - PFNGLVERTEXATTRIB3SPROC VertexAttrib3s; - PFNGLGETTEXPARAMETERIIVPROC GetTexParameterIiv; - PFNGLVERTEXBINDINGDIVISORPROC VertexBindingDivisor; - PFNGLDEPTHRANGEFPROC DepthRangef; - PFNGLVERTEXATTRIB4NUIVPROC VertexAttrib4Nuiv; - PFNGLFINISHPROC Finish; - PFNGLBLENDFUNCPROC BlendFunc; - PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC DrawTransformFeedbackStreamInstanced; - PFNGLUNIFORMMATRIX4X3FVPROC UniformMatrix4x3fv; - PFNGLUNIFORMMATRIX4X2DVPROC UniformMatrix4x2dv; - PFNGLUNIFORM2DPROC Uniform2d; - PFNGLGETNUNIFORMFVPROC GetnUniformfv; - PFNGLGETFLOATI_VPROC GetFloati_v; - PFNGLGETINTEGER64I_VPROC GetInteger64i_v; - PFNGLPROGRAMUNIFORM3FPROC ProgramUniform3f; - PFNGLGETFRAMEBUFFERPARAMETERIVPROC GetFramebufferParameteriv; - PFNGLVERTEXATTRIBI4BVPROC VertexAttribI4bv; - PFNGLDELETEPROGRAMPROC DeleteProgram; - PFNGLCOPYTEXIMAGE2DPROC CopyTexImage2D; - PFNGLGETUNIFORMUIVPROC GetUniformuiv; - PFNGLDRAWARRAYSINDIRECTPROC DrawArraysIndirect; - PFNGLUNIFORMMATRIX4X2FVPROC UniformMatrix4x2fv; - PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer; - PFNGLUNIFORM2IPROC Uniform2i; - PFNGLPROGRAMUNIFORM3DVPROC ProgramUniform3dv; - PFNGLSCISSORINDEXEDVPROC ScissorIndexedv; - PFNGLPROGRAMUNIFORM2DPROC ProgramUniform2d; - PFNGLVERTEXATTRIB4FPROC VertexAttrib4f; - PFNGLBLENDEQUATIONSEPARATEIPROC BlendEquationSeparatei; - PFNGLGETUNIFORMDVPROC GetUniformdv; - PFNGLDRAWRANGEELEMENTSPROC DrawRangeElements; - PFNGLUNIFORMMATRIX3DVPROC UniformMatrix3dv; - PFNGLPROGRAMUNIFORM2UIVPROC ProgramUniform2uiv; - PFNGLVERTEXATTRIBI1UIVPROC VertexAttribI1uiv; - PFNGLBEGINQUERYINDEXEDPROC BeginQueryIndexed; - PFNGLPOINTPARAMETERFVPROC PointParameterfv; - PFNGLSAMPLECOVERAGEPROC SampleCoverage; - PFNGLRESUMETRANSFORMFEEDBACKPROC ResumeTransformFeedback; - PFNGLREADPIXELSPROC ReadPixels; - PFNGLLINKPROGRAMPROC LinkProgram; - PFNGLWAITSYNCPROC WaitSync; - PFNGLACTIVESHADERPROGRAMPROC ActiveShaderProgram; - PFNGLGETQUERYOBJECTIVPROC GetQueryObjectiv; - PFNGLPROGRAMUNIFORM3IPROC ProgramUniform3i; - PFNGLPROGRAMUNIFORM1UIPROC ProgramUniform1ui; - PFNGLBLENDBARRIERPROC BlendBarrier; - PFNGLVERTEXATTRIBI4UBVPROC VertexAttribI4ubv; - PFNGLGETQUERYOBJECTI64VPROC GetQueryObjecti64v; - PFNGLUNIFORMMATRIX4DVPROC UniformMatrix4dv; - PFNGLUNIFORM1IVPROC Uniform1iv; - PFNGLENABLEPROC Enable; - PFNGLGENBUFFERSPROC GenBuffers; - PFNGLTEXSTORAGE3DPROC TexStorage3D; - PFNGLINVALIDATETEXSUBIMAGEPROC InvalidateTexSubImage; - PFNGLPROGRAMUNIFORM1IPROC ProgramUniform1i; - PFNGLBLENDEQUATIONPROC BlendEquation; - PFNGLDEPTHRANGEPROC DepthRange; - PFNGLUNIFORM2DVPROC Uniform2dv; - PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate; - PFNGLUNIFORM1DVPROC Uniform1dv; - PFNGLENDQUERYINDEXEDPROC EndQueryIndexed; - PFNGLDELETETRANSFORMFEEDBACKSPROC DeleteTransformFeedbacks; - PFNGLBLENDFUNCSEPARATEIPROC BlendFuncSeparatei; - PFNGLDEPTHFUNCPROC DepthFunc; - PFNGLINVALIDATEBUFFERDATAPROC InvalidateBufferData; - PFNGLBINDIMAGETEXTURESPROC BindImageTextures; - PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers; - PFNGLVERTEXATTRIBI2IVPROC VertexAttribI2iv; - PFNGLVERTEXATTRIB4SVPROC VertexAttrib4sv; - PFNGLVERTEXATTRIBFORMATPROC VertexAttribFormat; - PFNGLMAPBUFFERRANGEPROC MapBufferRange; - PFNGLDETACHSHADERPROC DetachShader; - PFNGLGETBOOLEANI_VPROC GetBooleani_v; - PFNGLDEPTHRANGEINDEXEDPROC DepthRangeIndexed; - PFNGLPAUSETRANSFORMFEEDBACKPROC PauseTransformFeedback; - PFNGLVERTEXATTRIBL3DVPROC VertexAttribL3dv; - PFNGLPRIMITIVERESTARTINDEXPROC PrimitiveRestartIndex; - PFNGLUNIFORM4DPROC Uniform4d; - PFNGLTRANSFORMFEEDBACKVARYINGSPROC TransformFeedbackVaryings; - PFNGLDELETEBUFFERSPROC DeleteBuffers; - PFNGLGETPROGRAMRESOURCELOCATIONPROC GetProgramResourceLocation; - PFNGLUNIFORM4FPROC Uniform4f; - PFNGLGETSAMPLERPARAMETERFVPROC GetSamplerParameterfv; - PFNGLVERTEXATTRIBP4UIPROC VertexAttribP4ui; - PFNGLISRENDERBUFFERPROC IsRenderbuffer; - PFNGLVERTEXATTRIB4NBVPROC VertexAttrib4Nbv; - PFNGLVERTEXATTRIB4NSVPROC VertexAttrib4Nsv; - PFNGLCULLFACEPROC CullFace; - PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC MultiDrawElementsBaseVertex; - PFNGLVERTEXATTRIBI3UIPROC VertexAttribI3ui; - PFNGLGETUNIFORMBLOCKINDEXPROC GetUniformBlockIndex; - PFNGLUSEPROGRAMSTAGESPROC UseProgramStages; - PFNGLGETACTIVEATTRIBPROC GetActiveAttrib; - PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC DrawArraysInstancedBaseInstance; - PFNGLISPROGRAMPIPELINEPROC IsProgramPipeline; - PFNGLPROGRAMUNIFORM1UIVPROC ProgramUniform1uiv; - PFNGLPROGRAMUNIFORM3IVPROC ProgramUniform3iv; - PFNGLREADBUFFERPROC ReadBuffer; - PFNGLDELETESHADERPROC DeleteShader; - PFNGLCREATESHADERPROGRAMVPROC CreateShaderProgramv; - PFNGLCLIENTWAITSYNCPROC ClientWaitSync; - PFNGLCOMPRESSEDTEXIMAGE1DPROC CompressedTexImage1D; - PFNGLVERTEXATTRIB2DPROC VertexAttrib2d; - PFNGLVERTEXATTRIB3DVPROC VertexAttrib3dv; - PFNGLVERTEXATTRIBI4IPROC VertexAttribI4i; - PFNGLVERTEXATTRIBL2DVPROC VertexAttribL2dv; - PFNGLGETDOUBLEI_VPROC GetDoublei_v; - PFNGLTEXPARAMETERFVPROC TexParameterfv; - PFNGLGETATTRIBLOCATIONPROC GetAttribLocation; - PFNGLVERTEXATTRIBP1UIPROC VertexAttribP1ui; - PFNGLVERTEXATTRIBIFORMATPROC VertexAttribIFormat; - PFNGLVERTEXATTRIBI1UIPROC VertexAttribI1ui; - PFNGLGETVERTEXATTRIBIVPROC GetVertexAttribiv; - PFNGLGETACTIVESUBROUTINENAMEPROC GetActiveSubroutineName; - PFNGLISQUERYPROC IsQuery; - PFNGLVERTEXATTRIB1SVPROC VertexAttrib1sv; - PFNGLPROGRAMUNIFORMMATRIX2FVPROC ProgramUniformMatrix2fv; - PFNGLUSEPROGRAMPROC UseProgram; - PFNGLCLEARPROC Clear; - PFNGLVERTEXATTRIB4UBVPROC VertexAttrib4ubv; - PFNGLINVALIDATEFRAMEBUFFERPROC InvalidateFramebuffer; - PFNGLPIXELSTOREIPROC PixelStorei; - PFNGLUNIFORM1IPROC Uniform1i; - PFNGLUNIFORM1UIVPROC Uniform1uiv; - PFNGLTEXIMAGE3DMULTISAMPLEPROC TexImage3DMultisample; - PFNGLBINDBUFFERPROC BindBuffer; - PFNGLACTIVETEXTUREPROC ActiveTexture; - PFNGLDELETESYNCPROC DeleteSync; - PFNGLVERTEXATTRIB4NIVPROC VertexAttrib4Niv; - PFNGLVERTEXATTRIB4UIVPROC VertexAttrib4uiv; - PFNGLUNIFORM3FVPROC Uniform3fv; - PFNGLGENVERTEXARRAYSPROC GenVertexArrays; - PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC ProgramUniformMatrix3x2fv; - PFNGLBINDATTRIBLOCATIONPROC BindAttribLocation; - PFNGLCOPYTEXSUBIMAGE2DPROC CopyTexSubImage2D; - PFNGLBLENDCOLORPROC BlendColor; - PFNGLRELEASESHADERCOMPILERPROC ReleaseShaderCompiler; - PFNGLGENTRANSFORMFEEDBACKSPROC GenTransformFeedbacks; - PFNGLISSHADERPROC IsShader; - PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC DrawElementsInstancedBaseVertex; - PFNGLVERTEXATTRIBLFORMATPROC VertexAttribLFormat; - PFNGLBINDBUFFERSRANGEPROC BindBuffersRange; - PFNGLCOLORMASKPROC ColorMask; - PFNGLUNIFORMMATRIX2X4DVPROC UniformMatrix2x4dv; - PFNGLGETDOUBLEVPROC GetDoublev; - PFNGLUNIFORMMATRIX3X2DVPROC UniformMatrix3x2dv; - PFNGLVERTEXATTRIBL2DPROC VertexAttribL2d; - PFNGLFLUSHMAPPEDBUFFERRANGEPROC FlushMappedBufferRange; - PFNGLPROGRAMUNIFORM2IVPROC ProgramUniform2iv; - PFNGLPOINTPARAMETERIVPROC PointParameteriv; - PFNGLUNIFORMSUBROUTINESUIVPROC UniformSubroutinesuiv; - PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC ProgramUniformMatrix4x3fv; - PFNGLGETBUFFERPARAMETERIVPROC GetBufferParameteriv; - PFNGLGETTEXIMAGEPROC GetTexImage; - PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC ProgramUniformMatrix2x4dv; - PFNGLVERTEXATTRIBI1IVPROC VertexAttribI1iv; - PFNGLISSAMPLERPROC IsSampler; - PFNGLGETVERTEXATTRIBFVPROC GetVertexAttribfv; - PFNGLTEXSTORAGE1DPROC TexStorage1D; - PFNGLVIEWPORTARRAYVPROC ViewportArrayv; - PFNGLTEXIMAGE3DPROC TexImage3D; - PFNGLPROGRAMUNIFORMMATRIX4FVPROC ProgramUniformMatrix4fv; - PFNGLGETTEXLEVELPARAMETERIVPROC GetTexLevelParameteriv; - PFNGLGETVERTEXATTRIBDVPROC GetVertexAttribdv; - PFNGLINVALIDATEBUFFERSUBDATAPROC InvalidateBufferSubData; - PFNGLPROGRAMUNIFORM4FPROC ProgramUniform4f; - PFNGLVERTEXATTRIB2SPROC VertexAttrib2s; - PFNGLTEXSUBIMAGE3DPROC TexSubImage3D; - PFNGLGETFRAGDATALOCATIONPROC GetFragDataLocation; - PFNGLVERTEXATTRIBI1IPROC VertexAttribI1i; - PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC GetActiveAtomicCounterBufferiv; - PFNGLTEXSTORAGE2DMULTISAMPLEPROC TexStorage2DMultisample; - PFNGLBINDBUFFERSBASEPROC BindBuffersBase; - PFNGLGETUNIFORMSUBROUTINEUIVPROC GetUniformSubroutineuiv; - PFNGLENDTRANSFORMFEEDBACKPROC EndTransformFeedback; - PFNGLSHADERSOURCEPROC ShaderSource; - PFNGLGETQUERYOBJECTUIVPROC GetQueryObjectuiv; - PFNGLGETTEXLEVELPARAMETERFVPROC GetTexLevelParameterfv; - PFNGLUNIFORM3DPROC Uniform3d; - PFNGLCLEARBUFFERFVPROC ClearBufferfv; - PFNGLGETSAMPLERPARAMETERIIVPROC GetSamplerParameterIiv; - PFNGLMEMORYBARRIERBYREGIONPROC MemoryBarrierByRegion; - PFNGLGENPROGRAMPIPELINESPROC GenProgramPipelines; - PFNGLBINDFRAGDATALOCATIONPROC BindFragDataLocation; - PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog; - PFNGLTEXTUREVIEWPROC TextureView; - PFNGLISENABLEDPROC IsEnabled; - PFNGLPATCHPARAMETERFVPROC PatchParameterfv; - PFNGLHINTPROC Hint; - PFNGLPIXELSTOREFPROC PixelStoref; - PFNGLPROGRAMUNIFORM4IVPROC ProgramUniform4iv; - PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate; - PFNGLCLEARBUFFERUIVPROC ClearBufferuiv; - PFNGLOBJECTLABELPROC ObjectLabel; - PFNGLGETPOINTERVPROC GetPointerv; - PFNGLDELETESAMPLERSPROC DeleteSamplers; - PFNGLPROGRAMUNIFORM2DVPROC ProgramUniform2dv; - PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray; - PFNGLCLAMPCOLORPROC ClampColor; - PFNGLGETSHADERPRECISIONFORMATPROC GetShaderPrecisionFormat; - PFNGLGETNUNIFORMIVPROC GetnUniformiv; - PFNGLUNIFORM3IVPROC Uniform3iv; - PFNGLVERTEXATTRIBI3UIVPROC VertexAttribI3uiv; - PFNGLBUFFERSUBDATAPROC BufferSubData; - PFNGLSAMPLERPARAMETERFVPROC SamplerParameterfv; - PFNGLVERTEXATTRIBI4SVPROC VertexAttribI4sv; - PFNGLTEXBUFFERPROC TexBuffer; - PFNGLCREATEPROGRAMPROC CreateProgram; - PFNGLBINDBUFFERRANGEPROC BindBufferRange; - PFNGLISTEXTUREPROC IsTexture; - PFNGLUNIFORMMATRIX3X2FVPROC UniformMatrix3x2fv; - PFNGLDRAWELEMENTSPROC DrawElements; - PFNGLPROGRAMUNIFORM1FPROC ProgramUniform1f; - PFNGLUNIFORM3DVPROC Uniform3dv; - PFNGLDRAWELEMENTSINSTANCEDPROC DrawElementsInstanced; - PFNGLGENERATEMIPMAPPROC GenerateMipmap; - PFNGLPROGRAMUNIFORM4UIPROC ProgramUniform4ui; - PFNGLGETVERTEXATTRIBIUIVPROC GetVertexAttribIuiv; - PFNGLCLEARDEPTHPROC ClearDepth; - PFNGLDRAWTRANSFORMFEEDBACKPROC DrawTransformFeedback; - PFNGLTEXSUBIMAGE2DPROC TexSubImage2D; - PFNGLVERTEXATTRIBP4UIVPROC VertexAttribP4uiv; - PFNGLGETTEXPARAMETERIUIVPROC GetTexParameterIuiv; - PFNGLPOINTSIZEPROC PointSize; - PFNGLGETCOMPRESSEDTEXIMAGEPROC GetCompressedTexImage; - PFNGLUNIFORM2UIVPROC Uniform2uiv; - PFNGLFENCESYNCPROC FenceSync; - PFNGLMAPBUFFERPROC MapBuffer; - PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC GetFramebufferAttachmentParameteriv; - PFNGLBEGINTRANSFORMFEEDBACKPROC BeginTransformFeedback; - PFNGLTEXPARAMETERIPROC TexParameteri; - PFNGLGETTEXPARAMETERFVPROC GetTexParameterfv; - PFNGLVERTEXATTRIBL1DPROC VertexAttribL1d; - PFNGLVERTEXATTRIB4NUSVPROC VertexAttrib4Nusv; - PFNGLPROGRAMUNIFORM2FPROC ProgramUniform2f; - PFNGLVERTEXATTRIB1DPROC VertexAttrib1d; - PFNGLGETERRORPROC GetError; - PFNGLVERTEXATTRIBP2UIVPROC VertexAttribP2uiv; - PFNGLUNIFORMMATRIX4X3DVPROC UniformMatrix4x3dv; - PFNGLGETSHADERSOURCEPROC GetShaderSource; - PFNGLSTENCILFUNCSEPARATEPROC StencilFuncSeparate; - PFNGLFRAMEBUFFERTEXTUREPROC FramebufferTexture; - PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC ProgramUniformMatrix4x3dv; - PFNGLUNIFORM4DVPROC Uniform4dv; - PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog; - PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC ProgramUniformMatrix3x4dv; - PFNGLUNIFORMMATRIX3X4FVPROC UniformMatrix3x4fv; - PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC CompressedTexSubImage3D; - PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC DrawElementsInstancedBaseInstance; - PFNGLBINDBUFFERBASEPROC BindBufferBase; - PFNGLUNIFORMMATRIX2DVPROC UniformMatrix2dv; - PFNGLGETTRANSFORMFEEDBACKVARYINGPROC GetTransformFeedbackVarying; - PFNGLCOMPRESSEDTEXIMAGE2DPROC CompressedTexImage2D; - PFNGLGETUNIFORMINDICESPROC GetUniformIndices; - PFNGLTEXSTORAGE2DPROC TexStorage2D; - PFNGLVERTEXATTRIB4USVPROC VertexAttrib4usv; - PFNGLGETACTIVEUNIFORMBLOCKIVPROC GetActiveUniformBlockiv; - PFNGLCOPYIMAGESUBDATAPROC CopyImageSubData; - PFNGLVERTEXATTRIBI4UIPROC VertexAttribI4ui; - PFNGLVERTEXATTRIB4FVPROC VertexAttrib4fv; - PFNGLPROGRAMUNIFORM1IVPROC ProgramUniform1iv; - PFNGLBINDVERTEXBUFFERSPROC BindVertexBuffers; - PFNGLPROVOKINGVERTEXPROC ProvokingVertex; - PFNGLUNIFORM3UIVPROC Uniform3uiv; - PFNGLISVERTEXARRAYPROC IsVertexArray; - PFNGLVIEWPORTINDEXEDFVPROC ViewportIndexedfv; - PFNGLDISPATCHCOMPUTEPROC DispatchCompute; - PFNGLDRAWARRAYSPROC DrawArrays; - PFNGLGETQUERYINDEXEDIVPROC GetQueryIndexediv; - PFNGLUNIFORM3UIPROC Uniform3ui; - PFNGLMULTIDRAWELEMENTSPROC MultiDrawElements; - PFNGLCLEARBUFFERFIPROC ClearBufferfi; - PFNGLPROGRAMUNIFORMMATRIX2DVPROC ProgramUniformMatrix2dv; - PFNGLVERTEXATTRIBP3UIPROC VertexAttribP3ui; - PFNGLVERTEXATTRIBI3IVPROC VertexAttribI3iv; - PFNGLPROGRAMPARAMETERIPROC ProgramParameteri; - PFNGLUNIFORM4UIVPROC Uniform4uiv; - PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv; - PFNGLVERTEXATTRIB2FVPROC VertexAttrib2fv; - PFNGLGETGRAPHICSRESETSTATUSPROC GetGraphicsResetStatus; - PFNGLSHADERBINARYPROC ShaderBinary; - PFNGLSHADERSTORAGEBLOCKBINDINGPROC ShaderStorageBlockBinding; - PFNGLDRAWARRAYSINSTANCEDPROC DrawArraysInstanced; - PFNGLGETSUBROUTINEINDEXPROC GetSubroutineIndex; - PFNGLGETVERTEXATTRIBIIVPROC GetVertexAttribIiv; - PFNGLDRAWELEMENTSBASEVERTEXPROC DrawElementsBaseVertex; - PFNGLGETPROGRAMRESOURCENAMEPROC GetProgramResourceName; - PFNGLGETINTERNALFORMATIVPROC GetInternalformativ; - PFNGLUNIFORM4FVPROC Uniform4fv; - PFNGLVERTEXATTRIBLPOINTERPROC VertexAttribLPointer; - PFNGLGETSAMPLERPARAMETERIUIVPROC GetSamplerParameterIuiv; - PFNGLVERTEXATTRIB3DPROC VertexAttrib3d; - PFNGLSAMPLERPARAMETERFPROC SamplerParameterf; - PFNGLGENFRAMEBUFFERSPROC GenFramebuffers; - PFNGLGETQUERYOBJECTUI64VPROC GetQueryObjectui64v; - PFNGLGETPROGRAMRESOURCEIVPROC GetProgramResourceiv; - PFNGLVERTEXATTRIBP3UIVPROC VertexAttribP3uiv; - PFNGLVERTEXATTRIB4DVPROC VertexAttrib4dv; - PFNGLISTRANSFORMFEEDBACKPROC IsTransformFeedback; - PFNGLDISPATCHCOMPUTEINDIRECTPROC DispatchComputeIndirect; - PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC CompressedTexSubImage2D; - PFNGLBINDVERTEXBUFFERPROC BindVertexBuffer; - PFNGLPROGRAMUNIFORM1DVPROC ProgramUniform1dv; - PFNGLSTENCILOPPROC StencilOp; - PFNGLVERTEXATTRIB1SPROC VertexAttrib1s; - PFNGLGETMULTISAMPLEFVPROC GetMultisamplefv; - PFNGLGETQUERYIVPROC GetQueryiv; - PFNGLBINDPROGRAMPIPELINEPROC BindProgramPipeline; - PFNGLFRAMEBUFFERPARAMETERIPROC FramebufferParameteri; - PFNGLGETINTEGERI_VPROC GetIntegeri_v; - PFNGLGETINTEGERVPROC GetIntegerv; - PFNGLDELETEPROGRAMPIPELINESPROC DeleteProgramPipelines; - PFNGLCLEARBUFFERDATAPROC ClearBufferData; - PFNGLPROGRAMUNIFORM2FVPROC ProgramUniform2fv; - PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC GetSubroutineUniformLocation; - PFNGLGETPROGRAMIVPROC GetProgramiv; - PFNGLDEPTHMASKPROC DepthMask; - PFNGLVERTEXATTRIBIPOINTERPROC VertexAttribIPointer; - PFNGLGETACTIVEUNIFORMNAMEPROC GetActiveUniformName; - PFNGLVERTEXATTRIBP1UIVPROC VertexAttribP1uiv; - PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC ProgramUniformMatrix2x3fv; - PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation; - PFNGLSAMPLEMASKIPROC SampleMaski; - PFNGLGETBUFFERSUBDATAPROC GetBufferSubData; - PFNGLUNIFORM4IVPROC Uniform4iv; - PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer; - PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D; - PFNGLGETNUNIFORMUIVPROC GetnUniformuiv; - PFNGLGETINTERNALFORMATI64VPROC GetInternalformati64v; - PFNGLCOMPILESHADERPROC CompileShader; - PFNGLDRAWBUFFERPROC DrawBuffer; - PFNGLUNIFORM3FPROC Uniform3f; - PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC DrawTransformFeedbackInstanced; - PFNGLPROGRAMUNIFORM4DVPROC ProgramUniform4dv; - PFNGLGETPROGRAMSTAGEIVPROC GetProgramStageiv; - PFNGLSTENCILFUNCPROC StencilFunc; - PFNGLGETPROGRAMRESOURCEINDEXPROC GetProgramResourceIndex; - PFNGLCLEARSTENCILPROC ClearStencil; - PFNGLSCISSORARRAYVPROC ScissorArrayv; - PFNGLMEMORYBARRIERPROC MemoryBarrier; - PFNGLSAMPLERPARAMETERIUIVPROC SamplerParameterIuiv; - PFNGLGETFLOATVPROC GetFloatv; - PFNGLBINDFRAGDATALOCATIONINDEXEDPROC BindFragDataLocationIndexed; - PFNGLENDQUERYPROC EndQuery; - PFNGLVERTEXATTRIB4NUBVPROC VertexAttrib4Nubv; - PFNGLGETPROGRAMPIPELINEINFOLOGPROC GetProgramPipelineInfoLog; - PFNGLVERTEXATTRIBDIVISORPROC VertexAttribDivisor; - PFNGLUNIFORM3IPROC Uniform3i; - PFNGLUNIFORM2UIPROC Uniform2ui; - PFNGLINVALIDATESUBFRAMEBUFFERPROC InvalidateSubFramebuffer; - PFNGLGETDEBUGMESSAGELOGPROC GetDebugMessageLog; -} mg_gl_api; - -MP_API mg_gl_api* mg_gl_get_api(void); - -#define glGetProgramBinary mg_gl_get_api()->GetProgramBinary -#define glFrontFace mg_gl_get_api()->FrontFace -#define glDisablei mg_gl_get_api()->Disablei -#define glBeginConditionalRender mg_gl_get_api()->BeginConditionalRender -#define glCopyTexSubImage3D mg_gl_get_api()->CopyTexSubImage3D -#define glCompressedTexSubImage1D mg_gl_get_api()->CompressedTexSubImage1D -#define glVertexAttribI4usv mg_gl_get_api()->VertexAttribI4usv -#define glVertexAttrib2sv mg_gl_get_api()->VertexAttrib2sv -#define glUniformMatrix2x3fv mg_gl_get_api()->UniformMatrix2x3fv -#define glMultiDrawArraysIndirect mg_gl_get_api()->MultiDrawArraysIndirect -#define glColorMaski mg_gl_get_api()->ColorMaski -#define glBindVertexArray mg_gl_get_api()->BindVertexArray -#define glProgramUniform3d mg_gl_get_api()->ProgramUniform3d -#define glGetBufferParameteri64v mg_gl_get_api()->GetBufferParameteri64v -#define glUniform4i mg_gl_get_api()->Uniform4i -#define glGetAttachedShaders mg_gl_get_api()->GetAttachedShaders -#define glAttachShader mg_gl_get_api()->AttachShader -#define glVertexAttribI2ui mg_gl_get_api()->VertexAttribI2ui -#define glClearColor mg_gl_get_api()->ClearColor -#define glTexParameterIiv mg_gl_get_api()->TexParameterIiv -#define glProgramUniform4d mg_gl_get_api()->ProgramUniform4d -#define glDrawTransformFeedbackStream mg_gl_get_api()->DrawTransformFeedbackStream -#define glVertexAttribI4iv mg_gl_get_api()->VertexAttribI4iv -#define glCopyBufferSubData mg_gl_get_api()->CopyBufferSubData -#define glDebugMessageInsert mg_gl_get_api()->DebugMessageInsert -#define glViewportIndexedf mg_gl_get_api()->ViewportIndexedf -#define glProgramUniform1fv mg_gl_get_api()->ProgramUniform1fv -#define glObjectPtrLabel mg_gl_get_api()->ObjectPtrLabel -#define glStencilMaskSeparate mg_gl_get_api()->StencilMaskSeparate -#define glUniformMatrix3x4dv mg_gl_get_api()->UniformMatrix3x4dv -#define glFramebufferTexture1D mg_gl_get_api()->FramebufferTexture1D -#define glViewport mg_gl_get_api()->Viewport -#define glGenTextures mg_gl_get_api()->GenTextures -#define glUniformBlockBinding mg_gl_get_api()->UniformBlockBinding -#define glVertexAttrib3sv mg_gl_get_api()->VertexAttrib3sv -#define glProgramUniformMatrix3x4fv mg_gl_get_api()->ProgramUniformMatrix3x4fv -#define glVertexAttrib2f mg_gl_get_api()->VertexAttrib2f -#define glGetActiveUniform mg_gl_get_api()->GetActiveUniform -#define glScissorIndexed mg_gl_get_api()->ScissorIndexed -#define glTexParameterf mg_gl_get_api()->TexParameterf -#define glBindSampler mg_gl_get_api()->BindSampler -#define glMultiDrawElementsIndirect mg_gl_get_api()->MultiDrawElementsIndirect -#define glClearTexSubImage mg_gl_get_api()->ClearTexSubImage -#define glIsEnabledi mg_gl_get_api()->IsEnabledi -#define glScissor mg_gl_get_api()->Scissor -#define glProgramBinary mg_gl_get_api()->ProgramBinary -#define glDisable mg_gl_get_api()->Disable -#define glGetActiveUniformBlockName mg_gl_get_api()->GetActiveUniformBlockName -#define glDrawRangeElementsBaseVertex mg_gl_get_api()->DrawRangeElementsBaseVertex -#define glDebugMessageCallback mg_gl_get_api()->DebugMessageCallback -#define glBlendEquationi mg_gl_get_api()->BlendEquationi -#define glVertexAttribI4uiv mg_gl_get_api()->VertexAttribI4uiv -#define glBlendFunci mg_gl_get_api()->BlendFunci -#define glValidateProgramPipeline mg_gl_get_api()->ValidateProgramPipeline -#define glDeleteVertexArrays mg_gl_get_api()->DeleteVertexArrays -#define glGenRenderbuffers mg_gl_get_api()->GenRenderbuffers -#define glCheckFramebufferStatus mg_gl_get_api()->CheckFramebufferStatus -#define glUniform1ui mg_gl_get_api()->Uniform1ui -#define glProgramUniform3ui mg_gl_get_api()->ProgramUniform3ui -#define glVertexAttrib4bv mg_gl_get_api()->VertexAttrib4bv -#define glGetProgramResourceLocationIndex mg_gl_get_api()->GetProgramResourceLocationIndex -#define glProgramUniform3fv mg_gl_get_api()->ProgramUniform3fv -#define glPolygonOffset mg_gl_get_api()->PolygonOffset -#define glIsProgram mg_gl_get_api()->IsProgram -#define glClearDepthf mg_gl_get_api()->ClearDepthf -#define glEndConditionalRender mg_gl_get_api()->EndConditionalRender -#define glGetObjectLabel mg_gl_get_api()->GetObjectLabel -#define glProgramUniformMatrix4x2fv mg_gl_get_api()->ProgramUniformMatrix4x2fv -#define glVertexAttribI3i mg_gl_get_api()->VertexAttribI3i -#define glGenSamplers mg_gl_get_api()->GenSamplers -#define glVertexAttribI2uiv mg_gl_get_api()->VertexAttribI2uiv -#define glStencilOpSeparate mg_gl_get_api()->StencilOpSeparate -#define glGetProgramInterfaceiv mg_gl_get_api()->GetProgramInterfaceiv -#define glGetObjectPtrLabel mg_gl_get_api()->GetObjectPtrLabel -#define glUniformMatrix2fv mg_gl_get_api()->UniformMatrix2fv -#define glGetInteger64v mg_gl_get_api()->GetInteger64v -#define glGetString mg_gl_get_api()->GetString -#define glIsSync mg_gl_get_api()->IsSync -#define glCopyTexImage1D mg_gl_get_api()->CopyTexImage1D -#define glSamplerParameterIiv mg_gl_get_api()->SamplerParameterIiv -#define glVertexAttrib3fv mg_gl_get_api()->VertexAttrib3fv -#define glBeginQuery mg_gl_get_api()->BeginQuery -#define glGetBufferPointerv mg_gl_get_api()->GetBufferPointerv -#define glBlitFramebuffer mg_gl_get_api()->BlitFramebuffer -#define glGetSamplerParameteriv mg_gl_get_api()->GetSamplerParameteriv -#define glPointParameteri mg_gl_get_api()->PointParameteri -#define glPolygonMode mg_gl_get_api()->PolygonMode -#define glDrawElementsIndirect mg_gl_get_api()->DrawElementsIndirect -#define glTexImage2DMultisample mg_gl_get_api()->TexImage2DMultisample -#define glVertexAttribL3d mg_gl_get_api()->VertexAttribL3d -#define glProgramUniform4i mg_gl_get_api()->ProgramUniform4i -#define glGetUniformfv mg_gl_get_api()->GetUniformfv -#define glDebugMessageControl mg_gl_get_api()->DebugMessageControl -#define glTexParameteriv mg_gl_get_api()->TexParameteriv -#define glIsBuffer mg_gl_get_api()->IsBuffer -#define glProgramUniformMatrix3dv mg_gl_get_api()->ProgramUniformMatrix3dv -#define glBindFramebuffer mg_gl_get_api()->BindFramebuffer -#define glBufferStorage mg_gl_get_api()->BufferStorage -#define glProgramUniform4fv mg_gl_get_api()->ProgramUniform4fv -#define glBindTextures mg_gl_get_api()->BindTextures -#define glCompressedTexImage3D mg_gl_get_api()->CompressedTexImage3D -#define glProgramUniformMatrix4x2dv mg_gl_get_api()->ProgramUniformMatrix4x2dv -#define glPushDebugGroup mg_gl_get_api()->PushDebugGroup -#define glSamplerParameteriv mg_gl_get_api()->SamplerParameteriv -#define glVertexAttribI2i mg_gl_get_api()->VertexAttribI2i -#define glBindTransformFeedback mg_gl_get_api()->BindTransformFeedback -#define glGetRenderbufferParameteriv mg_gl_get_api()->GetRenderbufferParameteriv -#define glUniform2fv mg_gl_get_api()->Uniform2fv -#define glVertexAttrib1dv mg_gl_get_api()->VertexAttrib1dv -#define glSamplerParameteri mg_gl_get_api()->SamplerParameteri -#define glTexBufferRange mg_gl_get_api()->TexBufferRange -#define glGetShaderiv mg_gl_get_api()->GetShaderiv -#define glStencilMask mg_gl_get_api()->StencilMask -#define glVertexAttrib3f mg_gl_get_api()->VertexAttrib3f -#define glGetProgramPipelineiv mg_gl_get_api()->GetProgramPipelineiv -#define glDeleteQueries mg_gl_get_api()->DeleteQueries -#define glProgramUniform3uiv mg_gl_get_api()->ProgramUniform3uiv -#define glProgramUniformMatrix2x4fv mg_gl_get_api()->ProgramUniformMatrix2x4fv -#define glUniform1f mg_gl_get_api()->Uniform1f -#define glTexSubImage1D mg_gl_get_api()->TexSubImage1D -#define glClearBufferiv mg_gl_get_api()->ClearBufferiv -#define glProgramUniform4uiv mg_gl_get_api()->ProgramUniform4uiv -#define glInvalidateTexImage mg_gl_get_api()->InvalidateTexImage -#define glClearBufferSubData mg_gl_get_api()->ClearBufferSubData -#define glClearTexImage mg_gl_get_api()->ClearTexImage -#define glVertexAttrib4d mg_gl_get_api()->VertexAttrib4d -#define glRenderbufferStorageMultisample mg_gl_get_api()->RenderbufferStorageMultisample -#define glFramebufferTextureLayer mg_gl_get_api()->FramebufferTextureLayer -#define glUniform2f mg_gl_get_api()->Uniform2f -#define glVertexAttribL4d mg_gl_get_api()->VertexAttribL4d -#define glTexImage2D mg_gl_get_api()->TexImage2D -#define glLogicOp mg_gl_get_api()->LogicOp -#define glBindTexture mg_gl_get_api()->BindTexture -#define glVertexAttrib1fv mg_gl_get_api()->VertexAttrib1fv -#define glProgramUniformMatrix3fv mg_gl_get_api()->ProgramUniformMatrix3fv -#define glGetFragDataIndex mg_gl_get_api()->GetFragDataIndex -#define glUniformMatrix2x3dv mg_gl_get_api()->UniformMatrix2x3dv -#define glGetVertexAttribLdv mg_gl_get_api()->GetVertexAttribLdv -#define glBindRenderbuffer mg_gl_get_api()->BindRenderbuffer -#define glUniform1d mg_gl_get_api()->Uniform1d -#define glUniformMatrix2x4fv mg_gl_get_api()->UniformMatrix2x4fv -#define glMinSampleShading mg_gl_get_api()->MinSampleShading -#define glCopyTexSubImage1D mg_gl_get_api()->CopyTexSubImage1D -#define glTexImage1D mg_gl_get_api()->TexImage1D -#define glVertexAttrib1f mg_gl_get_api()->VertexAttrib1f -#define glLineWidth mg_gl_get_api()->LineWidth -#define glPointParameterf mg_gl_get_api()->PointParameterf -#define glDrawElementsInstancedBaseVertexBaseInstance mg_gl_get_api()->DrawElementsInstancedBaseVertexBaseInstance -#define glGetActiveSubroutineUniformiv mg_gl_get_api()->GetActiveSubroutineUniformiv -#define glUniform4ui mg_gl_get_api()->Uniform4ui -#define glVertexAttribBinding mg_gl_get_api()->VertexAttribBinding -#define glGetTexParameteriv mg_gl_get_api()->GetTexParameteriv -#define glRenderbufferStorage mg_gl_get_api()->RenderbufferStorage -#define glVertexAttrib4iv mg_gl_get_api()->VertexAttrib4iv -#define glUniformMatrix3fv mg_gl_get_api()->UniformMatrix3fv -#define glGetBooleanv mg_gl_get_api()->GetBooleanv -#define glProgramUniformMatrix2x3dv mg_gl_get_api()->ProgramUniformMatrix2x3dv -#define glProgramUniformMatrix4dv mg_gl_get_api()->ProgramUniformMatrix4dv -#define glUniform2iv mg_gl_get_api()->Uniform2iv -#define glBufferData mg_gl_get_api()->BufferData -#define glGetActiveSubroutineUniformName mg_gl_get_api()->GetActiveSubroutineUniformName -#define glGetStringi mg_gl_get_api()->GetStringi -#define glBindImageTexture mg_gl_get_api()->BindImageTexture -#define glProgramUniformMatrix3x2dv mg_gl_get_api()->ProgramUniformMatrix3x2dv -#define glVertexAttribL4dv mg_gl_get_api()->VertexAttribL4dv -#define glTexStorage3DMultisample mg_gl_get_api()->TexStorage3DMultisample -#define glDepthRangeArrayv mg_gl_get_api()->DepthRangeArrayv -#define glGetUniformiv mg_gl_get_api()->GetUniformiv -#define glDeleteTextures mg_gl_get_api()->DeleteTextures -#define glCreateShader mg_gl_get_api()->CreateShader -#define glVertexAttrib4s mg_gl_get_api()->VertexAttrib4s -#define glPrimitiveBoundingBox mg_gl_get_api()->PrimitiveBoundingBox -#define glDrawBuffers mg_gl_get_api()->DrawBuffers -#define glVertexAttrib2dv mg_gl_get_api()->VertexAttrib2dv -#define glTexParameterIuiv mg_gl_get_api()->TexParameterIuiv -#define glQueryCounter mg_gl_get_api()->QueryCounter -#define glVertexAttribL1dv mg_gl_get_api()->VertexAttribL1dv -#define glProgramUniform1d mg_gl_get_api()->ProgramUniform1d -#define glDeleteRenderbuffers mg_gl_get_api()->DeleteRenderbuffers -#define glPopDebugGroup mg_gl_get_api()->PopDebugGroup -#define glMultiDrawArrays mg_gl_get_api()->MultiDrawArrays -#define glGetActiveUniformsiv mg_gl_get_api()->GetActiveUniformsiv -#define glFlush mg_gl_get_api()->Flush -#define glUnmapBuffer mg_gl_get_api()->UnmapBuffer -#define glFramebufferTexture3D mg_gl_get_api()->FramebufferTexture3D -#define glUniform1fv mg_gl_get_api()->Uniform1fv -#define glIsFramebuffer mg_gl_get_api()->IsFramebuffer -#define glValidateProgram mg_gl_get_api()->ValidateProgram -#define glGetVertexAttribPointerv mg_gl_get_api()->GetVertexAttribPointerv -#define glReadnPixels mg_gl_get_api()->ReadnPixels -#define glVertexAttribP2ui mg_gl_get_api()->VertexAttribP2ui -#define glProgramUniform2i mg_gl_get_api()->ProgramUniform2i -#define glPatchParameteri mg_gl_get_api()->PatchParameteri -#define glVertexAttrib4Nub mg_gl_get_api()->VertexAttrib4Nub -#define glGenQueries mg_gl_get_api()->GenQueries -#define glProgramUniform2ui mg_gl_get_api()->ProgramUniform2ui -#define glBindSamplers mg_gl_get_api()->BindSamplers -#define glDisableVertexAttribArray mg_gl_get_api()->DisableVertexAttribArray -#define glEnablei mg_gl_get_api()->Enablei -#define glGetSynciv mg_gl_get_api()->GetSynciv -#define glVertexAttrib3s mg_gl_get_api()->VertexAttrib3s -#define glGetTexParameterIiv mg_gl_get_api()->GetTexParameterIiv -#define glVertexBindingDivisor mg_gl_get_api()->VertexBindingDivisor -#define glDepthRangef mg_gl_get_api()->DepthRangef -#define glVertexAttrib4Nuiv mg_gl_get_api()->VertexAttrib4Nuiv -#define glFinish mg_gl_get_api()->Finish -#define glBlendFunc mg_gl_get_api()->BlendFunc -#define glDrawTransformFeedbackStreamInstanced mg_gl_get_api()->DrawTransformFeedbackStreamInstanced -#define glUniformMatrix4x3fv mg_gl_get_api()->UniformMatrix4x3fv -#define glUniformMatrix4x2dv mg_gl_get_api()->UniformMatrix4x2dv -#define glUniform2d mg_gl_get_api()->Uniform2d -#define glGetnUniformfv mg_gl_get_api()->GetnUniformfv -#define glGetFloati_v mg_gl_get_api()->GetFloati_v -#define glGetInteger64i_v mg_gl_get_api()->GetInteger64i_v -#define glProgramUniform3f mg_gl_get_api()->ProgramUniform3f -#define glGetFramebufferParameteriv mg_gl_get_api()->GetFramebufferParameteriv -#define glVertexAttribI4bv mg_gl_get_api()->VertexAttribI4bv -#define glDeleteProgram mg_gl_get_api()->DeleteProgram -#define glCopyTexImage2D mg_gl_get_api()->CopyTexImage2D -#define glGetUniformuiv mg_gl_get_api()->GetUniformuiv -#define glDrawArraysIndirect mg_gl_get_api()->DrawArraysIndirect -#define glUniformMatrix4x2fv mg_gl_get_api()->UniformMatrix4x2fv -#define glFramebufferRenderbuffer mg_gl_get_api()->FramebufferRenderbuffer -#define glUniform2i mg_gl_get_api()->Uniform2i -#define glProgramUniform3dv mg_gl_get_api()->ProgramUniform3dv -#define glScissorIndexedv mg_gl_get_api()->ScissorIndexedv -#define glProgramUniform2d mg_gl_get_api()->ProgramUniform2d -#define glVertexAttrib4f mg_gl_get_api()->VertexAttrib4f -#define glBlendEquationSeparatei mg_gl_get_api()->BlendEquationSeparatei -#define glGetUniformdv mg_gl_get_api()->GetUniformdv -#define glDrawRangeElements mg_gl_get_api()->DrawRangeElements -#define glUniformMatrix3dv mg_gl_get_api()->UniformMatrix3dv -#define glProgramUniform2uiv mg_gl_get_api()->ProgramUniform2uiv -#define glVertexAttribI1uiv mg_gl_get_api()->VertexAttribI1uiv -#define glBeginQueryIndexed mg_gl_get_api()->BeginQueryIndexed -#define glPointParameterfv mg_gl_get_api()->PointParameterfv -#define glSampleCoverage mg_gl_get_api()->SampleCoverage -#define glResumeTransformFeedback mg_gl_get_api()->ResumeTransformFeedback -#define glReadPixels mg_gl_get_api()->ReadPixels -#define glLinkProgram mg_gl_get_api()->LinkProgram -#define glWaitSync mg_gl_get_api()->WaitSync -#define glActiveShaderProgram mg_gl_get_api()->ActiveShaderProgram -#define glGetQueryObjectiv mg_gl_get_api()->GetQueryObjectiv -#define glProgramUniform3i mg_gl_get_api()->ProgramUniform3i -#define glProgramUniform1ui mg_gl_get_api()->ProgramUniform1ui -#define glBlendBarrier mg_gl_get_api()->BlendBarrier -#define glVertexAttribI4ubv mg_gl_get_api()->VertexAttribI4ubv -#define glGetQueryObjecti64v mg_gl_get_api()->GetQueryObjecti64v -#define glUniformMatrix4dv mg_gl_get_api()->UniformMatrix4dv -#define glUniform1iv mg_gl_get_api()->Uniform1iv -#define glEnable mg_gl_get_api()->Enable -#define glGenBuffers mg_gl_get_api()->GenBuffers -#define glTexStorage3D mg_gl_get_api()->TexStorage3D -#define glInvalidateTexSubImage mg_gl_get_api()->InvalidateTexSubImage -#define glProgramUniform1i mg_gl_get_api()->ProgramUniform1i -#define glBlendEquation mg_gl_get_api()->BlendEquation -#define glDepthRange mg_gl_get_api()->DepthRange -#define glUniform2dv mg_gl_get_api()->Uniform2dv -#define glBlendFuncSeparate mg_gl_get_api()->BlendFuncSeparate -#define glUniform1dv mg_gl_get_api()->Uniform1dv -#define glEndQueryIndexed mg_gl_get_api()->EndQueryIndexed -#define glDeleteTransformFeedbacks mg_gl_get_api()->DeleteTransformFeedbacks -#define glBlendFuncSeparatei mg_gl_get_api()->BlendFuncSeparatei -#define glDepthFunc mg_gl_get_api()->DepthFunc -#define glInvalidateBufferData mg_gl_get_api()->InvalidateBufferData -#define glBindImageTextures mg_gl_get_api()->BindImageTextures -#define glDeleteFramebuffers mg_gl_get_api()->DeleteFramebuffers -#define glVertexAttribI2iv mg_gl_get_api()->VertexAttribI2iv -#define glVertexAttrib4sv mg_gl_get_api()->VertexAttrib4sv -#define glVertexAttribFormat mg_gl_get_api()->VertexAttribFormat -#define glMapBufferRange mg_gl_get_api()->MapBufferRange -#define glDetachShader mg_gl_get_api()->DetachShader -#define glGetBooleani_v mg_gl_get_api()->GetBooleani_v -#define glDepthRangeIndexed mg_gl_get_api()->DepthRangeIndexed -#define glPauseTransformFeedback mg_gl_get_api()->PauseTransformFeedback -#define glVertexAttribL3dv mg_gl_get_api()->VertexAttribL3dv -#define glPrimitiveRestartIndex mg_gl_get_api()->PrimitiveRestartIndex -#define glUniform4d mg_gl_get_api()->Uniform4d -#define glTransformFeedbackVaryings mg_gl_get_api()->TransformFeedbackVaryings -#define glDeleteBuffers mg_gl_get_api()->DeleteBuffers -#define glGetProgramResourceLocation mg_gl_get_api()->GetProgramResourceLocation -#define glUniform4f mg_gl_get_api()->Uniform4f -#define glGetSamplerParameterfv mg_gl_get_api()->GetSamplerParameterfv -#define glVertexAttribP4ui mg_gl_get_api()->VertexAttribP4ui -#define glIsRenderbuffer mg_gl_get_api()->IsRenderbuffer -#define glVertexAttrib4Nbv mg_gl_get_api()->VertexAttrib4Nbv -#define glVertexAttrib4Nsv mg_gl_get_api()->VertexAttrib4Nsv -#define glCullFace mg_gl_get_api()->CullFace -#define glMultiDrawElementsBaseVertex mg_gl_get_api()->MultiDrawElementsBaseVertex -#define glVertexAttribI3ui mg_gl_get_api()->VertexAttribI3ui -#define glGetUniformBlockIndex mg_gl_get_api()->GetUniformBlockIndex -#define glUseProgramStages mg_gl_get_api()->UseProgramStages -#define glGetActiveAttrib mg_gl_get_api()->GetActiveAttrib -#define glDrawArraysInstancedBaseInstance mg_gl_get_api()->DrawArraysInstancedBaseInstance -#define glIsProgramPipeline mg_gl_get_api()->IsProgramPipeline -#define glProgramUniform1uiv mg_gl_get_api()->ProgramUniform1uiv -#define glProgramUniform3iv mg_gl_get_api()->ProgramUniform3iv -#define glReadBuffer mg_gl_get_api()->ReadBuffer -#define glDeleteShader mg_gl_get_api()->DeleteShader -#define glCreateShaderProgramv mg_gl_get_api()->CreateShaderProgramv -#define glClientWaitSync mg_gl_get_api()->ClientWaitSync -#define glCompressedTexImage1D mg_gl_get_api()->CompressedTexImage1D -#define glVertexAttrib2d mg_gl_get_api()->VertexAttrib2d -#define glVertexAttrib3dv mg_gl_get_api()->VertexAttrib3dv -#define glVertexAttribI4i mg_gl_get_api()->VertexAttribI4i -#define glVertexAttribL2dv mg_gl_get_api()->VertexAttribL2dv -#define glGetDoublei_v mg_gl_get_api()->GetDoublei_v -#define glTexParameterfv mg_gl_get_api()->TexParameterfv -#define glGetAttribLocation mg_gl_get_api()->GetAttribLocation -#define glVertexAttribP1ui mg_gl_get_api()->VertexAttribP1ui -#define glVertexAttribIFormat mg_gl_get_api()->VertexAttribIFormat -#define glVertexAttribI1ui mg_gl_get_api()->VertexAttribI1ui -#define glGetVertexAttribiv mg_gl_get_api()->GetVertexAttribiv -#define glGetActiveSubroutineName mg_gl_get_api()->GetActiveSubroutineName -#define glIsQuery mg_gl_get_api()->IsQuery -#define glVertexAttrib1sv mg_gl_get_api()->VertexAttrib1sv -#define glProgramUniformMatrix2fv mg_gl_get_api()->ProgramUniformMatrix2fv -#define glUseProgram mg_gl_get_api()->UseProgram -#define glClear mg_gl_get_api()->Clear -#define glVertexAttrib4ubv mg_gl_get_api()->VertexAttrib4ubv -#define glInvalidateFramebuffer mg_gl_get_api()->InvalidateFramebuffer -#define glPixelStorei mg_gl_get_api()->PixelStorei -#define glUniform1i mg_gl_get_api()->Uniform1i -#define glUniform1uiv mg_gl_get_api()->Uniform1uiv -#define glTexImage3DMultisample mg_gl_get_api()->TexImage3DMultisample -#define glBindBuffer mg_gl_get_api()->BindBuffer -#define glActiveTexture mg_gl_get_api()->ActiveTexture -#define glDeleteSync mg_gl_get_api()->DeleteSync -#define glVertexAttrib4Niv mg_gl_get_api()->VertexAttrib4Niv -#define glVertexAttrib4uiv mg_gl_get_api()->VertexAttrib4uiv -#define glUniform3fv mg_gl_get_api()->Uniform3fv -#define glGenVertexArrays mg_gl_get_api()->GenVertexArrays -#define glProgramUniformMatrix3x2fv mg_gl_get_api()->ProgramUniformMatrix3x2fv -#define glBindAttribLocation mg_gl_get_api()->BindAttribLocation -#define glCopyTexSubImage2D mg_gl_get_api()->CopyTexSubImage2D -#define glBlendColor mg_gl_get_api()->BlendColor -#define glReleaseShaderCompiler mg_gl_get_api()->ReleaseShaderCompiler -#define glGenTransformFeedbacks mg_gl_get_api()->GenTransformFeedbacks -#define glIsShader mg_gl_get_api()->IsShader -#define glDrawElementsInstancedBaseVertex mg_gl_get_api()->DrawElementsInstancedBaseVertex -#define glVertexAttribLFormat mg_gl_get_api()->VertexAttribLFormat -#define glBindBuffersRange mg_gl_get_api()->BindBuffersRange -#define glColorMask mg_gl_get_api()->ColorMask -#define glUniformMatrix2x4dv mg_gl_get_api()->UniformMatrix2x4dv -#define glGetDoublev mg_gl_get_api()->GetDoublev -#define glUniformMatrix3x2dv mg_gl_get_api()->UniformMatrix3x2dv -#define glVertexAttribL2d mg_gl_get_api()->VertexAttribL2d -#define glFlushMappedBufferRange mg_gl_get_api()->FlushMappedBufferRange -#define glProgramUniform2iv mg_gl_get_api()->ProgramUniform2iv -#define glPointParameteriv mg_gl_get_api()->PointParameteriv -#define glUniformSubroutinesuiv mg_gl_get_api()->UniformSubroutinesuiv -#define glProgramUniformMatrix4x3fv mg_gl_get_api()->ProgramUniformMatrix4x3fv -#define glGetBufferParameteriv mg_gl_get_api()->GetBufferParameteriv -#define glGetTexImage mg_gl_get_api()->GetTexImage -#define glProgramUniformMatrix2x4dv mg_gl_get_api()->ProgramUniformMatrix2x4dv -#define glVertexAttribI1iv mg_gl_get_api()->VertexAttribI1iv -#define glIsSampler mg_gl_get_api()->IsSampler -#define glGetVertexAttribfv mg_gl_get_api()->GetVertexAttribfv -#define glTexStorage1D mg_gl_get_api()->TexStorage1D -#define glViewportArrayv mg_gl_get_api()->ViewportArrayv -#define glTexImage3D mg_gl_get_api()->TexImage3D -#define glProgramUniformMatrix4fv mg_gl_get_api()->ProgramUniformMatrix4fv -#define glGetTexLevelParameteriv mg_gl_get_api()->GetTexLevelParameteriv -#define glGetVertexAttribdv mg_gl_get_api()->GetVertexAttribdv -#define glInvalidateBufferSubData mg_gl_get_api()->InvalidateBufferSubData -#define glProgramUniform4f mg_gl_get_api()->ProgramUniform4f -#define glVertexAttrib2s mg_gl_get_api()->VertexAttrib2s -#define glTexSubImage3D mg_gl_get_api()->TexSubImage3D -#define glGetFragDataLocation mg_gl_get_api()->GetFragDataLocation -#define glVertexAttribI1i mg_gl_get_api()->VertexAttribI1i -#define glGetActiveAtomicCounterBufferiv mg_gl_get_api()->GetActiveAtomicCounterBufferiv -#define glTexStorage2DMultisample mg_gl_get_api()->TexStorage2DMultisample -#define glBindBuffersBase mg_gl_get_api()->BindBuffersBase -#define glGetUniformSubroutineuiv mg_gl_get_api()->GetUniformSubroutineuiv -#define glEndTransformFeedback mg_gl_get_api()->EndTransformFeedback -#define glShaderSource mg_gl_get_api()->ShaderSource -#define glGetQueryObjectuiv mg_gl_get_api()->GetQueryObjectuiv -#define glGetTexLevelParameterfv mg_gl_get_api()->GetTexLevelParameterfv -#define glUniform3d mg_gl_get_api()->Uniform3d -#define glClearBufferfv mg_gl_get_api()->ClearBufferfv -#define glGetSamplerParameterIiv mg_gl_get_api()->GetSamplerParameterIiv -#define glMemoryBarrierByRegion mg_gl_get_api()->MemoryBarrierByRegion -#define glGenProgramPipelines mg_gl_get_api()->GenProgramPipelines -#define glBindFragDataLocation mg_gl_get_api()->BindFragDataLocation -#define glGetShaderInfoLog mg_gl_get_api()->GetShaderInfoLog -#define glTextureView mg_gl_get_api()->TextureView -#define glIsEnabled mg_gl_get_api()->IsEnabled -#define glPatchParameterfv mg_gl_get_api()->PatchParameterfv -#define glHint mg_gl_get_api()->Hint -#define glPixelStoref mg_gl_get_api()->PixelStoref -#define glProgramUniform4iv mg_gl_get_api()->ProgramUniform4iv -#define glBlendEquationSeparate mg_gl_get_api()->BlendEquationSeparate -#define glClearBufferuiv mg_gl_get_api()->ClearBufferuiv -#define glObjectLabel mg_gl_get_api()->ObjectLabel -#define glGetPointerv mg_gl_get_api()->GetPointerv -#define glDeleteSamplers mg_gl_get_api()->DeleteSamplers -#define glProgramUniform2dv mg_gl_get_api()->ProgramUniform2dv -#define glEnableVertexAttribArray mg_gl_get_api()->EnableVertexAttribArray -#define glClampColor mg_gl_get_api()->ClampColor -#define glGetShaderPrecisionFormat mg_gl_get_api()->GetShaderPrecisionFormat -#define glGetnUniformiv mg_gl_get_api()->GetnUniformiv -#define glUniform3iv mg_gl_get_api()->Uniform3iv -#define glVertexAttribI3uiv mg_gl_get_api()->VertexAttribI3uiv -#define glBufferSubData mg_gl_get_api()->BufferSubData -#define glSamplerParameterfv mg_gl_get_api()->SamplerParameterfv -#define glVertexAttribI4sv mg_gl_get_api()->VertexAttribI4sv -#define glTexBuffer mg_gl_get_api()->TexBuffer -#define glCreateProgram mg_gl_get_api()->CreateProgram -#define glBindBufferRange mg_gl_get_api()->BindBufferRange -#define glIsTexture mg_gl_get_api()->IsTexture -#define glUniformMatrix3x2fv mg_gl_get_api()->UniformMatrix3x2fv -#define glDrawElements mg_gl_get_api()->DrawElements -#define glProgramUniform1f mg_gl_get_api()->ProgramUniform1f -#define glUniform3dv mg_gl_get_api()->Uniform3dv -#define glDrawElementsInstanced mg_gl_get_api()->DrawElementsInstanced -#define glGenerateMipmap mg_gl_get_api()->GenerateMipmap -#define glProgramUniform4ui mg_gl_get_api()->ProgramUniform4ui -#define glGetVertexAttribIuiv mg_gl_get_api()->GetVertexAttribIuiv -#define glClearDepth mg_gl_get_api()->ClearDepth -#define glDrawTransformFeedback mg_gl_get_api()->DrawTransformFeedback -#define glTexSubImage2D mg_gl_get_api()->TexSubImage2D -#define glVertexAttribP4uiv mg_gl_get_api()->VertexAttribP4uiv -#define glGetTexParameterIuiv mg_gl_get_api()->GetTexParameterIuiv -#define glPointSize mg_gl_get_api()->PointSize -#define glGetCompressedTexImage mg_gl_get_api()->GetCompressedTexImage -#define glUniform2uiv mg_gl_get_api()->Uniform2uiv -#define glFenceSync mg_gl_get_api()->FenceSync -#define glMapBuffer mg_gl_get_api()->MapBuffer -#define glGetFramebufferAttachmentParameteriv mg_gl_get_api()->GetFramebufferAttachmentParameteriv -#define glBeginTransformFeedback mg_gl_get_api()->BeginTransformFeedback -#define glTexParameteri mg_gl_get_api()->TexParameteri -#define glGetTexParameterfv mg_gl_get_api()->GetTexParameterfv -#define glVertexAttribL1d mg_gl_get_api()->VertexAttribL1d -#define glVertexAttrib4Nusv mg_gl_get_api()->VertexAttrib4Nusv -#define glProgramUniform2f mg_gl_get_api()->ProgramUniform2f -#define glVertexAttrib1d mg_gl_get_api()->VertexAttrib1d -#define glGetError mg_gl_get_api()->GetError -#define glVertexAttribP2uiv mg_gl_get_api()->VertexAttribP2uiv -#define glUniformMatrix4x3dv mg_gl_get_api()->UniformMatrix4x3dv -#define glGetShaderSource mg_gl_get_api()->GetShaderSource -#define glStencilFuncSeparate mg_gl_get_api()->StencilFuncSeparate -#define glFramebufferTexture mg_gl_get_api()->FramebufferTexture -#define glProgramUniformMatrix4x3dv mg_gl_get_api()->ProgramUniformMatrix4x3dv -#define glUniform4dv mg_gl_get_api()->Uniform4dv -#define glGetProgramInfoLog mg_gl_get_api()->GetProgramInfoLog -#define glProgramUniformMatrix3x4dv mg_gl_get_api()->ProgramUniformMatrix3x4dv -#define glUniformMatrix3x4fv mg_gl_get_api()->UniformMatrix3x4fv -#define glCompressedTexSubImage3D mg_gl_get_api()->CompressedTexSubImage3D -#define glDrawElementsInstancedBaseInstance mg_gl_get_api()->DrawElementsInstancedBaseInstance -#define glBindBufferBase mg_gl_get_api()->BindBufferBase -#define glUniformMatrix2dv mg_gl_get_api()->UniformMatrix2dv -#define glGetTransformFeedbackVarying mg_gl_get_api()->GetTransformFeedbackVarying -#define glCompressedTexImage2D mg_gl_get_api()->CompressedTexImage2D -#define glGetUniformIndices mg_gl_get_api()->GetUniformIndices -#define glTexStorage2D mg_gl_get_api()->TexStorage2D -#define glVertexAttrib4usv mg_gl_get_api()->VertexAttrib4usv -#define glGetActiveUniformBlockiv mg_gl_get_api()->GetActiveUniformBlockiv -#define glCopyImageSubData mg_gl_get_api()->CopyImageSubData -#define glVertexAttribI4ui mg_gl_get_api()->VertexAttribI4ui -#define glVertexAttrib4fv mg_gl_get_api()->VertexAttrib4fv -#define glProgramUniform1iv mg_gl_get_api()->ProgramUniform1iv -#define glBindVertexBuffers mg_gl_get_api()->BindVertexBuffers -#define glProvokingVertex mg_gl_get_api()->ProvokingVertex -#define glUniform3uiv mg_gl_get_api()->Uniform3uiv -#define glIsVertexArray mg_gl_get_api()->IsVertexArray -#define glViewportIndexedfv mg_gl_get_api()->ViewportIndexedfv -#define glDispatchCompute mg_gl_get_api()->DispatchCompute -#define glDrawArrays mg_gl_get_api()->DrawArrays -#define glGetQueryIndexediv mg_gl_get_api()->GetQueryIndexediv -#define glUniform3ui mg_gl_get_api()->Uniform3ui -#define glMultiDrawElements mg_gl_get_api()->MultiDrawElements -#define glClearBufferfi mg_gl_get_api()->ClearBufferfi -#define glProgramUniformMatrix2dv mg_gl_get_api()->ProgramUniformMatrix2dv -#define glVertexAttribP3ui mg_gl_get_api()->VertexAttribP3ui -#define glVertexAttribI3iv mg_gl_get_api()->VertexAttribI3iv -#define glProgramParameteri mg_gl_get_api()->ProgramParameteri -#define glUniform4uiv mg_gl_get_api()->Uniform4uiv -#define glUniformMatrix4fv mg_gl_get_api()->UniformMatrix4fv -#define glVertexAttrib2fv mg_gl_get_api()->VertexAttrib2fv -#define glGetGraphicsResetStatus mg_gl_get_api()->GetGraphicsResetStatus -#define glShaderBinary mg_gl_get_api()->ShaderBinary -#define glShaderStorageBlockBinding mg_gl_get_api()->ShaderStorageBlockBinding -#define glDrawArraysInstanced mg_gl_get_api()->DrawArraysInstanced -#define glGetSubroutineIndex mg_gl_get_api()->GetSubroutineIndex -#define glGetVertexAttribIiv mg_gl_get_api()->GetVertexAttribIiv -#define glDrawElementsBaseVertex mg_gl_get_api()->DrawElementsBaseVertex -#define glGetProgramResourceName mg_gl_get_api()->GetProgramResourceName -#define glGetInternalformativ mg_gl_get_api()->GetInternalformativ -#define glUniform4fv mg_gl_get_api()->Uniform4fv -#define glVertexAttribLPointer mg_gl_get_api()->VertexAttribLPointer -#define glGetSamplerParameterIuiv mg_gl_get_api()->GetSamplerParameterIuiv -#define glVertexAttrib3d mg_gl_get_api()->VertexAttrib3d -#define glSamplerParameterf mg_gl_get_api()->SamplerParameterf -#define glGenFramebuffers mg_gl_get_api()->GenFramebuffers -#define glGetQueryObjectui64v mg_gl_get_api()->GetQueryObjectui64v -#define glGetProgramResourceiv mg_gl_get_api()->GetProgramResourceiv -#define glVertexAttribP3uiv mg_gl_get_api()->VertexAttribP3uiv -#define glVertexAttrib4dv mg_gl_get_api()->VertexAttrib4dv -#define glIsTransformFeedback mg_gl_get_api()->IsTransformFeedback -#define glDispatchComputeIndirect mg_gl_get_api()->DispatchComputeIndirect -#define glCompressedTexSubImage2D mg_gl_get_api()->CompressedTexSubImage2D -#define glBindVertexBuffer mg_gl_get_api()->BindVertexBuffer -#define glProgramUniform1dv mg_gl_get_api()->ProgramUniform1dv -#define glStencilOp mg_gl_get_api()->StencilOp -#define glVertexAttrib1s mg_gl_get_api()->VertexAttrib1s -#define glGetMultisamplefv mg_gl_get_api()->GetMultisamplefv -#define glGetQueryiv mg_gl_get_api()->GetQueryiv -#define glBindProgramPipeline mg_gl_get_api()->BindProgramPipeline -#define glFramebufferParameteri mg_gl_get_api()->FramebufferParameteri -#define glGetIntegeri_v mg_gl_get_api()->GetIntegeri_v -#define glGetIntegerv mg_gl_get_api()->GetIntegerv -#define glDeleteProgramPipelines mg_gl_get_api()->DeleteProgramPipelines -#define glClearBufferData mg_gl_get_api()->ClearBufferData -#define glProgramUniform2fv mg_gl_get_api()->ProgramUniform2fv -#define glGetSubroutineUniformLocation mg_gl_get_api()->GetSubroutineUniformLocation -#define glGetProgramiv mg_gl_get_api()->GetProgramiv -#define glDepthMask mg_gl_get_api()->DepthMask -#define glVertexAttribIPointer mg_gl_get_api()->VertexAttribIPointer -#define glGetActiveUniformName mg_gl_get_api()->GetActiveUniformName -#define glVertexAttribP1uiv mg_gl_get_api()->VertexAttribP1uiv -#define glProgramUniformMatrix2x3fv mg_gl_get_api()->ProgramUniformMatrix2x3fv -#define glGetUniformLocation mg_gl_get_api()->GetUniformLocation -#define glSampleMaski mg_gl_get_api()->SampleMaski -#define glGetBufferSubData mg_gl_get_api()->GetBufferSubData -#define glUniform4iv mg_gl_get_api()->Uniform4iv -#define glVertexAttribPointer mg_gl_get_api()->VertexAttribPointer -#define glFramebufferTexture2D mg_gl_get_api()->FramebufferTexture2D -#define glGetnUniformuiv mg_gl_get_api()->GetnUniformuiv -#define glGetInternalformati64v mg_gl_get_api()->GetInternalformati64v -#define glCompileShader mg_gl_get_api()->CompileShader -#define glDrawBuffer mg_gl_get_api()->DrawBuffer -#define glUniform3f mg_gl_get_api()->Uniform3f -#define glDrawTransformFeedbackInstanced mg_gl_get_api()->DrawTransformFeedbackInstanced -#define glProgramUniform4dv mg_gl_get_api()->ProgramUniform4dv -#define glGetProgramStageiv mg_gl_get_api()->GetProgramStageiv -#define glStencilFunc mg_gl_get_api()->StencilFunc -#define glGetProgramResourceIndex mg_gl_get_api()->GetProgramResourceIndex -#define glClearStencil mg_gl_get_api()->ClearStencil -#define glScissorArrayv mg_gl_get_api()->ScissorArrayv -#define glMemoryBarrier mg_gl_get_api()->MemoryBarrier -#define glSamplerParameterIuiv mg_gl_get_api()->SamplerParameterIuiv -#define glGetFloatv mg_gl_get_api()->GetFloatv -#define glBindFragDataLocationIndexed mg_gl_get_api()->BindFragDataLocationIndexed -#define glEndQuery mg_gl_get_api()->EndQuery -#define glVertexAttrib4Nubv mg_gl_get_api()->VertexAttrib4Nubv -#define glGetProgramPipelineInfoLog mg_gl_get_api()->GetProgramPipelineInfoLog -#define glVertexAttribDivisor mg_gl_get_api()->VertexAttribDivisor -#define glUniform3i mg_gl_get_api()->Uniform3i -#define glUniform2ui mg_gl_get_api()->Uniform2ui -#define glInvalidateSubFramebuffer mg_gl_get_api()->InvalidateSubFramebuffer -#define glGetDebugMessageLog mg_gl_get_api()->GetDebugMessageLog -#endif // __GL_API_H__ +/******************************************************** +* +* @file: gl_api.h +* @note: auto-generated by glapi.py from gl.xml +* @date: 15/082023 +* +*********************************************************/ +#ifndef __GL_API_H__ +#define __GL_API_H__ + +#include"GL/glcorearb.h" +#include"GLES3/gl32.h" + +typedef struct oc_gl_api +{ + const char* name; + PFNGLGETFLOATVPROC GetFloatv; + PFNGLTEXBUFFERRANGEPROC TexBufferRange; + PFNGLISBUFFERPROC IsBuffer; + PFNGLISTEXTUREPROC IsTexture; + PFNGLDEPTHRANGEFPROC DepthRangef; + PFNGLENDCONDITIONALRENDERPROC EndConditionalRender; + PFNGLBLENDFUNCIPROC BlendFunci; + PFNGLGETPROGRAMPIPELINEIVPROC GetProgramPipelineiv; + PFNGLWAITSYNCPROC WaitSync; + PFNGLPROGRAMUNIFORMMATRIX2FVPROC ProgramUniformMatrix2fv; + PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC ProgramUniformMatrix4x3dv; + PFNGLVERTEXATTRIB1DVPROC VertexAttrib1dv; + PFNGLSAMPLERPARAMETERIPROC SamplerParameteri; + PFNGLGETVERTEXATTRIBIIVPROC GetVertexAttribIiv; + PFNGLGETSAMPLERPARAMETERFVPROC GetSamplerParameterfv; + PFNGLVERTEXATTRIB1DPROC VertexAttrib1d; + PFNGLTEXBUFFERPROC TexBuffer; + PFNGLINVALIDATEBUFFERDATAPROC InvalidateBufferData; + PFNGLPROGRAMUNIFORM2IPROC ProgramUniform2i; + PFNGLUNIFORM4DVPROC Uniform4dv; + PFNGLUSEPROGRAMPROC UseProgram; + PFNGLVERTEXATTRIBI3IVPROC VertexAttribI3iv; + PFNGLDRAWELEMENTSINDIRECTPROC DrawElementsIndirect; + PFNGLVERTEXATTRIB4UIVPROC VertexAttrib4uiv; + PFNGLGETQUERYOBJECTIVPROC GetQueryObjectiv; + PFNGLFRAMEBUFFERRENDERBUFFERPROC FramebufferRenderbuffer; + PFNGLBLENDEQUATIONIPROC BlendEquationi; + PFNGLGETACTIVESUBROUTINENAMEPROC GetActiveSubroutineName; + PFNGLVERTEXATTRIB2SPROC VertexAttrib2s; + PFNGLVERTEXATTRIBL1DPROC VertexAttribL1d; + PFNGLBINDTEXTURESPROC BindTextures; + PFNGLVERTEXATTRIB3SVPROC VertexAttrib3sv; + PFNGLGETFLOATI_VPROC GetFloati_v; + PFNGLBEGINTRANSFORMFEEDBACKPROC BeginTransformFeedback; + PFNGLCLEARSTENCILPROC ClearStencil; + PFNGLUNIFORM3IPROC Uniform3i; + PFNGLVALIDATEPROGRAMPIPELINEPROC ValidateProgramPipeline; + PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC ProgramUniformMatrix4x2fv; + PFNGLVERTEXATTRIBI4UIPROC VertexAttribI4ui; + PFNGLGETSHADERIVPROC GetShaderiv; + PFNGLREADNPIXELSPROC ReadnPixels; + PFNGLUNIFORMMATRIX4X2FVPROC UniformMatrix4x2fv; + PFNGLGETSHADERPRECISIONFORMATPROC GetShaderPrecisionFormat; + PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC ProgramUniformMatrix2x3fv; + PFNGLTEXSUBIMAGE3DPROC TexSubImage3D; + PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC GetProgramResourceLocationIndex; + PFNGLBLENDFUNCPROC BlendFunc; + PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC ProgramUniformMatrix3x4fv; + PFNGLUNIFORM3DPROC Uniform3d; + PFNGLVERTEXATTRIB1SVPROC VertexAttrib1sv; + PFNGLBINDFRAGDATALOCATIONPROC BindFragDataLocation; + PFNGLVERTEXATTRIB4BVPROC VertexAttrib4bv; + PFNGLUNIFORM4IVPROC Uniform4iv; + PFNGLPROGRAMUNIFORM2UIPROC ProgramUniform2ui; + PFNGLDRAWARRAYSPROC DrawArrays; + PFNGLPROGRAMBINARYPROC ProgramBinary; + PFNGLVERTEXATTRIB4FPROC VertexAttrib4f; + PFNGLVERTEXATTRIBP2UIVPROC VertexAttribP2uiv; + PFNGLUNIFORMMATRIX3FVPROC UniformMatrix3fv; + PFNGLUNIFORM2IPROC Uniform2i; + PFNGLGETQUERYOBJECTUIVPROC GetQueryObjectuiv; + PFNGLUNIFORMBLOCKBINDINGPROC UniformBlockBinding; + PFNGLSAMPLECOVERAGEPROC SampleCoverage; + PFNGLVERTEXATTRIB4NUSVPROC VertexAttrib4Nusv; + PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC ProgramUniformMatrix2x4dv; + PFNGLUNIFORM3UIVPROC Uniform3uiv; + PFNGLVERTEXATTRIB1SPROC VertexAttrib1s; + PFNGLGETVERTEXATTRIBPOINTERVPROC GetVertexAttribPointerv; + PFNGLBLENDBARRIERPROC BlendBarrier; + PFNGLDRAWRANGEELEMENTSPROC DrawRangeElements; + PFNGLTEXSTORAGE3DPROC TexStorage3D; + PFNGLGETINTERNALFORMATI64VPROC GetInternalformati64v; + PFNGLGETQUERYOBJECTI64VPROC GetQueryObjecti64v; + PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC CompressedTexSubImage1D; + PFNGLVERTEXATTRIB3DVPROC VertexAttrib3dv; + PFNGLVERTEXBINDINGDIVISORPROC VertexBindingDivisor; + PFNGLUSEPROGRAMSTAGESPROC UseProgramStages; + PFNGLVERTEXATTRIBBINDINGPROC VertexAttribBinding; + PFNGLDEBUGMESSAGEINSERTPROC DebugMessageInsert; + PFNGLGETTEXPARAMETERIVPROC GetTexParameteriv; + PFNGLMULTIDRAWARRAYSINDIRECTPROC MultiDrawArraysIndirect; + PFNGLGETTEXPARAMETERFVPROC GetTexParameterfv; + PFNGLGETPROGRAMPIPELINEINFOLOGPROC GetProgramPipelineInfoLog; + PFNGLENDQUERYPROC EndQuery; + PFNGLGETPROGRAMRESOURCELOCATIONPROC GetProgramResourceLocation; + PFNGLCOMPRESSEDTEXIMAGE2DPROC CompressedTexImage2D; + PFNGLVERTEXATTRIBP2UIPROC VertexAttribP2ui; + PFNGLISENABLEDIPROC IsEnabledi; + PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC GetActiveAtomicCounterBufferiv; + PFNGLISPROGRAMPROC IsProgram; + PFNGLUNIFORM1DVPROC Uniform1dv; + PFNGLTEXPARAMETERIVPROC TexParameteriv; + PFNGLUNIFORM2FVPROC Uniform2fv; + PFNGLRELEASESHADERCOMPILERPROC ReleaseShaderCompiler; + PFNGLCULLFACEPROC CullFace; + PFNGLVERTEXATTRIBI4IPROC VertexAttribI4i; + PFNGLGETPROGRAMRESOURCEINDEXPROC GetProgramResourceIndex; + PFNGLSHADERBINARYPROC ShaderBinary; + PFNGLUNIFORMMATRIX3X2DVPROC UniformMatrix3x2dv; + PFNGLINVALIDATEFRAMEBUFFERPROC InvalidateFramebuffer; + PFNGLATTACHSHADERPROC AttachShader; + PFNGLFLUSHMAPPEDBUFFERRANGEPROC FlushMappedBufferRange; + PFNGLVERTEXATTRIBP3UIVPROC VertexAttribP3uiv; + PFNGLGETACTIVEUNIFORMNAMEPROC GetActiveUniformName; + PFNGLMAPBUFFERPROC MapBuffer; + PFNGLDRAWBUFFERSPROC DrawBuffers; + PFNGLGETSYNCIVPROC GetSynciv; + PFNGLCOPYTEXSUBIMAGE2DPROC CopyTexSubImage2D; + PFNGLOBJECTLABELPROC ObjectLabel; + PFNGLBUFFERSUBDATAPROC BufferSubData; + PFNGLUNIFORM2FPROC Uniform2f; + PFNGLDEBUGMESSAGECALLBACKPROC DebugMessageCallback; + PFNGLVERTEXATTRIBL4DVPROC VertexAttribL4dv; + PFNGLISPROGRAMPIPELINEPROC IsProgramPipeline; + PFNGLRESUMETRANSFORMFEEDBACKPROC ResumeTransformFeedback; + PFNGLVERTEXATTRIBI4IVPROC VertexAttribI4iv; + PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog; + PFNGLGETINTEGERI_VPROC GetIntegeri_v; + PFNGLBINDVERTEXBUFFERPROC BindVertexBuffer; + PFNGLBLENDEQUATIONPROC BlendEquation; + PFNGLVERTEXATTRIBL2DVPROC VertexAttribL2dv; + PFNGLVERTEXATTRIBI1UIPROC VertexAttribI1ui; + PFNGLVERTEXATTRIB4NSVPROC VertexAttrib4Nsv; + PFNGLVERTEXATTRIBL4DPROC VertexAttribL4d; + PFNGLCOPYIMAGESUBDATAPROC CopyImageSubData; + PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC GetFramebufferAttachmentParameteriv; + PFNGLVERTEXATTRIBL2DPROC VertexAttribL2d; + PFNGLGETSUBROUTINEINDEXPROC GetSubroutineIndex; + PFNGLVERTEXATTRIBI3UIVPROC VertexAttribI3uiv; + PFNGLVERTEXATTRIB4IVPROC VertexAttrib4iv; + PFNGLBINDVERTEXBUFFERSPROC BindVertexBuffers; + PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC ProgramUniformMatrix2x3dv; + PFNGLPRIMITIVEBOUNDINGBOXPROC PrimitiveBoundingBox; + PFNGLSCISSORPROC Scissor; + PFNGLCLIENTWAITSYNCPROC ClientWaitSync; + PFNGLUNIFORM3UIPROC Uniform3ui; + PFNGLVERTEXATTRIBP3UIPROC VertexAttribP3ui; + PFNGLENABLEPROC Enable; + PFNGLSTENCILOPSEPARATEPROC StencilOpSeparate; + PFNGLUNIFORMMATRIX2X3DVPROC UniformMatrix2x3dv; + PFNGLPROGRAMUNIFORMMATRIX3DVPROC ProgramUniformMatrix3dv; + PFNGLTEXIMAGE2DMULTISAMPLEPROC TexImage2DMultisample; + PFNGLVERTEXATTRIB4NBVPROC VertexAttrib4Nbv; + PFNGLGETTEXIMAGEPROC GetTexImage; + PFNGLVERTEXATTRIB4SVPROC VertexAttrib4sv; + PFNGLPIXELSTOREIPROC PixelStorei; + PFNGLDEPTHMASKPROC DepthMask; + PFNGLTEXSTORAGE2DPROC TexStorage2D; + PFNGLCLEARPROC Clear; + PFNGLUNIFORMMATRIX3X4DVPROC UniformMatrix3x4dv; + PFNGLDELETETRANSFORMFEEDBACKSPROC DeleteTransformFeedbacks; + PFNGLMAPBUFFERRANGEPROC MapBufferRange; + PFNGLMEMORYBARRIERPROC MemoryBarrier; + PFNGLVIEWPORTINDEXEDFPROC ViewportIndexedf; + PFNGLVERTEXATTRIB3FVPROC VertexAttrib3fv; + PFNGLOBJECTPTRLABELPROC ObjectPtrLabel; + PFNGLTEXSTORAGE1DPROC TexStorage1D; + PFNGLCOMPRESSEDTEXIMAGE3DPROC CompressedTexImage3D; + PFNGLVERTEXATTRIB1FVPROC VertexAttrib1fv; + PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer; + PFNGLGETQUERYINDEXEDIVPROC GetQueryIndexediv; + PFNGLCOMPILESHADERPROC CompileShader; + PFNGLPROGRAMUNIFORM1IPROC ProgramUniform1i; + PFNGLGETQUERYIVPROC GetQueryiv; + PFNGLVERTEXATTRIBI1IVPROC VertexAttribI1iv; + PFNGLCOPYTEXIMAGE2DPROC CopyTexImage2D; + PFNGLGETQUERYOBJECTUI64VPROC GetQueryObjectui64v; + PFNGLPOINTSIZEPROC PointSize; + PFNGLDISABLEIPROC Disablei; + PFNGLVERTEXATTRIBL1DVPROC VertexAttribL1dv; + PFNGLCREATESHADERPROC CreateShader; + PFNGLGETSTRINGPROC GetString; + PFNGLVIEWPORTARRAYVPROC ViewportArrayv; + PFNGLPROGRAMUNIFORM3DPROC ProgramUniform3d; + PFNGLVERTEXATTRIB4NUBVPROC VertexAttrib4Nubv; + PFNGLTEXPARAMETERIPROC TexParameteri; + PFNGLPROGRAMUNIFORM4FVPROC ProgramUniform4fv; + PFNGLGENERATEMIPMAPPROC GenerateMipmap; + PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC CompressedTexSubImage3D; + PFNGLUNIFORM3FPROC Uniform3f; + PFNGLGETUNIFORMINDICESPROC GetUniformIndices; + PFNGLVERTEXATTRIBLPOINTERPROC VertexAttribLPointer; + PFNGLVERTEXATTRIBI2UIVPROC VertexAttribI2uiv; + PFNGLQUERYCOUNTERPROC QueryCounter; + PFNGLACTIVESHADERPROGRAMPROC ActiveShaderProgram; + PFNGLUNIFORM1UIPROC Uniform1ui; + PFNGLVERTEXATTRIBI1IPROC VertexAttribI1i; + PFNGLGETTEXPARAMETERIIVPROC GetTexParameterIiv; + PFNGLGETUNIFORMFVPROC GetUniformfv; + PFNGLPROGRAMUNIFORM2UIVPROC ProgramUniform2uiv; + PFNGLGETERRORPROC GetError; + PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC GetActiveUniformBlockName; + PFNGLTEXTUREVIEWPROC TextureView; + PFNGLGETNUNIFORMIVPROC GetnUniformiv; + PFNGLPROGRAMUNIFORM4DVPROC ProgramUniform4dv; + PFNGLVIEWPORTINDEXEDFVPROC ViewportIndexedfv; + PFNGLHINTPROC Hint; + PFNGLGETSHADERSOURCEPROC GetShaderSource; + PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC ProgramUniformMatrix4x3fv; + PFNGLUNIFORM1IVPROC Uniform1iv; + PFNGLVERTEXATTRIBI4BVPROC VertexAttribI4bv; + PFNGLUNIFORMMATRIX4X2DVPROC UniformMatrix4x2dv; + PFNGLBUFFERSTORAGEPROC BufferStorage; + PFNGLISRENDERBUFFERPROC IsRenderbuffer; + PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC GetActiveSubroutineUniformName; + PFNGLLINKPROGRAMPROC LinkProgram; + PFNGLGETACTIVEUNIFORMSIVPROC GetActiveUniformsiv; + PFNGLGETDEBUGMESSAGELOGPROC GetDebugMessageLog; + PFNGLCOPYTEXSUBIMAGE3DPROC CopyTexSubImage3D; + PFNGLPOINTPARAMETERIPROC PointParameteri; + PFNGLPROGRAMUNIFORM3DVPROC ProgramUniform3dv; + PFNGLCOMPRESSEDTEXIMAGE1DPROC CompressedTexImage1D; + PFNGLUNIFORMMATRIX3X4FVPROC UniformMatrix3x4fv; + PFNGLGENSAMPLERSPROC GenSamplers; + PFNGLGETCOMPRESSEDTEXIMAGEPROC GetCompressedTexImage; + PFNGLDELETEQUERIESPROC DeleteQueries; + PFNGLGENPROGRAMPIPELINESPROC GenProgramPipelines; + PFNGLDISPATCHCOMPUTEINDIRECTPROC DispatchComputeIndirect; + PFNGLVERTEXATTRIBIPOINTERPROC VertexAttribIPointer; + PFNGLCREATEPROGRAMPROC CreateProgram; + PFNGLCLEARTEXSUBIMAGEPROC ClearTexSubImage; + PFNGLVERTEXATTRIB4DPROC VertexAttrib4d; + PFNGLFRONTFACEPROC FrontFace; + PFNGLBINDTRANSFORMFEEDBACKPROC BindTransformFeedback; + PFNGLGETPROGRAMSTAGEIVPROC GetProgramStageiv; + PFNGLSAMPLERPARAMETERIIVPROC SamplerParameterIiv; + PFNGLGETINTEGER64VPROC GetInteger64v; + PFNGLCREATESHADERPROGRAMVPROC CreateShaderProgramv; + PFNGLBINDBUFFERSRANGEPROC BindBuffersRange; + PFNGLUNIFORM3FVPROC Uniform3fv; + PFNGLPROGRAMUNIFORMMATRIX4FVPROC ProgramUniformMatrix4fv; + PFNGLBINDBUFFERSBASEPROC BindBuffersBase; + PFNGLCLEARBUFFERFIPROC ClearBufferfi; + PFNGLFRAMEBUFFERTEXTURE3DPROC FramebufferTexture3D; + PFNGLDISABLEPROC Disable; + PFNGLPROGRAMUNIFORM1IVPROC ProgramUniform1iv; + PFNGLVERTEXATTRIBI2IVPROC VertexAttribI2iv; + PFNGLDEPTHRANGEINDEXEDPROC DepthRangeIndexed; + PFNGLPATCHPARAMETERIPROC PatchParameteri; + PFNGLGETUNIFORMBLOCKINDEXPROC GetUniformBlockIndex; + PFNGLMULTIDRAWARRAYSPROC MultiDrawArrays; + PFNGLVERTEXATTRIBI4UBVPROC VertexAttribI4ubv; + PFNGLBINDBUFFERPROC BindBuffer; + PFNGLVERTEXATTRIBI3IPROC VertexAttribI3i; + PFNGLGETDOUBLEVPROC GetDoublev; + PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC DrawTransformFeedbackStream; + PFNGLVERTEXATTRIBI4UIVPROC VertexAttribI4uiv; + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC RenderbufferStorageMultisample; + PFNGLVERTEXATTRIBL3DVPROC VertexAttribL3dv; + PFNGLSTENCILMASKSEPARATEPROC StencilMaskSeparate; + PFNGLPROGRAMUNIFORM1DPROC ProgramUniform1d; + PFNGLVIEWPORTPROC Viewport; + PFNGLVERTEXATTRIBP1UIPROC VertexAttribP1ui; + PFNGLVERTEXATTRIB4DVPROC VertexAttrib4dv; + PFNGLGENQUERIESPROC GenQueries; + PFNGLTEXPARAMETERIIVPROC TexParameterIiv; + PFNGLPROGRAMUNIFORM2DPROC ProgramUniform2d; + PFNGLPROGRAMUNIFORM1UIVPROC ProgramUniform1uiv; + PFNGLVERTEXATTRIB4NUBPROC VertexAttrib4Nub; + PFNGLISVERTEXARRAYPROC IsVertexArray; + PFNGLPROGRAMUNIFORM3FPROC ProgramUniform3f; + PFNGLPROGRAMUNIFORM3IVPROC ProgramUniform3iv; + PFNGLGETPROGRAMBINARYPROC GetProgramBinary; + PFNGLBINDRENDERBUFFERPROC BindRenderbuffer; + PFNGLBINDFRAGDATALOCATIONINDEXEDPROC BindFragDataLocationIndexed; + PFNGLGETSAMPLERPARAMETERIIVPROC GetSamplerParameterIiv; + PFNGLVERTEXATTRIBDIVISORPROC VertexAttribDivisor; + PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC ProgramUniformMatrix3x2dv; + PFNGLFRAMEBUFFERPARAMETERIPROC FramebufferParameteri; + PFNGLGENTRANSFORMFEEDBACKSPROC GenTransformFeedbacks; + PFNGLDELETESYNCPROC DeleteSync; + PFNGLPROGRAMUNIFORM1UIPROC ProgramUniform1ui; + PFNGLTEXSUBIMAGE1DPROC TexSubImage1D; + PFNGLCLEARDEPTHFPROC ClearDepthf; + PFNGLREADPIXELSPROC ReadPixels; + PFNGLVERTEXATTRIBI2IPROC VertexAttribI2i; + PFNGLFINISHPROC Finish; + PFNGLLINEWIDTHPROC LineWidth; + PFNGLDELETESHADERPROC DeleteShader; + PFNGLISSAMPLERPROC IsSampler; + PFNGLPROGRAMUNIFORMMATRIX4DVPROC ProgramUniformMatrix4dv; + PFNGLTRANSFORMFEEDBACKVARYINGSPROC TransformFeedbackVaryings; + PFNGLBEGINCONDITIONALRENDERPROC BeginConditionalRender; + PFNGLBINDSAMPLERSPROC BindSamplers; + PFNGLDELETEPROGRAMPIPELINESPROC DeleteProgramPipelines; + PFNGLCOLORMASKPROC ColorMask; + PFNGLTEXPARAMETERFVPROC TexParameterfv; + PFNGLPUSHDEBUGGROUPPROC PushDebugGroup; + PFNGLCLEARBUFFERFVPROC ClearBufferfv; + PFNGLISENABLEDPROC IsEnabled; + PFNGLVERTEXATTRIB2FPROC VertexAttrib2f; + PFNGLPROGRAMUNIFORM2FPROC ProgramUniform2f; + PFNGLGETSAMPLERPARAMETERIUIVPROC GetSamplerParameterIuiv; + PFNGLGETINTEGER64I_VPROC GetInteger64i_v; + PFNGLUNIFORM2DVPROC Uniform2dv; + PFNGLGETBUFFERSUBDATAPROC GetBufferSubData; + PFNGLMULTIDRAWELEMENTSINDIRECTPROC MultiDrawElementsIndirect; + PFNGLPROGRAMPARAMETERIPROC ProgramParameteri; + PFNGLVERTEXATTRIBP4UIPROC VertexAttribP4ui; + PFNGLSAMPLERPARAMETERFVPROC SamplerParameterfv; + PFNGLPOINTPARAMETERFPROC PointParameterf; + PFNGLUNIFORMMATRIX2X4FVPROC UniformMatrix2x4fv; + PFNGLGENBUFFERSPROC GenBuffers; + PFNGLPROGRAMUNIFORM2DVPROC ProgramUniform2dv; + PFNGLVERTEXATTRIBFORMATPROC VertexAttribFormat; + PFNGLTEXSUBIMAGE2DPROC TexSubImage2D; + PFNGLVERTEXATTRIB4UBVPROC VertexAttrib4ubv; + PFNGLGETGRAPHICSRESETSTATUSPROC GetGraphicsResetStatus; + PFNGLGETPROGRAMINTERFACEIVPROC GetProgramInterfaceiv; + PFNGLVERTEXATTRIBIFORMATPROC VertexAttribIFormat; + PFNGLGETNUNIFORMFVPROC GetnUniformfv; + PFNGLDELETEPROGRAMPROC DeleteProgram; + PFNGLCLAMPCOLORPROC ClampColor; + PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC DrawElementsInstancedBaseVertexBaseInstance; + PFNGLDRAWELEMENTSPROC DrawElements; + PFNGLDEBUGMESSAGECONTROLPROC DebugMessageControl; + PFNGLGETRENDERBUFFERPARAMETERIVPROC GetRenderbufferParameteriv; + PFNGLDETACHSHADERPROC DetachShader; + PFNGLGENFRAMEBUFFERSPROC GenFramebuffers; + PFNGLPROVOKINGVERTEXPROC ProvokingVertex; + PFNGLSAMPLEMASKIPROC SampleMaski; + PFNGLENDQUERYINDEXEDPROC EndQueryIndexed; + PFNGLPROGRAMUNIFORM1FPROC ProgramUniform1f; + PFNGLBINDFRAMEBUFFERPROC BindFramebuffer; + PFNGLBEGINQUERYINDEXEDPROC BeginQueryIndexed; + PFNGLUNIFORMSUBROUTINESUIVPROC UniformSubroutinesuiv; + PFNGLGETUNIFORMIVPROC GetUniformiv; + PFNGLFRAMEBUFFERTEXTUREPROC FramebufferTexture; + PFNGLPOINTPARAMETERFVPROC PointParameterfv; + PFNGLISTRANSFORMFEEDBACKPROC IsTransformFeedback; + PFNGLCHECKFRAMEBUFFERSTATUSPROC CheckFramebufferStatus; + PFNGLSHADERSOURCEPROC ShaderSource; + PFNGLUNIFORMMATRIX2X4DVPROC UniformMatrix2x4dv; + PFNGLBINDIMAGETEXTURESPROC BindImageTextures; + PFNGLCOPYTEXIMAGE1DPROC CopyTexImage1D; + PFNGLUNIFORMMATRIX3DVPROC UniformMatrix3dv; + PFNGLPROGRAMUNIFORM1DVPROC ProgramUniform1dv; + PFNGLBLITFRAMEBUFFERPROC BlitFramebuffer; + PFNGLPOPDEBUGGROUPPROC PopDebugGroup; + PFNGLTEXPARAMETERIUIVPROC TexParameterIuiv; + PFNGLVERTEXATTRIB2DPROC VertexAttrib2d; + PFNGLTEXIMAGE1DPROC TexImage1D; + PFNGLGETOBJECTPTRLABELPROC GetObjectPtrLabel; + PFNGLSTENCILMASKPROC StencilMask; + PFNGLBEGINQUERYPROC BeginQuery; + PFNGLUNIFORMMATRIX4FVPROC UniformMatrix4fv; + PFNGLISSYNCPROC IsSync; + PFNGLUNIFORM3DVPROC Uniform3dv; + PFNGLPROGRAMUNIFORM2FVPROC ProgramUniform2fv; + PFNGLVERTEXATTRIBI4SVPROC VertexAttribI4sv; + PFNGLSCISSORARRAYVPROC ScissorArrayv; + PFNGLVERTEXATTRIBP1UIVPROC VertexAttribP1uiv; + PFNGLUNIFORM2UIVPROC Uniform2uiv; + PFNGLDELETEBUFFERSPROC DeleteBuffers; + PFNGLPROGRAMUNIFORM3UIPROC ProgramUniform3ui; + PFNGLFRAMEBUFFERTEXTURELAYERPROC FramebufferTextureLayer; + PFNGLENDTRANSFORMFEEDBACKPROC EndTransformFeedback; + PFNGLBLENDFUNCSEPARATEIPROC BlendFuncSeparatei; + PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC DrawTransformFeedbackInstanced; + PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC DrawRangeElementsBaseVertex; + PFNGLVERTEXATTRIB1FPROC VertexAttrib1f; + PFNGLGETUNIFORMSUBROUTINEUIVPROC GetUniformSubroutineuiv; + PFNGLDISABLEVERTEXATTRIBARRAYPROC DisableVertexAttribArray; + PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC ProgramUniformMatrix3x2fv; + PFNGLVERTEXATTRIBI4USVPROC VertexAttribI4usv; + PFNGLGETOBJECTLABELPROC GetObjectLabel; + PFNGLBINDATTRIBLOCATIONPROC BindAttribLocation; + PFNGLUNIFORM1FPROC Uniform1f; + PFNGLGETUNIFORMDVPROC GetUniformdv; + PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation; + PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC GetSubroutineUniformLocation; + PFNGLGETTEXPARAMETERIUIVPROC GetTexParameterIuiv; + PFNGLSAMPLERPARAMETERFPROC SamplerParameterf; + PFNGLVERTEXATTRIBL3DPROC VertexAttribL3d; + PFNGLTEXIMAGE3DMULTISAMPLEPROC TexImage3DMultisample; + PFNGLTEXIMAGE3DPROC TexImage3D; + PFNGLRENDERBUFFERSTORAGEPROC RenderbufferStorage; + PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray; + PFNGLVERTEXATTRIBP4UIVPROC VertexAttribP4uiv; + PFNGLUNIFORM4DPROC Uniform4d; + PFNGLVERTEXATTRIB4SPROC VertexAttrib4s; + PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC DrawElementsInstancedBaseVertex; + PFNGLVERTEXATTRIB3SPROC VertexAttrib3s; + PFNGLPROGRAMUNIFORM2IVPROC ProgramUniform2iv; + PFNGLSTENCILFUNCSEPARATEPROC StencilFuncSeparate; + PFNGLDELETEFRAMEBUFFERSPROC DeleteFramebuffers; + PFNGLDEPTHRANGEPROC DepthRange; + PFNGLUNIFORMMATRIX3X2FVPROC UniformMatrix3x2fv; + PFNGLPROGRAMUNIFORMMATRIX2DVPROC ProgramUniformMatrix2dv; + PFNGLSHADERSTORAGEBLOCKBINDINGPROC ShaderStorageBlockBinding; + PFNGLCLEARDEPTHPROC ClearDepth; + PFNGLVERTEXATTRIB2DVPROC VertexAttrib2dv; + PFNGLSAMPLERPARAMETERIUIVPROC SamplerParameterIuiv; + PFNGLGETVERTEXATTRIBLDVPROC GetVertexAttribLdv; + PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC ProgramUniformMatrix3x4dv; + PFNGLDEPTHRANGEARRAYVPROC DepthRangeArrayv; + PFNGLGETACTIVEUNIFORMPROC GetActiveUniform; + PFNGLPATCHPARAMETERFVPROC PatchParameterfv; + PFNGLINVALIDATETEXIMAGEPROC InvalidateTexImage; + PFNGLVERTEXATTRIB3FPROC VertexAttrib3f; + PFNGLPROGRAMUNIFORM4IVPROC ProgramUniform4iv; + PFNGLPROGRAMUNIFORM4DPROC ProgramUniform4d; + PFNGLISFRAMEBUFFERPROC IsFramebuffer; + PFNGLPIXELSTOREFPROC PixelStoref; + PFNGLPROGRAMUNIFORM4UIVPROC ProgramUniform4uiv; + PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC ProgramUniformMatrix4x2dv; + PFNGLFENCESYNCPROC FenceSync; + PFNGLGETBUFFERPARAMETERI64VPROC GetBufferParameteri64v; + PFNGLSTENCILOPPROC StencilOp; + PFNGLCLEARBUFFERDATAPROC ClearBufferData; + PFNGLGETNUNIFORMUIVPROC GetnUniformuiv; + PFNGLGETPROGRAMRESOURCEIVPROC GetProgramResourceiv; + PFNGLGETVERTEXATTRIBDVPROC GetVertexAttribdv; + PFNGLGETTRANSFORMFEEDBACKVARYINGPROC GetTransformFeedbackVarying; + PFNGLVERTEXATTRIB2FVPROC VertexAttrib2fv; + PFNGLGETBOOLEANI_VPROC GetBooleani_v; + PFNGLCOLORMASKIPROC ColorMaski; + PFNGLINVALIDATEBUFFERSUBDATAPROC InvalidateBufferSubData; + PFNGLUNIFORMMATRIX4DVPROC UniformMatrix4dv; + PFNGLISQUERYPROC IsQuery; + PFNGLUNIFORM4UIPROC Uniform4ui; + PFNGLUNIFORM4IPROC Uniform4i; + PFNGLGETSAMPLERPARAMETERIVPROC GetSamplerParameteriv; + PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC MultiDrawElementsBaseVertex; + PFNGLVERTEXATTRIBI1UIVPROC VertexAttribI1uiv; + PFNGLGETINTEGERVPROC GetIntegerv; + PFNGLUNIFORMMATRIX2X3FVPROC UniformMatrix2x3fv; + PFNGLTEXIMAGE2DPROC TexImage2D; + PFNGLGETATTACHEDSHADERSPROC GetAttachedShaders; + PFNGLUNIFORM2DPROC Uniform2d; + PFNGLMEMORYBARRIERBYREGIONPROC MemoryBarrierByRegion; + PFNGLUNIFORMMATRIX2FVPROC UniformMatrix2fv; + PFNGLPRIMITIVERESTARTINDEXPROC PrimitiveRestartIndex; + PFNGLGETVERTEXATTRIBIVPROC GetVertexAttribiv; + PFNGLGETATTRIBLOCATIONPROC GetAttribLocation; + PFNGLTEXSTORAGE2DMULTISAMPLEPROC TexStorage2DMultisample; + PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC CompressedTexSubImage2D; + PFNGLGETVERTEXATTRIBFVPROC GetVertexAttribfv; + PFNGLGETBUFFERPARAMETERIVPROC GetBufferParameteriv; + PFNGLTEXPARAMETERFPROC TexParameterf; + PFNGLFRAMEBUFFERTEXTURE2DPROC FramebufferTexture2D; + PFNGLGETACTIVEATTRIBPROC GetActiveAttrib; + PFNGLINVALIDATETEXSUBIMAGEPROC InvalidateTexSubImage; + PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays; + PFNGLVERTEXATTRIBI2UIPROC VertexAttribI2ui; + PFNGLPOINTPARAMETERIVPROC PointParameteriv; + PFNGLGETPOINTERVPROC GetPointerv; + PFNGLENABLEIPROC Enablei; + PFNGLBINDBUFFERRANGEPROC BindBufferRange; + PFNGLDRAWARRAYSINSTANCEDPROC DrawArraysInstanced; + PFNGLDELETETEXTURESPROC DeleteTextures; + PFNGLVERTEXATTRIB4NIVPROC VertexAttrib4Niv; + PFNGLMULTIDRAWELEMENTSPROC MultiDrawElements; + PFNGLGETPROGRAMIVPROC GetProgramiv; + PFNGLDEPTHFUNCPROC DepthFunc; + PFNGLGENTEXTURESPROC GenTextures; + PFNGLGETINTERNALFORMATIVPROC GetInternalformativ; + PFNGLPROGRAMUNIFORM3IPROC ProgramUniform3i; + PFNGLSCISSORINDEXEDPROC ScissorIndexed; + PFNGLVERTEXATTRIB2SVPROC VertexAttrib2sv; + PFNGLTEXSTORAGE3DMULTISAMPLEPROC TexStorage3DMultisample; + PFNGLUNIFORM2IVPROC Uniform2iv; + PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC DrawArraysInstancedBaseInstance; + PFNGLVERTEXATTRIBI3UIPROC VertexAttribI3ui; + PFNGLDELETESAMPLERSPROC DeleteSamplers; + PFNGLGENVERTEXARRAYSPROC GenVertexArrays; + PFNGLGETFRAMEBUFFERPARAMETERIVPROC GetFramebufferParameteriv; + PFNGLPOLYGONMODEPROC PolygonMode; + PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC ProgramUniformMatrix2x4fv; + PFNGLGETPROGRAMRESOURCENAMEPROC GetProgramResourceName; + PFNGLSAMPLERPARAMETERIVPROC SamplerParameteriv; + PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC GetActiveSubroutineUniformiv; + PFNGLGETSTRINGIPROC GetStringi; + PFNGLVERTEXATTRIBLFORMATPROC VertexAttribLFormat; + PFNGLVERTEXATTRIB3DPROC VertexAttrib3d; + PFNGLBINDVERTEXARRAYPROC BindVertexArray; + PFNGLUNMAPBUFFERPROC UnmapBuffer; + PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC DrawElementsInstancedBaseInstance; + PFNGLUNIFORM4UIVPROC Uniform4uiv; + PFNGLFRAMEBUFFERTEXTURE1DPROC FramebufferTexture1D; + PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC DrawTransformFeedbackStreamInstanced; + PFNGLSTENCILFUNCPROC StencilFunc; + PFNGLVALIDATEPROGRAMPROC ValidateProgram; + PFNGLFLUSHPROC Flush; + PFNGLPROGRAMUNIFORM3UIVPROC ProgramUniform3uiv; + PFNGLDELETERENDERBUFFERSPROC DeleteRenderbuffers; + PFNGLVERTEXATTRIB4FVPROC VertexAttrib4fv; + PFNGLUNIFORMMATRIX2DVPROC UniformMatrix2dv; + PFNGLGETFRAGDATAINDEXPROC GetFragDataIndex; + PFNGLUNIFORM3IVPROC Uniform3iv; + PFNGLMINSAMPLESHADINGPROC MinSampleShading; + PFNGLGETBOOLEANVPROC GetBooleanv; + PFNGLGETMULTISAMPLEFVPROC GetMultisamplefv; + PFNGLGETVERTEXATTRIBIUIVPROC GetVertexAttribIuiv; + PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog; + PFNGLUNIFORM4FVPROC Uniform4fv; + PFNGLDRAWBUFFERPROC DrawBuffer; + PFNGLUNIFORM1IPROC Uniform1i; + PFNGLPROGRAMUNIFORM4UIPROC ProgramUniform4ui; + PFNGLPROGRAMUNIFORMMATRIX3FVPROC ProgramUniformMatrix3fv; + PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate; + PFNGLBINDPROGRAMPIPELINEPROC BindProgramPipeline; + PFNGLGETDOUBLEI_VPROC GetDoublei_v; + PFNGLBUFFERDATAPROC BufferData; + PFNGLCLEARCOLORPROC ClearColor; + PFNGLPROGRAMUNIFORM4IPROC ProgramUniform4i; + PFNGLGETTEXLEVELPARAMETERIVPROC GetTexLevelParameteriv; + PFNGLGETACTIVEUNIFORMBLOCKIVPROC GetActiveUniformBlockiv; + PFNGLPROGRAMUNIFORM1FVPROC ProgramUniform1fv; + PFNGLPAUSETRANSFORMFEEDBACKPROC PauseTransformFeedback; + PFNGLGETBUFFERPOINTERVPROC GetBufferPointerv; + PFNGLINVALIDATESUBFRAMEBUFFERPROC InvalidateSubFramebuffer; + PFNGLSCISSORINDEXEDVPROC ScissorIndexedv; + PFNGLUNIFORM2UIPROC Uniform2ui; + PFNGLBINDTEXTUREPROC BindTexture; + PFNGLDRAWELEMENTSINSTANCEDPROC DrawElementsInstanced; + PFNGLPROGRAMUNIFORM4FPROC ProgramUniform4f; + PFNGLBINDBUFFERBASEPROC BindBufferBase; + PFNGLISSHADERPROC IsShader; + PFNGLCLEARBUFFERSUBDATAPROC ClearBufferSubData; + PFNGLVERTEXATTRIB4NUIVPROC VertexAttrib4Nuiv; + PFNGLDRAWARRAYSINDIRECTPROC DrawArraysIndirect; + PFNGLVERTEXATTRIB4USVPROC VertexAttrib4usv; + PFNGLUNIFORM1DPROC Uniform1d; + PFNGLCLEARTEXIMAGEPROC ClearTexImage; + PFNGLUNIFORM1UIVPROC Uniform1uiv; + PFNGLBINDSAMPLERPROC BindSampler; + PFNGLGETTEXLEVELPARAMETERFVPROC GetTexLevelParameterfv; + PFNGLCLEARBUFFERIVPROC ClearBufferiv; + PFNGLLOGICOPPROC LogicOp; + PFNGLACTIVETEXTUREPROC ActiveTexture; + PFNGLGETFRAGDATALOCATIONPROC GetFragDataLocation; + PFNGLBLENDCOLORPROC BlendColor; + PFNGLUNIFORMMATRIX4X3FVPROC UniformMatrix4x3fv; + PFNGLPROGRAMUNIFORM3FVPROC ProgramUniform3fv; + PFNGLUNIFORM1FVPROC Uniform1fv; + PFNGLDRAWELEMENTSBASEVERTEXPROC DrawElementsBaseVertex; + PFNGLUNIFORM4FPROC Uniform4f; + PFNGLBLENDEQUATIONSEPARATEIPROC BlendEquationSeparatei; + PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate; + PFNGLCLEARBUFFERUIVPROC ClearBufferuiv; + PFNGLCOPYTEXSUBIMAGE1DPROC CopyTexSubImage1D; + PFNGLDRAWTRANSFORMFEEDBACKPROC DrawTransformFeedback; + PFNGLREADBUFFERPROC ReadBuffer; + PFNGLCOPYBUFFERSUBDATAPROC CopyBufferSubData; + PFNGLGETUNIFORMUIVPROC GetUniformuiv; + PFNGLPOLYGONOFFSETPROC PolygonOffset; + PFNGLDISPATCHCOMPUTEPROC DispatchCompute; + PFNGLBINDIMAGETEXTUREPROC BindImageTexture; + PFNGLUNIFORMMATRIX4X3DVPROC UniformMatrix4x3dv; + PFNGLGENRENDERBUFFERSPROC GenRenderbuffers; +} oc_gl_api; + +ORCA_API oc_gl_api* oc_gl_get_api(void); + +#define glGetFloatv oc_gl_get_api()->GetFloatv +#define glTexBufferRange oc_gl_get_api()->TexBufferRange +#define glIsBuffer oc_gl_get_api()->IsBuffer +#define glIsTexture oc_gl_get_api()->IsTexture +#define glDepthRangef oc_gl_get_api()->DepthRangef +#define glEndConditionalRender oc_gl_get_api()->EndConditionalRender +#define glBlendFunci oc_gl_get_api()->BlendFunci +#define glGetProgramPipelineiv oc_gl_get_api()->GetProgramPipelineiv +#define glWaitSync oc_gl_get_api()->WaitSync +#define glProgramUniformMatrix2fv oc_gl_get_api()->ProgramUniformMatrix2fv +#define glProgramUniformMatrix4x3dv oc_gl_get_api()->ProgramUniformMatrix4x3dv +#define glVertexAttrib1dv oc_gl_get_api()->VertexAttrib1dv +#define glSamplerParameteri oc_gl_get_api()->SamplerParameteri +#define glGetVertexAttribIiv oc_gl_get_api()->GetVertexAttribIiv +#define glGetSamplerParameterfv oc_gl_get_api()->GetSamplerParameterfv +#define glVertexAttrib1d oc_gl_get_api()->VertexAttrib1d +#define glTexBuffer oc_gl_get_api()->TexBuffer +#define glInvalidateBufferData oc_gl_get_api()->InvalidateBufferData +#define glProgramUniform2i oc_gl_get_api()->ProgramUniform2i +#define glUniform4dv oc_gl_get_api()->Uniform4dv +#define glUseProgram oc_gl_get_api()->UseProgram +#define glVertexAttribI3iv oc_gl_get_api()->VertexAttribI3iv +#define glDrawElementsIndirect oc_gl_get_api()->DrawElementsIndirect +#define glVertexAttrib4uiv oc_gl_get_api()->VertexAttrib4uiv +#define glGetQueryObjectiv oc_gl_get_api()->GetQueryObjectiv +#define glFramebufferRenderbuffer oc_gl_get_api()->FramebufferRenderbuffer +#define glBlendEquationi oc_gl_get_api()->BlendEquationi +#define glGetActiveSubroutineName oc_gl_get_api()->GetActiveSubroutineName +#define glVertexAttrib2s oc_gl_get_api()->VertexAttrib2s +#define glVertexAttribL1d oc_gl_get_api()->VertexAttribL1d +#define glBindTextures oc_gl_get_api()->BindTextures +#define glVertexAttrib3sv oc_gl_get_api()->VertexAttrib3sv +#define glGetFloati_v oc_gl_get_api()->GetFloati_v +#define glBeginTransformFeedback oc_gl_get_api()->BeginTransformFeedback +#define glClearStencil oc_gl_get_api()->ClearStencil +#define glUniform3i oc_gl_get_api()->Uniform3i +#define glValidateProgramPipeline oc_gl_get_api()->ValidateProgramPipeline +#define glProgramUniformMatrix4x2fv oc_gl_get_api()->ProgramUniformMatrix4x2fv +#define glVertexAttribI4ui oc_gl_get_api()->VertexAttribI4ui +#define glGetShaderiv oc_gl_get_api()->GetShaderiv +#define glReadnPixels oc_gl_get_api()->ReadnPixels +#define glUniformMatrix4x2fv oc_gl_get_api()->UniformMatrix4x2fv +#define glGetShaderPrecisionFormat oc_gl_get_api()->GetShaderPrecisionFormat +#define glProgramUniformMatrix2x3fv oc_gl_get_api()->ProgramUniformMatrix2x3fv +#define glTexSubImage3D oc_gl_get_api()->TexSubImage3D +#define glGetProgramResourceLocationIndex oc_gl_get_api()->GetProgramResourceLocationIndex +#define glBlendFunc oc_gl_get_api()->BlendFunc +#define glProgramUniformMatrix3x4fv oc_gl_get_api()->ProgramUniformMatrix3x4fv +#define glUniform3d oc_gl_get_api()->Uniform3d +#define glVertexAttrib1sv oc_gl_get_api()->VertexAttrib1sv +#define glBindFragDataLocation oc_gl_get_api()->BindFragDataLocation +#define glVertexAttrib4bv oc_gl_get_api()->VertexAttrib4bv +#define glUniform4iv oc_gl_get_api()->Uniform4iv +#define glProgramUniform2ui oc_gl_get_api()->ProgramUniform2ui +#define glDrawArrays oc_gl_get_api()->DrawArrays +#define glProgramBinary oc_gl_get_api()->ProgramBinary +#define glVertexAttrib4f oc_gl_get_api()->VertexAttrib4f +#define glVertexAttribP2uiv oc_gl_get_api()->VertexAttribP2uiv +#define glUniformMatrix3fv oc_gl_get_api()->UniformMatrix3fv +#define glUniform2i oc_gl_get_api()->Uniform2i +#define glGetQueryObjectuiv oc_gl_get_api()->GetQueryObjectuiv +#define glUniformBlockBinding oc_gl_get_api()->UniformBlockBinding +#define glSampleCoverage oc_gl_get_api()->SampleCoverage +#define glVertexAttrib4Nusv oc_gl_get_api()->VertexAttrib4Nusv +#define glProgramUniformMatrix2x4dv oc_gl_get_api()->ProgramUniformMatrix2x4dv +#define glUniform3uiv oc_gl_get_api()->Uniform3uiv +#define glVertexAttrib1s oc_gl_get_api()->VertexAttrib1s +#define glGetVertexAttribPointerv oc_gl_get_api()->GetVertexAttribPointerv +#define glBlendBarrier oc_gl_get_api()->BlendBarrier +#define glDrawRangeElements oc_gl_get_api()->DrawRangeElements +#define glTexStorage3D oc_gl_get_api()->TexStorage3D +#define glGetInternalformati64v oc_gl_get_api()->GetInternalformati64v +#define glGetQueryObjecti64v oc_gl_get_api()->GetQueryObjecti64v +#define glCompressedTexSubImage1D oc_gl_get_api()->CompressedTexSubImage1D +#define glVertexAttrib3dv oc_gl_get_api()->VertexAttrib3dv +#define glVertexBindingDivisor oc_gl_get_api()->VertexBindingDivisor +#define glUseProgramStages oc_gl_get_api()->UseProgramStages +#define glVertexAttribBinding oc_gl_get_api()->VertexAttribBinding +#define glDebugMessageInsert oc_gl_get_api()->DebugMessageInsert +#define glGetTexParameteriv oc_gl_get_api()->GetTexParameteriv +#define glMultiDrawArraysIndirect oc_gl_get_api()->MultiDrawArraysIndirect +#define glGetTexParameterfv oc_gl_get_api()->GetTexParameterfv +#define glGetProgramPipelineInfoLog oc_gl_get_api()->GetProgramPipelineInfoLog +#define glEndQuery oc_gl_get_api()->EndQuery +#define glGetProgramResourceLocation oc_gl_get_api()->GetProgramResourceLocation +#define glCompressedTexImage2D oc_gl_get_api()->CompressedTexImage2D +#define glVertexAttribP2ui oc_gl_get_api()->VertexAttribP2ui +#define glIsEnabledi oc_gl_get_api()->IsEnabledi +#define glGetActiveAtomicCounterBufferiv oc_gl_get_api()->GetActiveAtomicCounterBufferiv +#define glIsProgram oc_gl_get_api()->IsProgram +#define glUniform1dv oc_gl_get_api()->Uniform1dv +#define glTexParameteriv oc_gl_get_api()->TexParameteriv +#define glUniform2fv oc_gl_get_api()->Uniform2fv +#define glReleaseShaderCompiler oc_gl_get_api()->ReleaseShaderCompiler +#define glCullFace oc_gl_get_api()->CullFace +#define glVertexAttribI4i oc_gl_get_api()->VertexAttribI4i +#define glGetProgramResourceIndex oc_gl_get_api()->GetProgramResourceIndex +#define glShaderBinary oc_gl_get_api()->ShaderBinary +#define glUniformMatrix3x2dv oc_gl_get_api()->UniformMatrix3x2dv +#define glInvalidateFramebuffer oc_gl_get_api()->InvalidateFramebuffer +#define glAttachShader oc_gl_get_api()->AttachShader +#define glFlushMappedBufferRange oc_gl_get_api()->FlushMappedBufferRange +#define glVertexAttribP3uiv oc_gl_get_api()->VertexAttribP3uiv +#define glGetActiveUniformName oc_gl_get_api()->GetActiveUniformName +#define glMapBuffer oc_gl_get_api()->MapBuffer +#define glDrawBuffers oc_gl_get_api()->DrawBuffers +#define glGetSynciv oc_gl_get_api()->GetSynciv +#define glCopyTexSubImage2D oc_gl_get_api()->CopyTexSubImage2D +#define glObjectLabel oc_gl_get_api()->ObjectLabel +#define glBufferSubData oc_gl_get_api()->BufferSubData +#define glUniform2f oc_gl_get_api()->Uniform2f +#define glDebugMessageCallback oc_gl_get_api()->DebugMessageCallback +#define glVertexAttribL4dv oc_gl_get_api()->VertexAttribL4dv +#define glIsProgramPipeline oc_gl_get_api()->IsProgramPipeline +#define glResumeTransformFeedback oc_gl_get_api()->ResumeTransformFeedback +#define glVertexAttribI4iv oc_gl_get_api()->VertexAttribI4iv +#define glGetShaderInfoLog oc_gl_get_api()->GetShaderInfoLog +#define glGetIntegeri_v oc_gl_get_api()->GetIntegeri_v +#define glBindVertexBuffer oc_gl_get_api()->BindVertexBuffer +#define glBlendEquation oc_gl_get_api()->BlendEquation +#define glVertexAttribL2dv oc_gl_get_api()->VertexAttribL2dv +#define glVertexAttribI1ui oc_gl_get_api()->VertexAttribI1ui +#define glVertexAttrib4Nsv oc_gl_get_api()->VertexAttrib4Nsv +#define glVertexAttribL4d oc_gl_get_api()->VertexAttribL4d +#define glCopyImageSubData oc_gl_get_api()->CopyImageSubData +#define glGetFramebufferAttachmentParameteriv oc_gl_get_api()->GetFramebufferAttachmentParameteriv +#define glVertexAttribL2d oc_gl_get_api()->VertexAttribL2d +#define glGetSubroutineIndex oc_gl_get_api()->GetSubroutineIndex +#define glVertexAttribI3uiv oc_gl_get_api()->VertexAttribI3uiv +#define glVertexAttrib4iv oc_gl_get_api()->VertexAttrib4iv +#define glBindVertexBuffers oc_gl_get_api()->BindVertexBuffers +#define glProgramUniformMatrix2x3dv oc_gl_get_api()->ProgramUniformMatrix2x3dv +#define glPrimitiveBoundingBox oc_gl_get_api()->PrimitiveBoundingBox +#define glScissor oc_gl_get_api()->Scissor +#define glClientWaitSync oc_gl_get_api()->ClientWaitSync +#define glUniform3ui oc_gl_get_api()->Uniform3ui +#define glVertexAttribP3ui oc_gl_get_api()->VertexAttribP3ui +#define glEnable oc_gl_get_api()->Enable +#define glStencilOpSeparate oc_gl_get_api()->StencilOpSeparate +#define glUniformMatrix2x3dv oc_gl_get_api()->UniformMatrix2x3dv +#define glProgramUniformMatrix3dv oc_gl_get_api()->ProgramUniformMatrix3dv +#define glTexImage2DMultisample oc_gl_get_api()->TexImage2DMultisample +#define glVertexAttrib4Nbv oc_gl_get_api()->VertexAttrib4Nbv +#define glGetTexImage oc_gl_get_api()->GetTexImage +#define glVertexAttrib4sv oc_gl_get_api()->VertexAttrib4sv +#define glPixelStorei oc_gl_get_api()->PixelStorei +#define glDepthMask oc_gl_get_api()->DepthMask +#define glTexStorage2D oc_gl_get_api()->TexStorage2D +#define glClear oc_gl_get_api()->Clear +#define glUniformMatrix3x4dv oc_gl_get_api()->UniformMatrix3x4dv +#define glDeleteTransformFeedbacks oc_gl_get_api()->DeleteTransformFeedbacks +#define glMapBufferRange oc_gl_get_api()->MapBufferRange +#define glMemoryBarrier oc_gl_get_api()->MemoryBarrier +#define glViewportIndexedf oc_gl_get_api()->ViewportIndexedf +#define glVertexAttrib3fv oc_gl_get_api()->VertexAttrib3fv +#define glObjectPtrLabel oc_gl_get_api()->ObjectPtrLabel +#define glTexStorage1D oc_gl_get_api()->TexStorage1D +#define glCompressedTexImage3D oc_gl_get_api()->CompressedTexImage3D +#define glVertexAttrib1fv oc_gl_get_api()->VertexAttrib1fv +#define glVertexAttribPointer oc_gl_get_api()->VertexAttribPointer +#define glGetQueryIndexediv oc_gl_get_api()->GetQueryIndexediv +#define glCompileShader oc_gl_get_api()->CompileShader +#define glProgramUniform1i oc_gl_get_api()->ProgramUniform1i +#define glGetQueryiv oc_gl_get_api()->GetQueryiv +#define glVertexAttribI1iv oc_gl_get_api()->VertexAttribI1iv +#define glCopyTexImage2D oc_gl_get_api()->CopyTexImage2D +#define glGetQueryObjectui64v oc_gl_get_api()->GetQueryObjectui64v +#define glPointSize oc_gl_get_api()->PointSize +#define glDisablei oc_gl_get_api()->Disablei +#define glVertexAttribL1dv oc_gl_get_api()->VertexAttribL1dv +#define glCreateShader oc_gl_get_api()->CreateShader +#define glGetString oc_gl_get_api()->GetString +#define glViewportArrayv oc_gl_get_api()->ViewportArrayv +#define glProgramUniform3d oc_gl_get_api()->ProgramUniform3d +#define glVertexAttrib4Nubv oc_gl_get_api()->VertexAttrib4Nubv +#define glTexParameteri oc_gl_get_api()->TexParameteri +#define glProgramUniform4fv oc_gl_get_api()->ProgramUniform4fv +#define glGenerateMipmap oc_gl_get_api()->GenerateMipmap +#define glCompressedTexSubImage3D oc_gl_get_api()->CompressedTexSubImage3D +#define glUniform3f oc_gl_get_api()->Uniform3f +#define glGetUniformIndices oc_gl_get_api()->GetUniformIndices +#define glVertexAttribLPointer oc_gl_get_api()->VertexAttribLPointer +#define glVertexAttribI2uiv oc_gl_get_api()->VertexAttribI2uiv +#define glQueryCounter oc_gl_get_api()->QueryCounter +#define glActiveShaderProgram oc_gl_get_api()->ActiveShaderProgram +#define glUniform1ui oc_gl_get_api()->Uniform1ui +#define glVertexAttribI1i oc_gl_get_api()->VertexAttribI1i +#define glGetTexParameterIiv oc_gl_get_api()->GetTexParameterIiv +#define glGetUniformfv oc_gl_get_api()->GetUniformfv +#define glProgramUniform2uiv oc_gl_get_api()->ProgramUniform2uiv +#define glGetError oc_gl_get_api()->GetError +#define glGetActiveUniformBlockName oc_gl_get_api()->GetActiveUniformBlockName +#define glTextureView oc_gl_get_api()->TextureView +#define glGetnUniformiv oc_gl_get_api()->GetnUniformiv +#define glProgramUniform4dv oc_gl_get_api()->ProgramUniform4dv +#define glViewportIndexedfv oc_gl_get_api()->ViewportIndexedfv +#define glHint oc_gl_get_api()->Hint +#define glGetShaderSource oc_gl_get_api()->GetShaderSource +#define glProgramUniformMatrix4x3fv oc_gl_get_api()->ProgramUniformMatrix4x3fv +#define glUniform1iv oc_gl_get_api()->Uniform1iv +#define glVertexAttribI4bv oc_gl_get_api()->VertexAttribI4bv +#define glUniformMatrix4x2dv oc_gl_get_api()->UniformMatrix4x2dv +#define glBufferStorage oc_gl_get_api()->BufferStorage +#define glIsRenderbuffer oc_gl_get_api()->IsRenderbuffer +#define glGetActiveSubroutineUniformName oc_gl_get_api()->GetActiveSubroutineUniformName +#define glLinkProgram oc_gl_get_api()->LinkProgram +#define glGetActiveUniformsiv oc_gl_get_api()->GetActiveUniformsiv +#define glGetDebugMessageLog oc_gl_get_api()->GetDebugMessageLog +#define glCopyTexSubImage3D oc_gl_get_api()->CopyTexSubImage3D +#define glPointParameteri oc_gl_get_api()->PointParameteri +#define glProgramUniform3dv oc_gl_get_api()->ProgramUniform3dv +#define glCompressedTexImage1D oc_gl_get_api()->CompressedTexImage1D +#define glUniformMatrix3x4fv oc_gl_get_api()->UniformMatrix3x4fv +#define glGenSamplers oc_gl_get_api()->GenSamplers +#define glGetCompressedTexImage oc_gl_get_api()->GetCompressedTexImage +#define glDeleteQueries oc_gl_get_api()->DeleteQueries +#define glGenProgramPipelines oc_gl_get_api()->GenProgramPipelines +#define glDispatchComputeIndirect oc_gl_get_api()->DispatchComputeIndirect +#define glVertexAttribIPointer oc_gl_get_api()->VertexAttribIPointer +#define glCreateProgram oc_gl_get_api()->CreateProgram +#define glClearTexSubImage oc_gl_get_api()->ClearTexSubImage +#define glVertexAttrib4d oc_gl_get_api()->VertexAttrib4d +#define glFrontFace oc_gl_get_api()->FrontFace +#define glBindTransformFeedback oc_gl_get_api()->BindTransformFeedback +#define glGetProgramStageiv oc_gl_get_api()->GetProgramStageiv +#define glSamplerParameterIiv oc_gl_get_api()->SamplerParameterIiv +#define glGetInteger64v oc_gl_get_api()->GetInteger64v +#define glCreateShaderProgramv oc_gl_get_api()->CreateShaderProgramv +#define glBindBuffersRange oc_gl_get_api()->BindBuffersRange +#define glUniform3fv oc_gl_get_api()->Uniform3fv +#define glProgramUniformMatrix4fv oc_gl_get_api()->ProgramUniformMatrix4fv +#define glBindBuffersBase oc_gl_get_api()->BindBuffersBase +#define glClearBufferfi oc_gl_get_api()->ClearBufferfi +#define glFramebufferTexture3D oc_gl_get_api()->FramebufferTexture3D +#define glDisable oc_gl_get_api()->Disable +#define glProgramUniform1iv oc_gl_get_api()->ProgramUniform1iv +#define glVertexAttribI2iv oc_gl_get_api()->VertexAttribI2iv +#define glDepthRangeIndexed oc_gl_get_api()->DepthRangeIndexed +#define glPatchParameteri oc_gl_get_api()->PatchParameteri +#define glGetUniformBlockIndex oc_gl_get_api()->GetUniformBlockIndex +#define glMultiDrawArrays oc_gl_get_api()->MultiDrawArrays +#define glVertexAttribI4ubv oc_gl_get_api()->VertexAttribI4ubv +#define glBindBuffer oc_gl_get_api()->BindBuffer +#define glVertexAttribI3i oc_gl_get_api()->VertexAttribI3i +#define glGetDoublev oc_gl_get_api()->GetDoublev +#define glDrawTransformFeedbackStream oc_gl_get_api()->DrawTransformFeedbackStream +#define glVertexAttribI4uiv oc_gl_get_api()->VertexAttribI4uiv +#define glRenderbufferStorageMultisample oc_gl_get_api()->RenderbufferStorageMultisample +#define glVertexAttribL3dv oc_gl_get_api()->VertexAttribL3dv +#define glStencilMaskSeparate oc_gl_get_api()->StencilMaskSeparate +#define glProgramUniform1d oc_gl_get_api()->ProgramUniform1d +#define glViewport oc_gl_get_api()->Viewport +#define glVertexAttribP1ui oc_gl_get_api()->VertexAttribP1ui +#define glVertexAttrib4dv oc_gl_get_api()->VertexAttrib4dv +#define glGenQueries oc_gl_get_api()->GenQueries +#define glTexParameterIiv oc_gl_get_api()->TexParameterIiv +#define glProgramUniform2d oc_gl_get_api()->ProgramUniform2d +#define glProgramUniform1uiv oc_gl_get_api()->ProgramUniform1uiv +#define glVertexAttrib4Nub oc_gl_get_api()->VertexAttrib4Nub +#define glIsVertexArray oc_gl_get_api()->IsVertexArray +#define glProgramUniform3f oc_gl_get_api()->ProgramUniform3f +#define glProgramUniform3iv oc_gl_get_api()->ProgramUniform3iv +#define glGetProgramBinary oc_gl_get_api()->GetProgramBinary +#define glBindRenderbuffer oc_gl_get_api()->BindRenderbuffer +#define glBindFragDataLocationIndexed oc_gl_get_api()->BindFragDataLocationIndexed +#define glGetSamplerParameterIiv oc_gl_get_api()->GetSamplerParameterIiv +#define glVertexAttribDivisor oc_gl_get_api()->VertexAttribDivisor +#define glProgramUniformMatrix3x2dv oc_gl_get_api()->ProgramUniformMatrix3x2dv +#define glFramebufferParameteri oc_gl_get_api()->FramebufferParameteri +#define glGenTransformFeedbacks oc_gl_get_api()->GenTransformFeedbacks +#define glDeleteSync oc_gl_get_api()->DeleteSync +#define glProgramUniform1ui oc_gl_get_api()->ProgramUniform1ui +#define glTexSubImage1D oc_gl_get_api()->TexSubImage1D +#define glClearDepthf oc_gl_get_api()->ClearDepthf +#define glReadPixels oc_gl_get_api()->ReadPixels +#define glVertexAttribI2i oc_gl_get_api()->VertexAttribI2i +#define glFinish oc_gl_get_api()->Finish +#define glLineWidth oc_gl_get_api()->LineWidth +#define glDeleteShader oc_gl_get_api()->DeleteShader +#define glIsSampler oc_gl_get_api()->IsSampler +#define glProgramUniformMatrix4dv oc_gl_get_api()->ProgramUniformMatrix4dv +#define glTransformFeedbackVaryings oc_gl_get_api()->TransformFeedbackVaryings +#define glBeginConditionalRender oc_gl_get_api()->BeginConditionalRender +#define glBindSamplers oc_gl_get_api()->BindSamplers +#define glDeleteProgramPipelines oc_gl_get_api()->DeleteProgramPipelines +#define glColorMask oc_gl_get_api()->ColorMask +#define glTexParameterfv oc_gl_get_api()->TexParameterfv +#define glPushDebugGroup oc_gl_get_api()->PushDebugGroup +#define glClearBufferfv oc_gl_get_api()->ClearBufferfv +#define glIsEnabled oc_gl_get_api()->IsEnabled +#define glVertexAttrib2f oc_gl_get_api()->VertexAttrib2f +#define glProgramUniform2f oc_gl_get_api()->ProgramUniform2f +#define glGetSamplerParameterIuiv oc_gl_get_api()->GetSamplerParameterIuiv +#define glGetInteger64i_v oc_gl_get_api()->GetInteger64i_v +#define glUniform2dv oc_gl_get_api()->Uniform2dv +#define glGetBufferSubData oc_gl_get_api()->GetBufferSubData +#define glMultiDrawElementsIndirect oc_gl_get_api()->MultiDrawElementsIndirect +#define glProgramParameteri oc_gl_get_api()->ProgramParameteri +#define glVertexAttribP4ui oc_gl_get_api()->VertexAttribP4ui +#define glSamplerParameterfv oc_gl_get_api()->SamplerParameterfv +#define glPointParameterf oc_gl_get_api()->PointParameterf +#define glUniformMatrix2x4fv oc_gl_get_api()->UniformMatrix2x4fv +#define glGenBuffers oc_gl_get_api()->GenBuffers +#define glProgramUniform2dv oc_gl_get_api()->ProgramUniform2dv +#define glVertexAttribFormat oc_gl_get_api()->VertexAttribFormat +#define glTexSubImage2D oc_gl_get_api()->TexSubImage2D +#define glVertexAttrib4ubv oc_gl_get_api()->VertexAttrib4ubv +#define glGetGraphicsResetStatus oc_gl_get_api()->GetGraphicsResetStatus +#define glGetProgramInterfaceiv oc_gl_get_api()->GetProgramInterfaceiv +#define glVertexAttribIFormat oc_gl_get_api()->VertexAttribIFormat +#define glGetnUniformfv oc_gl_get_api()->GetnUniformfv +#define glDeleteProgram oc_gl_get_api()->DeleteProgram +#define glClampColor oc_gl_get_api()->ClampColor +#define glDrawElementsInstancedBaseVertexBaseInstance oc_gl_get_api()->DrawElementsInstancedBaseVertexBaseInstance +#define glDrawElements oc_gl_get_api()->DrawElements +#define glDebugMessageControl oc_gl_get_api()->DebugMessageControl +#define glGetRenderbufferParameteriv oc_gl_get_api()->GetRenderbufferParameteriv +#define glDetachShader oc_gl_get_api()->DetachShader +#define glGenFramebuffers oc_gl_get_api()->GenFramebuffers +#define glProvokingVertex oc_gl_get_api()->ProvokingVertex +#define glSampleMaski oc_gl_get_api()->SampleMaski +#define glEndQueryIndexed oc_gl_get_api()->EndQueryIndexed +#define glProgramUniform1f oc_gl_get_api()->ProgramUniform1f +#define glBindFramebuffer oc_gl_get_api()->BindFramebuffer +#define glBeginQueryIndexed oc_gl_get_api()->BeginQueryIndexed +#define glUniformSubroutinesuiv oc_gl_get_api()->UniformSubroutinesuiv +#define glGetUniformiv oc_gl_get_api()->GetUniformiv +#define glFramebufferTexture oc_gl_get_api()->FramebufferTexture +#define glPointParameterfv oc_gl_get_api()->PointParameterfv +#define glIsTransformFeedback oc_gl_get_api()->IsTransformFeedback +#define glCheckFramebufferStatus oc_gl_get_api()->CheckFramebufferStatus +#define glShaderSource oc_gl_get_api()->ShaderSource +#define glUniformMatrix2x4dv oc_gl_get_api()->UniformMatrix2x4dv +#define glBindImageTextures oc_gl_get_api()->BindImageTextures +#define glCopyTexImage1D oc_gl_get_api()->CopyTexImage1D +#define glUniformMatrix3dv oc_gl_get_api()->UniformMatrix3dv +#define glProgramUniform1dv oc_gl_get_api()->ProgramUniform1dv +#define glBlitFramebuffer oc_gl_get_api()->BlitFramebuffer +#define glPopDebugGroup oc_gl_get_api()->PopDebugGroup +#define glTexParameterIuiv oc_gl_get_api()->TexParameterIuiv +#define glVertexAttrib2d oc_gl_get_api()->VertexAttrib2d +#define glTexImage1D oc_gl_get_api()->TexImage1D +#define glGetObjectPtrLabel oc_gl_get_api()->GetObjectPtrLabel +#define glStencilMask oc_gl_get_api()->StencilMask +#define glBeginQuery oc_gl_get_api()->BeginQuery +#define glUniformMatrix4fv oc_gl_get_api()->UniformMatrix4fv +#define glIsSync oc_gl_get_api()->IsSync +#define glUniform3dv oc_gl_get_api()->Uniform3dv +#define glProgramUniform2fv oc_gl_get_api()->ProgramUniform2fv +#define glVertexAttribI4sv oc_gl_get_api()->VertexAttribI4sv +#define glScissorArrayv oc_gl_get_api()->ScissorArrayv +#define glVertexAttribP1uiv oc_gl_get_api()->VertexAttribP1uiv +#define glUniform2uiv oc_gl_get_api()->Uniform2uiv +#define glDeleteBuffers oc_gl_get_api()->DeleteBuffers +#define glProgramUniform3ui oc_gl_get_api()->ProgramUniform3ui +#define glFramebufferTextureLayer oc_gl_get_api()->FramebufferTextureLayer +#define glEndTransformFeedback oc_gl_get_api()->EndTransformFeedback +#define glBlendFuncSeparatei oc_gl_get_api()->BlendFuncSeparatei +#define glDrawTransformFeedbackInstanced oc_gl_get_api()->DrawTransformFeedbackInstanced +#define glDrawRangeElementsBaseVertex oc_gl_get_api()->DrawRangeElementsBaseVertex +#define glVertexAttrib1f oc_gl_get_api()->VertexAttrib1f +#define glGetUniformSubroutineuiv oc_gl_get_api()->GetUniformSubroutineuiv +#define glDisableVertexAttribArray oc_gl_get_api()->DisableVertexAttribArray +#define glProgramUniformMatrix3x2fv oc_gl_get_api()->ProgramUniformMatrix3x2fv +#define glVertexAttribI4usv oc_gl_get_api()->VertexAttribI4usv +#define glGetObjectLabel oc_gl_get_api()->GetObjectLabel +#define glBindAttribLocation oc_gl_get_api()->BindAttribLocation +#define glUniform1f oc_gl_get_api()->Uniform1f +#define glGetUniformdv oc_gl_get_api()->GetUniformdv +#define glGetUniformLocation oc_gl_get_api()->GetUniformLocation +#define glGetSubroutineUniformLocation oc_gl_get_api()->GetSubroutineUniformLocation +#define glGetTexParameterIuiv oc_gl_get_api()->GetTexParameterIuiv +#define glSamplerParameterf oc_gl_get_api()->SamplerParameterf +#define glVertexAttribL3d oc_gl_get_api()->VertexAttribL3d +#define glTexImage3DMultisample oc_gl_get_api()->TexImage3DMultisample +#define glTexImage3D oc_gl_get_api()->TexImage3D +#define glRenderbufferStorage oc_gl_get_api()->RenderbufferStorage +#define glEnableVertexAttribArray oc_gl_get_api()->EnableVertexAttribArray +#define glVertexAttribP4uiv oc_gl_get_api()->VertexAttribP4uiv +#define glUniform4d oc_gl_get_api()->Uniform4d +#define glVertexAttrib4s oc_gl_get_api()->VertexAttrib4s +#define glDrawElementsInstancedBaseVertex oc_gl_get_api()->DrawElementsInstancedBaseVertex +#define glVertexAttrib3s oc_gl_get_api()->VertexAttrib3s +#define glProgramUniform2iv oc_gl_get_api()->ProgramUniform2iv +#define glStencilFuncSeparate oc_gl_get_api()->StencilFuncSeparate +#define glDeleteFramebuffers oc_gl_get_api()->DeleteFramebuffers +#define glDepthRange oc_gl_get_api()->DepthRange +#define glUniformMatrix3x2fv oc_gl_get_api()->UniformMatrix3x2fv +#define glProgramUniformMatrix2dv oc_gl_get_api()->ProgramUniformMatrix2dv +#define glShaderStorageBlockBinding oc_gl_get_api()->ShaderStorageBlockBinding +#define glClearDepth oc_gl_get_api()->ClearDepth +#define glVertexAttrib2dv oc_gl_get_api()->VertexAttrib2dv +#define glSamplerParameterIuiv oc_gl_get_api()->SamplerParameterIuiv +#define glGetVertexAttribLdv oc_gl_get_api()->GetVertexAttribLdv +#define glProgramUniformMatrix3x4dv oc_gl_get_api()->ProgramUniformMatrix3x4dv +#define glDepthRangeArrayv oc_gl_get_api()->DepthRangeArrayv +#define glGetActiveUniform oc_gl_get_api()->GetActiveUniform +#define glPatchParameterfv oc_gl_get_api()->PatchParameterfv +#define glInvalidateTexImage oc_gl_get_api()->InvalidateTexImage +#define glVertexAttrib3f oc_gl_get_api()->VertexAttrib3f +#define glProgramUniform4iv oc_gl_get_api()->ProgramUniform4iv +#define glProgramUniform4d oc_gl_get_api()->ProgramUniform4d +#define glIsFramebuffer oc_gl_get_api()->IsFramebuffer +#define glPixelStoref oc_gl_get_api()->PixelStoref +#define glProgramUniform4uiv oc_gl_get_api()->ProgramUniform4uiv +#define glProgramUniformMatrix4x2dv oc_gl_get_api()->ProgramUniformMatrix4x2dv +#define glFenceSync oc_gl_get_api()->FenceSync +#define glGetBufferParameteri64v oc_gl_get_api()->GetBufferParameteri64v +#define glStencilOp oc_gl_get_api()->StencilOp +#define glClearBufferData oc_gl_get_api()->ClearBufferData +#define glGetnUniformuiv oc_gl_get_api()->GetnUniformuiv +#define glGetProgramResourceiv oc_gl_get_api()->GetProgramResourceiv +#define glGetVertexAttribdv oc_gl_get_api()->GetVertexAttribdv +#define glGetTransformFeedbackVarying oc_gl_get_api()->GetTransformFeedbackVarying +#define glVertexAttrib2fv oc_gl_get_api()->VertexAttrib2fv +#define glGetBooleani_v oc_gl_get_api()->GetBooleani_v +#define glColorMaski oc_gl_get_api()->ColorMaski +#define glInvalidateBufferSubData oc_gl_get_api()->InvalidateBufferSubData +#define glUniformMatrix4dv oc_gl_get_api()->UniformMatrix4dv +#define glIsQuery oc_gl_get_api()->IsQuery +#define glUniform4ui oc_gl_get_api()->Uniform4ui +#define glUniform4i oc_gl_get_api()->Uniform4i +#define glGetSamplerParameteriv oc_gl_get_api()->GetSamplerParameteriv +#define glMultiDrawElementsBaseVertex oc_gl_get_api()->MultiDrawElementsBaseVertex +#define glVertexAttribI1uiv oc_gl_get_api()->VertexAttribI1uiv +#define glGetIntegerv oc_gl_get_api()->GetIntegerv +#define glUniformMatrix2x3fv oc_gl_get_api()->UniformMatrix2x3fv +#define glTexImage2D oc_gl_get_api()->TexImage2D +#define glGetAttachedShaders oc_gl_get_api()->GetAttachedShaders +#define glUniform2d oc_gl_get_api()->Uniform2d +#define glMemoryBarrierByRegion oc_gl_get_api()->MemoryBarrierByRegion +#define glUniformMatrix2fv oc_gl_get_api()->UniformMatrix2fv +#define glPrimitiveRestartIndex oc_gl_get_api()->PrimitiveRestartIndex +#define glGetVertexAttribiv oc_gl_get_api()->GetVertexAttribiv +#define glGetAttribLocation oc_gl_get_api()->GetAttribLocation +#define glTexStorage2DMultisample oc_gl_get_api()->TexStorage2DMultisample +#define glCompressedTexSubImage2D oc_gl_get_api()->CompressedTexSubImage2D +#define glGetVertexAttribfv oc_gl_get_api()->GetVertexAttribfv +#define glGetBufferParameteriv oc_gl_get_api()->GetBufferParameteriv +#define glTexParameterf oc_gl_get_api()->TexParameterf +#define glFramebufferTexture2D oc_gl_get_api()->FramebufferTexture2D +#define glGetActiveAttrib oc_gl_get_api()->GetActiveAttrib +#define glInvalidateTexSubImage oc_gl_get_api()->InvalidateTexSubImage +#define glDeleteVertexArrays oc_gl_get_api()->DeleteVertexArrays +#define glVertexAttribI2ui oc_gl_get_api()->VertexAttribI2ui +#define glPointParameteriv oc_gl_get_api()->PointParameteriv +#define glGetPointerv oc_gl_get_api()->GetPointerv +#define glEnablei oc_gl_get_api()->Enablei +#define glBindBufferRange oc_gl_get_api()->BindBufferRange +#define glDrawArraysInstanced oc_gl_get_api()->DrawArraysInstanced +#define glDeleteTextures oc_gl_get_api()->DeleteTextures +#define glVertexAttrib4Niv oc_gl_get_api()->VertexAttrib4Niv +#define glMultiDrawElements oc_gl_get_api()->MultiDrawElements +#define glGetProgramiv oc_gl_get_api()->GetProgramiv +#define glDepthFunc oc_gl_get_api()->DepthFunc +#define glGenTextures oc_gl_get_api()->GenTextures +#define glGetInternalformativ oc_gl_get_api()->GetInternalformativ +#define glProgramUniform3i oc_gl_get_api()->ProgramUniform3i +#define glScissorIndexed oc_gl_get_api()->ScissorIndexed +#define glVertexAttrib2sv oc_gl_get_api()->VertexAttrib2sv +#define glTexStorage3DMultisample oc_gl_get_api()->TexStorage3DMultisample +#define glUniform2iv oc_gl_get_api()->Uniform2iv +#define glDrawArraysInstancedBaseInstance oc_gl_get_api()->DrawArraysInstancedBaseInstance +#define glVertexAttribI3ui oc_gl_get_api()->VertexAttribI3ui +#define glDeleteSamplers oc_gl_get_api()->DeleteSamplers +#define glGenVertexArrays oc_gl_get_api()->GenVertexArrays +#define glGetFramebufferParameteriv oc_gl_get_api()->GetFramebufferParameteriv +#define glPolygonMode oc_gl_get_api()->PolygonMode +#define glProgramUniformMatrix2x4fv oc_gl_get_api()->ProgramUniformMatrix2x4fv +#define glGetProgramResourceName oc_gl_get_api()->GetProgramResourceName +#define glSamplerParameteriv oc_gl_get_api()->SamplerParameteriv +#define glGetActiveSubroutineUniformiv oc_gl_get_api()->GetActiveSubroutineUniformiv +#define glGetStringi oc_gl_get_api()->GetStringi +#define glVertexAttribLFormat oc_gl_get_api()->VertexAttribLFormat +#define glVertexAttrib3d oc_gl_get_api()->VertexAttrib3d +#define glBindVertexArray oc_gl_get_api()->BindVertexArray +#define glUnmapBuffer oc_gl_get_api()->UnmapBuffer +#define glDrawElementsInstancedBaseInstance oc_gl_get_api()->DrawElementsInstancedBaseInstance +#define glUniform4uiv oc_gl_get_api()->Uniform4uiv +#define glFramebufferTexture1D oc_gl_get_api()->FramebufferTexture1D +#define glDrawTransformFeedbackStreamInstanced oc_gl_get_api()->DrawTransformFeedbackStreamInstanced +#define glStencilFunc oc_gl_get_api()->StencilFunc +#define glValidateProgram oc_gl_get_api()->ValidateProgram +#define glFlush oc_gl_get_api()->Flush +#define glProgramUniform3uiv oc_gl_get_api()->ProgramUniform3uiv +#define glDeleteRenderbuffers oc_gl_get_api()->DeleteRenderbuffers +#define glVertexAttrib4fv oc_gl_get_api()->VertexAttrib4fv +#define glUniformMatrix2dv oc_gl_get_api()->UniformMatrix2dv +#define glGetFragDataIndex oc_gl_get_api()->GetFragDataIndex +#define glUniform3iv oc_gl_get_api()->Uniform3iv +#define glMinSampleShading oc_gl_get_api()->MinSampleShading +#define glGetBooleanv oc_gl_get_api()->GetBooleanv +#define glGetMultisamplefv oc_gl_get_api()->GetMultisamplefv +#define glGetVertexAttribIuiv oc_gl_get_api()->GetVertexAttribIuiv +#define glGetProgramInfoLog oc_gl_get_api()->GetProgramInfoLog +#define glUniform4fv oc_gl_get_api()->Uniform4fv +#define glDrawBuffer oc_gl_get_api()->DrawBuffer +#define glUniform1i oc_gl_get_api()->Uniform1i +#define glProgramUniform4ui oc_gl_get_api()->ProgramUniform4ui +#define glProgramUniformMatrix3fv oc_gl_get_api()->ProgramUniformMatrix3fv +#define glBlendEquationSeparate oc_gl_get_api()->BlendEquationSeparate +#define glBindProgramPipeline oc_gl_get_api()->BindProgramPipeline +#define glGetDoublei_v oc_gl_get_api()->GetDoublei_v +#define glBufferData oc_gl_get_api()->BufferData +#define glClearColor oc_gl_get_api()->ClearColor +#define glProgramUniform4i oc_gl_get_api()->ProgramUniform4i +#define glGetTexLevelParameteriv oc_gl_get_api()->GetTexLevelParameteriv +#define glGetActiveUniformBlockiv oc_gl_get_api()->GetActiveUniformBlockiv +#define glProgramUniform1fv oc_gl_get_api()->ProgramUniform1fv +#define glPauseTransformFeedback oc_gl_get_api()->PauseTransformFeedback +#define glGetBufferPointerv oc_gl_get_api()->GetBufferPointerv +#define glInvalidateSubFramebuffer oc_gl_get_api()->InvalidateSubFramebuffer +#define glScissorIndexedv oc_gl_get_api()->ScissorIndexedv +#define glUniform2ui oc_gl_get_api()->Uniform2ui +#define glBindTexture oc_gl_get_api()->BindTexture +#define glDrawElementsInstanced oc_gl_get_api()->DrawElementsInstanced +#define glProgramUniform4f oc_gl_get_api()->ProgramUniform4f +#define glBindBufferBase oc_gl_get_api()->BindBufferBase +#define glIsShader oc_gl_get_api()->IsShader +#define glClearBufferSubData oc_gl_get_api()->ClearBufferSubData +#define glVertexAttrib4Nuiv oc_gl_get_api()->VertexAttrib4Nuiv +#define glDrawArraysIndirect oc_gl_get_api()->DrawArraysIndirect +#define glVertexAttrib4usv oc_gl_get_api()->VertexAttrib4usv +#define glUniform1d oc_gl_get_api()->Uniform1d +#define glClearTexImage oc_gl_get_api()->ClearTexImage +#define glUniform1uiv oc_gl_get_api()->Uniform1uiv +#define glBindSampler oc_gl_get_api()->BindSampler +#define glGetTexLevelParameterfv oc_gl_get_api()->GetTexLevelParameterfv +#define glClearBufferiv oc_gl_get_api()->ClearBufferiv +#define glLogicOp oc_gl_get_api()->LogicOp +#define glActiveTexture oc_gl_get_api()->ActiveTexture +#define glGetFragDataLocation oc_gl_get_api()->GetFragDataLocation +#define glBlendColor oc_gl_get_api()->BlendColor +#define glUniformMatrix4x3fv oc_gl_get_api()->UniformMatrix4x3fv +#define glProgramUniform3fv oc_gl_get_api()->ProgramUniform3fv +#define glUniform1fv oc_gl_get_api()->Uniform1fv +#define glDrawElementsBaseVertex oc_gl_get_api()->DrawElementsBaseVertex +#define glUniform4f oc_gl_get_api()->Uniform4f +#define glBlendEquationSeparatei oc_gl_get_api()->BlendEquationSeparatei +#define glBlendFuncSeparate oc_gl_get_api()->BlendFuncSeparate +#define glClearBufferuiv oc_gl_get_api()->ClearBufferuiv +#define glCopyTexSubImage1D oc_gl_get_api()->CopyTexSubImage1D +#define glDrawTransformFeedback oc_gl_get_api()->DrawTransformFeedback +#define glReadBuffer oc_gl_get_api()->ReadBuffer +#define glCopyBufferSubData oc_gl_get_api()->CopyBufferSubData +#define glGetUniformuiv oc_gl_get_api()->GetUniformuiv +#define glPolygonOffset oc_gl_get_api()->PolygonOffset +#define glDispatchCompute oc_gl_get_api()->DispatchCompute +#define glBindImageTexture oc_gl_get_api()->BindImageTexture +#define glUniformMatrix4x3dv oc_gl_get_api()->UniformMatrix4x3dv +#define glGenRenderbuffers oc_gl_get_api()->GenRenderbuffers +#endif // __GL_API_H__ diff --git a/src/graphics/gl_canvas.c b/src/graphics/gl_canvas.c index 2fbc670..bdca5e2 100644 --- a/src/graphics/gl_canvas.c +++ b/src/graphics/gl_canvas.c @@ -7,142 +7,137 @@ * *****************************************************************/ #include"graphics_surface.h" -#include"util/macro_helpers.h" +#include"util/macros.h" #include"glsl_shaders.h" #include"gl_api.h" -typedef struct mg_gl_image +typedef struct oc_gl_image { - mg_image_data interface; + oc_image_data interface; GLuint texture; -} mg_gl_image; +} oc_gl_image; -enum _mg_gl_cmd { - MG_GL_FILL, - MG_GL_STROKE, +enum oc_gl_cmd_enum { + OC_GL_FILL, + OC_GL_STROKE, }; -typedef int mg_gl_cmd; +typedef int oc_gl_cmd; -typedef struct mg_gl_path +typedef struct oc_gl_path { float uvTransform[12]; - vec4 color; - vec4 box; - vec4 clip; - mg_gl_cmd cmd; + oc_vec4 color; + oc_vec4 box; + oc_vec4 clip; + oc_gl_cmd cmd; int textureID; u8 pad[8]; -} mg_gl_path; +} oc_gl_path; -enum _mg_gl_seg_kind{ - MG_GL_LINE = 1, - MG_GL_QUADRATIC, - MG_GL_CUBIC, -}; -typedef int mg_gl_seg_kind; - -typedef struct mg_gl_path_elt +enum oc_gl_seg_kind_enum { - vec2 p[4]; - int pathIndex; - mg_gl_seg_kind kind; - -} mg_gl_path_elt; - -enum { - LAYOUT_PATH_SIZE = sizeof(mg_gl_path), - LAYOUT_PATH_ELT_SIZE = sizeof(mg_gl_path_elt), + OC_GL_LINE = 1, + OC_GL_QUADRATIC, + OC_GL_CUBIC, }; +typedef int oc_gl_seg_kind; +typedef struct oc_gl_path_elt +{ + oc_vec2 p[4]; + int pathIndex; + oc_gl_seg_kind kind; -typedef struct mg_gl_dispatch_indirect_command +} oc_gl_path_elt; + +typedef struct oc_gl_dispatch_indirect_command { u32 num_groups_x; u32 num_groups_y; u32 num_groups_z; -} mg_gl_dispatch_indirect_command; +} oc_gl_dispatch_indirect_command; //////////////////////////////////////////////////////////// //NOTE: these are just here for the sizes... -#define MG_GL_LAYOUT_FIRST(name, type) \ - MG_GL_##name##_OFFSET = 0, \ - MG_GL_##name##_SIZE = MG_GL_##type##_SIZE, +#define OC_GL_LAYOUT_FIRST(name, type) \ + OC_GL_##name##_OFFSET = 0, \ + OC_GL_##name##_SIZE = OC_GL_##type##_SIZE, -#define MG_GL_LAYOUT_NEXT(name, type, prev) \ - MG_GL_##name##_OFFSET = AlignUpOnPow2(MG_GL_##prev##_OFFSET + MG_GL_##prev##_SIZE, MG_GL_##type##_ALIGN), \ - MG_GL_##name##_SIZE = MG_GL_##type##_SIZE, +#define OC_GL_LAYOUT_NEXT(name, type, prev) \ + OC_GL_##name##_OFFSET = oc_align_up_pow2(OC_GL_##prev##_OFFSET + OC_GL_##prev##_SIZE, OC_GL_##type##_ALIGN), \ + OC_GL_##name##_SIZE = OC_GL_##type##_SIZE, -#define MG_GL_LAYOUT_SIZE(name, last, maxAlignType) \ - MG_GL_##name##_ALIGN = AlignUpOnPow2(MG_GL_##maxAlignType##_ALIGN, MG_GL_VEC4_ALIGN), \ - MG_GL_##name##_SIZE = AlignUpOnPow2(MG_GL_##last##_OFFSET + MG_GL_##last##_SIZE, MG_GL_##name##_ALIGN), +#define OC_GL_LAYOUT_SIZE(name, last, maxAlignType) \ + OC_GL_##name##_ALIGN = oc_align_up_pow2(OC_GL_##maxAlignType##_ALIGN, OC_GL_VEC4_ALIGN), \ + OC_GL_##name##_SIZE = oc_align_up_pow2(OC_GL_##last##_OFFSET + OC_GL_##last##_SIZE, OC_GL_##name##_ALIGN), enum { - MG_GL_I32_SIZE = sizeof(i32), - MG_GL_I32_ALIGN = sizeof(i32), - MG_GL_F32_SIZE = sizeof(f32), - MG_GL_F32_ALIGN = sizeof(f32), - MG_GL_VEC2_SIZE = 2*sizeof(f32), - MG_GL_VEC2_ALIGN = 2*sizeof(f32), - MG_GL_VEC3_SIZE = 4*sizeof(f32), - MG_GL_VEC3_ALIGN = 4*sizeof(f32), - MG_GL_VEC4_SIZE = 4*sizeof(f32), - MG_GL_VEC4_ALIGN = 4*sizeof(f32), - MG_GL_MAT3_SIZE = 3*3*MG_GL_VEC3_SIZE, - MG_GL_MAT3_ALIGN = MG_GL_VEC3_ALIGN, + OC_GL_I32_SIZE = sizeof(i32), + OC_GL_I32_ALIGN = sizeof(i32), + OC_GL_F32_SIZE = sizeof(f32), + OC_GL_F32_ALIGN = sizeof(f32), + OC_GL_VEC2_SIZE = 2*sizeof(f32), + OC_GL_VEC2_ALIGN = 2*sizeof(f32), + OC_GL_VEC3_SIZE = 4*sizeof(f32), + OC_GL_VEC3_ALIGN = 4*sizeof(f32), + OC_GL_VEC4_SIZE = 4*sizeof(f32), + OC_GL_VEC4_ALIGN = 4*sizeof(f32), + OC_GL_MAT3_SIZE = 3*3*OC_GL_VEC3_SIZE, + OC_GL_MAT3_ALIGN = OC_GL_VEC3_ALIGN, - MG_GL_LAYOUT_FIRST(SEGMENT_KIND, I32) - MG_GL_LAYOUT_NEXT(SEGMENT_PATH_INDEX, I32, SEGMENT_KIND) - MG_GL_LAYOUT_NEXT(SEGMENT_CONFIG, I32, SEGMENT_PATH_INDEX) - MG_GL_LAYOUT_NEXT(SEGMENT_WINDING, I32, SEGMENT_CONFIG) - MG_GL_LAYOUT_NEXT(SEGMENT_BOX, VEC4, SEGMENT_WINDING) - MG_GL_LAYOUT_NEXT(SEGMENT_IMPLICIT_MATRIX, MAT3, SEGMENT_BOX) - MG_GL_LAYOUT_NEXT(SEGMENT_HULL_VERTEX, VEC2, SEGMENT_IMPLICIT_MATRIX) - MG_GL_LAYOUT_NEXT(SEGMENT_SIGN, F32, SEGMENT_HULL_VERTEX) - MG_GL_LAYOUT_SIZE(SEGMENT, SEGMENT_SIGN, MAT3) + OC_GL_LAYOUT_FIRST(SEGMENT_KIND, I32) + OC_GL_LAYOUT_NEXT(SEGMENT_PATH_INDEX, I32, SEGMENT_KIND) + OC_GL_LAYOUT_NEXT(SEGMENT_CONFIG, I32, SEGMENT_PATH_INDEX) + OC_GL_LAYOUT_NEXT(SEGMENT_WINDING, I32, SEGMENT_CONFIG) + OC_GL_LAYOUT_NEXT(SEGMENT_BOX, VEC4, SEGMENT_WINDING) + OC_GL_LAYOUT_NEXT(SEGMENT_IMPLICIT_MATRIX, MAT3, SEGMENT_BOX) + OC_GL_LAYOUT_NEXT(SEGMENT_HULL_VERTEX, VEC2, SEGMENT_IMPLICIT_MATRIX) + OC_GL_LAYOUT_NEXT(SEGMENT_SIGN, F32, SEGMENT_HULL_VERTEX) + OC_GL_LAYOUT_SIZE(SEGMENT, SEGMENT_SIGN, MAT3) - MG_GL_LAYOUT_FIRST(PATH_QUEUE_AREA, VEC4) - MG_GL_LAYOUT_NEXT(PATH_QUEUE_TILE_QUEUES, I32, PATH_QUEUE_AREA) - MG_GL_LAYOUT_SIZE(PATH_QUEUE, PATH_QUEUE_TILE_QUEUES, VEC4) + OC_GL_LAYOUT_FIRST(PATH_QUEUE_AREA, VEC4) + OC_GL_LAYOUT_NEXT(PATH_QUEUE_TILE_QUEUES, I32, PATH_QUEUE_AREA) + OC_GL_LAYOUT_SIZE(PATH_QUEUE, PATH_QUEUE_TILE_QUEUES, VEC4) - MG_GL_LAYOUT_FIRST(TILE_OP_KIND, I32) - MG_GL_LAYOUT_NEXT(TILE_OP_NEXT, I32, TILE_OP_KIND) - MG_GL_LAYOUT_NEXT(TILE_OP_INDEX, I32, TILE_OP_NEXT) - MG_GL_LAYOUT_NEXT(TILE_OP_WINDING, I32, TILE_OP_INDEX) - MG_GL_LAYOUT_SIZE(TILE_OP, TILE_OP_WINDING, I32) + OC_GL_LAYOUT_FIRST(TILE_OP_KIND, I32) + OC_GL_LAYOUT_NEXT(TILE_OP_NEXT, I32, TILE_OP_KIND) + OC_GL_LAYOUT_NEXT(TILE_OP_INDEX, I32, TILE_OP_NEXT) + OC_GL_LAYOUT_NEXT(TILE_OP_WINDING, I32, TILE_OP_INDEX) + OC_GL_LAYOUT_SIZE(TILE_OP, TILE_OP_WINDING, I32) - MG_GL_LAYOUT_FIRST(TILE_QUEUE_WINDING, I32) - MG_GL_LAYOUT_NEXT(TILE_QUEUE_FIRST, I32, TILE_QUEUE_WINDING) - MG_GL_LAYOUT_NEXT(TILE_QUEUE_LAST, I32, TILE_QUEUE_FIRST) - MG_GL_LAYOUT_SIZE(TILE_QUEUE, TILE_QUEUE_LAST, I32) + OC_GL_LAYOUT_FIRST(TILE_QUEUE_WINDING, I32) + OC_GL_LAYOUT_NEXT(TILE_QUEUE_FIRST, I32, TILE_QUEUE_WINDING) + OC_GL_LAYOUT_NEXT(TILE_QUEUE_LAST, I32, TILE_QUEUE_FIRST) + OC_GL_LAYOUT_SIZE(TILE_QUEUE, TILE_QUEUE_LAST, I32) - MG_GL_LAYOUT_FIRST(SCREEN_TILE_COORD, VEC2) - MG_GL_LAYOUT_NEXT(SCREEN_TILE_FIRST, I32, SCREEN_TILE_COORD) - MG_GL_LAYOUT_SIZE(SCREEN_TILE, SCREEN_TILE_FIRST, VEC2) + OC_GL_LAYOUT_FIRST(SCREEN_TILE_COORD, VEC2) + OC_GL_LAYOUT_NEXT(SCREEN_TILE_FIRST, I32, SCREEN_TILE_COORD) + OC_GL_LAYOUT_SIZE(SCREEN_TILE, SCREEN_TILE_FIRST, VEC2) }; enum { - MG_GL_INPUT_BUFFERS_COUNT = 3, - MG_GL_TILE_SIZE = 16, - MG_GL_MSAA_COUNT = 8, - MG_GL_MAX_IMAGES_PER_BATCH = 8, + OC_GL_INPUT_BUFFERS_COUNT = 3, + OC_GL_TILE_SIZE = 16, + OC_GL_MSAA_COUNT = 8, + OC_GL_MAX_IMAGES_PER_BATCH = 8, }; -typedef struct mg_gl_mapped_buffer +typedef struct oc_gl_mapped_buffer { GLuint buffer; int size; char* contents; -} mg_gl_mapped_buffer; +} oc_gl_mapped_buffer; -typedef struct mg_gl_canvas_backend +typedef struct oc_gl_canvas_backend { - mg_canvas_backend interface; - mg_wgl_surface* surface; + oc_canvas_backend interface; + oc_wgl_surface* surface; int msaaCount; - vec2 frameSize; + oc_vec2 frameSize; // gl stuff GLuint vao; @@ -158,9 +153,9 @@ typedef struct mg_gl_canvas_backend GLuint outTexture; int bufferIndex; - GLsync bufferSync[MG_GL_INPUT_BUFFERS_COUNT]; - mg_gl_mapped_buffer pathBuffer[MG_GL_INPUT_BUFFERS_COUNT]; - mg_gl_mapped_buffer elementBuffer[MG_GL_INPUT_BUFFERS_COUNT]; + GLsync bufferSync[OC_GL_INPUT_BUFFERS_COUNT]; + oc_gl_mapped_buffer pathBuffer[OC_GL_INPUT_BUFFERS_COUNT]; + oc_gl_mapped_buffer elementBuffer[OC_GL_INPUT_BUFFERS_COUNT]; GLuint segmentBuffer; GLuint segmentCountBuffer; @@ -181,27 +176,27 @@ typedef struct mg_gl_canvas_backend int pathBatchStart; int eltBatchStart; - mg_primitive* primitive; - vec4 pathScreenExtents; - vec4 pathUserExtents; + oc_primitive* primitive; + oc_vec4 pathScreenExtents; + oc_vec4 pathUserExtents; int maxTileQueueCount; int maxSegmentCount; int currentImageIndex; -} mg_gl_canvas_backend; +} oc_gl_canvas_backend; -static void mg_update_path_extents(vec4* extents, vec2 p) +static void oc_update_path_extents(oc_vec4* extents, oc_vec2 p) { - extents->x = minimum(extents->x, p.x); - extents->y = minimum(extents->y, p.y); - extents->z = maximum(extents->z, p.x); - extents->w = maximum(extents->w, p.y); + extents->x = oc_min(extents->x, p.x); + extents->y = oc_min(extents->y, p.y); + extents->z = oc_max(extents->z, p.x); + extents->w = oc_max(extents->w, p.y); } -void mg_gl_grow_input_buffer(mg_gl_mapped_buffer* buffer, int copyStart, int copySize, int newSize) +void oc_gl_grow_input_buffer(oc_gl_mapped_buffer* buffer, int copyStart, int copySize, int newSize) { - mg_gl_mapped_buffer newBuffer = {0}; + oc_gl_mapped_buffer newBuffer = {0}; newBuffer.size = newSize; glGenBuffers(1, &newBuffer.buffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, newBuffer.buffer); @@ -222,46 +217,46 @@ void mg_gl_grow_input_buffer(mg_gl_mapped_buffer* buffer, int copyStart, int cop *buffer = newBuffer; } -void mg_gl_canvas_encode_element(mg_gl_canvas_backend* backend, mg_path_elt_type kind, vec2* p) +void oc_gl_canvas_encode_element(oc_gl_canvas_backend* backend, oc_path_elt_type kind, oc_vec2* p) { int bufferIndex = backend->bufferIndex; - int bufferCap = backend->elementBuffer[bufferIndex].size / sizeof(mg_gl_path_elt); + int bufferCap = backend->elementBuffer[bufferIndex].size / sizeof(oc_gl_path_elt); if(backend->eltCount >= bufferCap) { int newBufferCap = (int)(bufferCap * 1.5); - int newBufferSize = newBufferCap * sizeof(mg_gl_path_elt); + int newBufferSize = newBufferCap * sizeof(oc_gl_path_elt); - log_info("growing element buffer to %i elements\n", newBufferCap); + oc_log_info("growing element buffer to %i elements\n", newBufferCap); - mg_gl_grow_input_buffer(&backend->elementBuffer[bufferIndex], - backend->eltBatchStart * sizeof(mg_gl_path_elt), - backend->eltCount * sizeof(mg_gl_path_elt), + oc_gl_grow_input_buffer(&backend->elementBuffer[bufferIndex], + backend->eltBatchStart * sizeof(oc_gl_path_elt), + backend->eltCount * sizeof(oc_gl_path_elt), newBufferSize); } - mg_gl_path_elt* elementData = (mg_gl_path_elt*)backend->elementBuffer[bufferIndex].contents; - mg_gl_path_elt* elt = &elementData[backend->eltCount]; + oc_gl_path_elt* elementData = (oc_gl_path_elt*)backend->elementBuffer[bufferIndex].contents; + oc_gl_path_elt* elt = &elementData[backend->eltCount]; backend->eltCount++; elt->pathIndex = backend->pathCount - backend->pathBatchStart; int count = 0; switch(kind) { - case MG_PATH_LINE: + case OC_PATH_LINE: backend->maxSegmentCount += 1; - elt->kind = MG_GL_LINE; + elt->kind = OC_GL_LINE; count = 2; break; - case MG_PATH_QUADRATIC: + case OC_PATH_QUADRATIC: backend->maxSegmentCount += 3; - elt->kind = MG_GL_QUADRATIC; + elt->kind = OC_GL_QUADRATIC; count = 3; break; - case MG_PATH_CUBIC: + case OC_PATH_CUBIC: backend->maxSegmentCount += 7; - elt->kind = MG_GL_CUBIC; + elt->kind = OC_GL_CUBIC; count = 4; break; @@ -271,88 +266,88 @@ void mg_gl_canvas_encode_element(mg_gl_canvas_backend* backend, mg_path_elt_type for(int i=0; ipathUserExtents, p[i]); + oc_update_path_extents(&backend->pathUserExtents, p[i]); - vec2 screenP = mg_mat2x3_mul(backend->primitive->attributes.transform, p[i]); - elt->p[i] = (vec2){screenP.x, screenP.y}; + oc_vec2 screenP = oc_mat2x3_mul(backend->primitive->attributes.transform, p[i]); + elt->p[i] = (oc_vec2){screenP.x, screenP.y}; - mg_update_path_extents(&backend->pathScreenExtents, screenP); + oc_update_path_extents(&backend->pathScreenExtents, screenP); } } -void mg_gl_canvas_encode_path(mg_gl_canvas_backend* backend, mg_primitive* primitive, f32 scale) +void oc_gl_canvas_encode_path(oc_gl_canvas_backend* backend, oc_primitive* primitive, f32 scale) { int bufferIndex = backend->bufferIndex; - int bufferCap = backend->pathBuffer[bufferIndex].size / sizeof(mg_gl_path); + int bufferCap = backend->pathBuffer[bufferIndex].size / sizeof(oc_gl_path); if(backend->pathCount >= bufferCap) { int newBufferCap = (int)(bufferCap * 1.5); - int newBufferSize = newBufferCap * sizeof(mg_gl_path); + int newBufferSize = newBufferCap * sizeof(oc_gl_path); - log_info("growing path buffer to %i elements\n", newBufferCap); + oc_log_info("growing path buffer to %i elements\n", newBufferCap); - mg_gl_grow_input_buffer(&backend->pathBuffer[bufferIndex], - backend->pathBatchStart * sizeof(mg_gl_path), - backend->eltCount * sizeof(mg_gl_path), + oc_gl_grow_input_buffer(&backend->pathBuffer[bufferIndex], + backend->pathBatchStart * sizeof(oc_gl_path), + backend->eltCount * sizeof(oc_gl_path), newBufferSize); } - mg_gl_path* pathData = (mg_gl_path*)backend->pathBuffer[backend->bufferIndex].contents; - mg_gl_path* path = &pathData[backend->pathCount]; + oc_gl_path* pathData = (oc_gl_path*)backend->pathBuffer[backend->bufferIndex].contents; + oc_gl_path* path = &pathData[backend->pathCount]; backend->pathCount++; - path->cmd = (mg_gl_cmd)primitive->cmd; + path->cmd = (oc_gl_cmd)primitive->cmd; - path->box = (vec4){ + path->box = (oc_vec4){ backend->pathScreenExtents.x, backend->pathScreenExtents.y, backend->pathScreenExtents.z, backend->pathScreenExtents.w}; - path->clip = (vec4){ + path->clip = (oc_vec4){ primitive->attributes.clip.x, primitive->attributes.clip.y, primitive->attributes.clip.x + primitive->attributes.clip.w, primitive->attributes.clip.y + primitive->attributes.clip.h}; - path->color = (vec4){ + path->color = (oc_vec4){ primitive->attributes.color.r, primitive->attributes.color.g, primitive->attributes.color.b, primitive->attributes.color.a}; - mp_rect srcRegion = primitive->attributes.srcRegion; + oc_rect srcRegion = primitive->attributes.srcRegion; - mp_rect destRegion = { + oc_rect destRegion = { backend->pathUserExtents.x, backend->pathUserExtents.y, backend->pathUserExtents.z - backend->pathUserExtents.x, backend->pathUserExtents.w - backend->pathUserExtents.y}; - if(!mg_image_is_nil(primitive->attributes.image)) + if(!oc_image_is_nil(primitive->attributes.image)) { - vec2 texSize = mg_image_size(primitive->attributes.image); + oc_vec2 texSize = oc_image_size(primitive->attributes.image); - mg_mat2x3 srcRegionToImage = { + oc_mat2x3 srcRegionToImage = { 1/texSize.x, 0, srcRegion.x/texSize.x, 0, 1/texSize.y, srcRegion.y/texSize.y}; - mg_mat2x3 destRegionToSrcRegion = { + oc_mat2x3 destRegionToSrcRegion = { srcRegion.w/destRegion.w, 0, 0, 0, srcRegion.h/destRegion.h, 0}; - mg_mat2x3 userToDestRegion = { + oc_mat2x3 userToDestRegion = { 1, 0, -destRegion.x, 0, 1, -destRegion.y}; - mg_mat2x3 screenToUser = mg_mat2x3_inv(primitive->attributes.transform); + oc_mat2x3 screenToUser = oc_mat2x3_inv(primitive->attributes.transform); - mg_mat2x3 uvTransform = srcRegionToImage; - uvTransform = mg_mat2x3_mul_m(uvTransform, destRegionToSrcRegion); - uvTransform = mg_mat2x3_mul_m(uvTransform, userToDestRegion); - uvTransform = mg_mat2x3_mul_m(uvTransform, screenToUser); + oc_mat2x3 uvTransform = srcRegionToImage; + uvTransform = oc_mat2x3_mul_m(uvTransform, destRegionToSrcRegion); + uvTransform = oc_mat2x3_mul_m(uvTransform, userToDestRegion); + uvTransform = oc_mat2x3_mul_m(uvTransform, screenToUser); - //NOTE: mat3 std430 layout is an array of vec3, which are padded to _vec4_ alignment + //NOTE: mat3 std430 layout is an array of oc_vec3, which are padded to _oc_vec4_ alignment path->uvTransform[0] = uvTransform.m[0]/scale; path->uvTransform[1] = uvTransform.m[3]/scale; path->uvTransform[2] = 0; @@ -373,10 +368,10 @@ void mg_gl_canvas_encode_path(mg_gl_canvas_backend* backend, mg_primitive* primi path->textureID = -1; } - int firstTileX = path->box.x*scale / MG_GL_TILE_SIZE; - int firstTileY = path->box.y*scale / MG_GL_TILE_SIZE; - int lastTileX = path->box.z*scale / MG_GL_TILE_SIZE; - int lastTileY = path->box.w*scale / MG_GL_TILE_SIZE; + int firstTileX = path->box.x*scale / OC_GL_TILE_SIZE; + int firstTileY = path->box.y*scale / OC_GL_TILE_SIZE; + int lastTileX = path->box.z*scale / OC_GL_TILE_SIZE; + int lastTileY = path->box.w*scale / OC_GL_TILE_SIZE; int nTilesX = lastTileX - firstTileX + 1; int nTilesY = lastTileY - firstTileY + 1; @@ -384,7 +379,7 @@ void mg_gl_canvas_encode_path(mg_gl_canvas_backend* backend, mg_primitive* primi backend->maxTileQueueCount += (nTilesX * nTilesY); } -bool mg_intersect_hull_legs(vec2 p0, vec2 p1, vec2 p2, vec2 p3, vec2* intersection) +static bool oc_intersect_hull_legs(oc_vec2 p0, oc_vec2 p1, oc_vec2 p2, oc_vec2 p3, oc_vec2* intersection) { /*NOTE: check intersection of lines (p0-p1) and (p2-p3) @@ -406,26 +401,26 @@ bool mg_intersect_hull_legs(vec2 p0, vec2 p1, vec2 p2, vec2 p3, vec2* intersecti return(found); } -bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) +static bool oc_offset_hull(int count, oc_vec2* p, oc_vec2* result, f32 offset) { //NOTE: we should have no more than two coincident points here. This means the leg between // those two points can't be offset, but we can set a double point at the start of first leg, // end of first leg, or we can join the first and last leg to create a missing middle one - vec2 legs[3][2] = {0}; + oc_vec2 legs[3][2] = {0}; bool valid[3] = {0}; for(int i=0; i= 1e-6) { - n = vec2_mul(offset/norm, n); - legs[i][0] = vec2_add(p[i], n); - legs[i][1] = vec2_add(p[i+1], n); + n = oc_vec2_mul(offset/norm, n); + legs[i][0] = oc_vec2_add(p[i], n); + legs[i][1] = oc_vec2_add(p[i+1], n); valid[i] = true; } } @@ -439,7 +434,7 @@ bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) } else { - ASSERT(valid[1]); + OC_ASSERT(valid[1]); result[0] = legs[1][0]; } @@ -449,17 +444,17 @@ bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) if(!valid[i-1]) { - ASSERT(valid[i]); + OC_ASSERT(valid[i]); result[i] = legs[i][0]; } else if(!valid[i]) { - ASSERT(valid[i-1]); + OC_ASSERT(valid[i-1]); result[i] = legs[i-1][0]; } else { - if(!mg_intersect_hull_legs(legs[i-1][0], legs[i-1][1], legs[i][0], legs[i][1], &result[i])) + if(!oc_intersect_hull_legs(legs[i-1][0], legs[i-1][1], legs[i][0], legs[i][1], &result[i])) { // legs don't intersect. return(false); @@ -473,20 +468,20 @@ bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) } else { - ASSERT(valid[count-3]); + OC_ASSERT(valid[count-3]); result[count-1] = legs[count-3][1]; } return(true); } -vec2 mg_quadratic_get_point(vec2 p[3], f32 t) +static oc_vec2 oc_quadratic_get_point(oc_vec2 p[3], f32 t) { - vec2 r; + oc_vec2 r; f32 oneMt = 1-t; - f32 oneMt2 = Square(oneMt); - f32 t2 = Square(t); + f32 oneMt2 = oc_square(oneMt); + f32 t2 = oc_square(t); r.x = oneMt2*p[0].x + 2*oneMt*t*p[1].x + t2*p[2].x; r.y = oneMt2*p[0].y + 2*oneMt*t*p[1].y + t2*p[2].y; @@ -494,7 +489,7 @@ vec2 mg_quadratic_get_point(vec2 p[3], f32 t) return(r); } -void mg_quadratic_split(vec2 p[3], f32 t, vec2 outLeft[3], vec2 outRight[3]) +static void oc_quadratic_split(oc_vec2 p[3], f32 t, oc_vec2 outLeft[3], oc_vec2 outRight[3]) { //NOTE(martin): split bezier curve p at parameter t, using De Casteljau's algorithm // the q_n are the points along the hull's segments at parameter t @@ -502,13 +497,13 @@ void mg_quadratic_split(vec2 p[3], f32 t, vec2 outLeft[3], vec2 outRight[3]) f32 oneMt = 1-t; - vec2 q0 = {oneMt*p[0].x + t*p[1].x, + oc_vec2 q0 = {oneMt*p[0].x + t*p[1].x, oneMt*p[0].y + t*p[1].y}; - vec2 q1 = {oneMt*p[1].x + t*p[2].x, + oc_vec2 q1 = {oneMt*p[1].x + t*p[2].x, oneMt*p[1].y + t*p[2].y}; - vec2 s = {oneMt*q0.x + t*q1.x, + oc_vec2 s = {oneMt*q0.x + t*q1.x, oneMt*q0.y + t*q1.y}; outLeft[0] = p[0]; @@ -520,14 +515,14 @@ void mg_quadratic_split(vec2 p[3], f32 t, vec2 outLeft[3], vec2 outRight[3]) outRight[2] = p[2]; } -vec2 mg_cubic_get_point(vec2 p[4], f32 t) +static oc_vec2 oc_cubic_get_point(oc_vec2 p[4], f32 t) { - vec2 r; + oc_vec2 r; f32 oneMt = 1-t; - f32 oneMt2 = Square(oneMt); + f32 oneMt2 = oc_square(oneMt); f32 oneMt3 = oneMt2*oneMt; - f32 t2 = Square(t); + f32 t2 = oc_square(t); f32 t3 = t2*t; r.x = oneMt3*p[0].x + 3*oneMt2*t*p[1].x + 3*oneMt*t2*p[2].x + t3*p[3].x; @@ -536,29 +531,29 @@ vec2 mg_cubic_get_point(vec2 p[4], f32 t) return(r); } -void mg_cubic_split(vec2 p[4], f32 t, vec2 outLeft[4], vec2 outRight[4]) +static void oc_cubic_split(oc_vec2 p[4], f32 t, oc_vec2 outLeft[4], oc_vec2 outRight[4]) { //NOTE(martin): split bezier curve p at parameter t, using De Casteljau's algorithm // the q_n are the points along the hull's segments at parameter t // the r_n are the points along the (q_n, q_n+1) segments at parameter t // s is the split point. - vec2 q0 = {(1-t)*p[0].x + t*p[1].x, + oc_vec2 q0 = {(1-t)*p[0].x + t*p[1].x, (1-t)*p[0].y + t*p[1].y}; - vec2 q1 = {(1-t)*p[1].x + t*p[2].x, + oc_vec2 q1 = {(1-t)*p[1].x + t*p[2].x, (1-t)*p[1].y + t*p[2].y}; - vec2 q2 = {(1-t)*p[2].x + t*p[3].x, + oc_vec2 q2 = {(1-t)*p[2].x + t*p[3].x, (1-t)*p[2].y + t*p[3].y}; - vec2 r0 = {(1-t)*q0.x + t*q1.x, + oc_vec2 r0 = {(1-t)*q0.x + t*q1.x, (1-t)*q0.y + t*q1.y}; - vec2 r1 = {(1-t)*q1.x + t*q2.x, + oc_vec2 r1 = {(1-t)*q1.x + t*q2.x, (1-t)*q1.y + t*q2.y}; - vec2 s = {(1-t)*r0.x + t*r1.x, + oc_vec2 s = {(1-t)*r0.x + t*r1.x, (1-t)*r0.y + t*r1.y};; outLeft[0] = p[0]; @@ -572,86 +567,86 @@ void mg_cubic_split(vec2 p[4], f32 t, vec2 outLeft[4], vec2 outRight[4]) outRight[3] = p[3]; } -void mg_gl_encode_stroke_line(mg_gl_canvas_backend* backend, vec2* p) +void oc_gl_encode_stroke_line(oc_gl_canvas_backend* backend, oc_vec2* p) { f32 width = backend->primitive->attributes.width; - vec2 v = {p[1].x-p[0].x, p[1].y-p[0].y}; - vec2 n = {v.y, -v.x}; + oc_vec2 v = {p[1].x-p[0].x, p[1].y-p[0].y}; + oc_vec2 n = {v.y, -v.x}; f32 norm = sqrt(n.x*n.x + n.y*n.y); - vec2 offset = vec2_mul(0.5*width/norm, n); + oc_vec2 offset = oc_vec2_mul(0.5*width/norm, n); - vec2 left[2] = {vec2_add(p[0], offset), vec2_add(p[1], offset)}; - vec2 right[2] = {vec2_add(p[1], vec2_mul(-1, offset)), vec2_add(p[0], vec2_mul(-1, offset))}; - vec2 joint0[2] = {vec2_add(p[0], vec2_mul(-1, offset)), vec2_add(p[0], offset)}; - vec2 joint1[2] = {vec2_add(p[1], offset), vec2_add(p[1], vec2_mul(-1, offset))}; + oc_vec2 left[2] = {oc_vec2_add(p[0], offset), oc_vec2_add(p[1], offset)}; + oc_vec2 right[2] = {oc_vec2_add(p[1], oc_vec2_mul(-1, offset)), oc_vec2_add(p[0], oc_vec2_mul(-1, offset))}; + oc_vec2 joint0[2] = {oc_vec2_add(p[0], oc_vec2_mul(-1, offset)), oc_vec2_add(p[0], offset)}; + oc_vec2 joint1[2] = {oc_vec2_add(p[1], offset), oc_vec2_add(p[1], oc_vec2_mul(-1, offset))}; - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, right); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, right); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, left); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, joint0); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, joint1); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, left); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, joint0); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, joint1); } -enum { MG_HULL_CHECK_SAMPLE_COUNT = 5 }; +enum { OC_HULL_CHECK_SAMPLE_COUNT = 5 }; -void mg_gl_encode_stroke_quadratic(mg_gl_canvas_backend* backend, vec2* p) +void oc_gl_encode_stroke_quadratic(oc_gl_canvas_backend* backend, oc_vec2* p) { f32 width = backend->primitive->attributes.width; - f32 tolerance = minimum(backend->primitive->attributes.tolerance, 0.5 * width); + f32 tolerance = oc_min(backend->primitive->attributes.tolerance, 0.5 * width); //NOTE: check for degenerate line case const f32 equalEps = 1e-3; - if(vec2_close(p[0], p[1], equalEps)) + if(oc_vec2_close(p[0], p[1], equalEps)) { - mg_gl_encode_stroke_line(backend, p+1); + oc_gl_encode_stroke_line(backend, p+1); return; } - else if(vec2_close(p[1], p[2], equalEps)) + else if(oc_vec2_close(p[1], p[2], equalEps)) { - mg_gl_encode_stroke_line(backend, p); + oc_gl_encode_stroke_line(backend, p); return; } - vec2 leftHull[3]; - vec2 rightHull[3]; + oc_vec2 leftHull[3]; + oc_vec2 rightHull[3]; - if( !mg_offset_hull(3, p, leftHull, width/2) - || !mg_offset_hull(3, p, rightHull, -width/2)) + if( !oc_offset_hull(3, p, leftHull, width/2) + || !oc_offset_hull(3, p, rightHull, -width/2)) { //TODO split and recurse //NOTE: offsetting the hull failed, split the curve - vec2 splitLeft[3]; - vec2 splitRight[3]; - mg_quadratic_split(p, 0.5, splitLeft, splitRight); - mg_gl_encode_stroke_quadratic(backend, splitLeft); - mg_gl_encode_stroke_quadratic(backend, splitRight); + oc_vec2 splitLeft[3]; + oc_vec2 splitRight[3]; + oc_quadratic_split(p, 0.5, splitLeft, splitRight); + oc_gl_encode_stroke_quadratic(backend, splitLeft); + oc_gl_encode_stroke_quadratic(backend, splitRight); } else { - f32 checkSamples[MG_HULL_CHECK_SAMPLE_COUNT] = {1./6, 2./6, 3./6, 4./6, 5./6}; + f32 checkSamples[OC_HULL_CHECK_SAMPLE_COUNT] = {1./6, 2./6, 3./6, 4./6, 5./6}; - f32 d2LowBound = Square(0.5 * width - tolerance); - f32 d2HighBound = Square(0.5 * width + tolerance); + f32 d2LowBound = oc_square(0.5 * width - tolerance); + f32 d2HighBound = oc_square(0.5 * width + tolerance); f32 maxOvershoot = 0; f32 maxOvershootParameter = 0; - for(int i=0; i maxOvershoot) { @@ -662,97 +657,97 @@ void mg_gl_encode_stroke_quadratic(mg_gl_canvas_backend* backend, vec2* p) if(maxOvershoot > 0) { - vec2 splitLeft[3]; - vec2 splitRight[3]; - mg_quadratic_split(p, maxOvershootParameter, splitLeft, splitRight); - mg_gl_encode_stroke_quadratic(backend, splitLeft); - mg_gl_encode_stroke_quadratic(backend, splitRight); + oc_vec2 splitLeft[3]; + oc_vec2 splitRight[3]; + oc_quadratic_split(p, maxOvershootParameter, splitLeft, splitRight); + oc_gl_encode_stroke_quadratic(backend, splitLeft); + oc_gl_encode_stroke_quadratic(backend, splitRight); } else { - vec2 tmp = leftHull[0]; + oc_vec2 tmp = leftHull[0]; leftHull[0] = leftHull[2]; leftHull[2] = tmp; - mg_gl_canvas_encode_element(backend, MG_PATH_QUADRATIC, rightHull); - mg_gl_canvas_encode_element(backend, MG_PATH_QUADRATIC, leftHull); + oc_gl_canvas_encode_element(backend, OC_PATH_QUADRATIC, rightHull); + oc_gl_canvas_encode_element(backend, OC_PATH_QUADRATIC, leftHull); - vec2 joint0[2] = {rightHull[2], leftHull[0]}; - vec2 joint1[2] = {leftHull[2], rightHull[0]}; - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, joint0); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, joint1); + oc_vec2 joint0[2] = {rightHull[2], leftHull[0]}; + oc_vec2 joint1[2] = {leftHull[2], rightHull[0]}; + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, joint0); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, joint1); } } } -void mg_gl_encode_stroke_cubic(mg_gl_canvas_backend* backend, vec2* p) +void oc_gl_encode_stroke_cubic(oc_gl_canvas_backend* backend, oc_vec2* p) { f32 width = backend->primitive->attributes.width; - f32 tolerance = minimum(backend->primitive->attributes.tolerance, 0.5 * width); + f32 tolerance = oc_min(backend->primitive->attributes.tolerance, 0.5 * width); //NOTE: check degenerate line cases f32 equalEps = 1e-3; - if( (vec2_close(p[0], p[1], equalEps) && vec2_close(p[2], p[3], equalEps)) - ||(vec2_close(p[0], p[1], equalEps) && vec2_close(p[1], p[2], equalEps)) - ||(vec2_close(p[1], p[2], equalEps) && vec2_close(p[2], p[3], equalEps))) + if( (oc_vec2_close(p[0], p[1], equalEps) && oc_vec2_close(p[2], p[3], equalEps)) + ||(oc_vec2_close(p[0], p[1], equalEps) && oc_vec2_close(p[1], p[2], equalEps)) + ||(oc_vec2_close(p[1], p[2], equalEps) && oc_vec2_close(p[2], p[3], equalEps))) { - vec2 line[2] = {p[0], p[3]}; - mg_gl_encode_stroke_line(backend, line); + oc_vec2 line[2] = {p[0], p[3]}; + oc_gl_encode_stroke_line(backend, line); return; } - else if(vec2_close(p[0], p[1], equalEps) && vec2_close(p[1], p[3], equalEps)) + else if(oc_vec2_close(p[0], p[1], equalEps) && oc_vec2_close(p[1], p[3], equalEps)) { - vec2 line[2] = {p[0], vec2_add(vec2_mul(5./9, p[0]), vec2_mul(4./9, p[2]))}; - mg_gl_encode_stroke_line(backend, line); + oc_vec2 line[2] = {p[0], oc_vec2_add(oc_vec2_mul(5./9, p[0]), oc_vec2_mul(4./9, p[2]))}; + oc_gl_encode_stroke_line(backend, line); return; } - else if(vec2_close(p[0], p[2], equalEps) && vec2_close(p[2], p[3], equalEps)) + else if(oc_vec2_close(p[0], p[2], equalEps) && oc_vec2_close(p[2], p[3], equalEps)) { - vec2 line[2] = {p[0], vec2_add(vec2_mul(5./9, p[0]), vec2_mul(4./9, p[1]))}; - mg_gl_encode_stroke_line(backend, line); + oc_vec2 line[2] = {p[0], oc_vec2_add(oc_vec2_mul(5./9, p[0]), oc_vec2_mul(4./9, p[1]))}; + oc_gl_encode_stroke_line(backend, line); return; } - vec2 leftHull[4]; - vec2 rightHull[4]; + oc_vec2 leftHull[4]; + oc_vec2 rightHull[4]; - if( !mg_offset_hull(4, p, leftHull, width/2) - || !mg_offset_hull(4, p, rightHull, -width/2)) + if( !oc_offset_hull(4, p, leftHull, width/2) + || !oc_offset_hull(4, p, rightHull, -width/2)) { //TODO split and recurse //NOTE: offsetting the hull failed, split the curve - vec2 splitLeft[4]; - vec2 splitRight[4]; - mg_cubic_split(p, 0.5, splitLeft, splitRight); - mg_gl_encode_stroke_cubic(backend, splitLeft); - mg_gl_encode_stroke_cubic(backend, splitRight); + oc_vec2 splitLeft[4]; + oc_vec2 splitRight[4]; + oc_cubic_split(p, 0.5, splitLeft, splitRight); + oc_gl_encode_stroke_cubic(backend, splitLeft); + oc_gl_encode_stroke_cubic(backend, splitRight); } else { - f32 checkSamples[MG_HULL_CHECK_SAMPLE_COUNT] = {1./6, 2./6, 3./6, 4./6, 5./6}; + f32 checkSamples[OC_HULL_CHECK_SAMPLE_COUNT] = {1./6, 2./6, 3./6, 4./6, 5./6}; - f32 d2LowBound = Square(0.5 * width - tolerance); - f32 d2HighBound = Square(0.5 * width + tolerance); + f32 d2LowBound = oc_square(0.5 * width - tolerance); + f32 d2HighBound = oc_square(0.5 * width + tolerance); f32 maxOvershoot = 0; f32 maxOvershootParameter = 0; - for(int i=0; i maxOvershoot) { @@ -763,61 +758,61 @@ void mg_gl_encode_stroke_cubic(mg_gl_canvas_backend* backend, vec2* p) if(maxOvershoot > 0) { - vec2 splitLeft[4]; - vec2 splitRight[4]; - mg_cubic_split(p, maxOvershootParameter, splitLeft, splitRight); - mg_gl_encode_stroke_cubic(backend, splitLeft); - mg_gl_encode_stroke_cubic(backend, splitRight); + oc_vec2 splitLeft[4]; + oc_vec2 splitRight[4]; + oc_cubic_split(p, maxOvershootParameter, splitLeft, splitRight); + oc_gl_encode_stroke_cubic(backend, splitLeft); + oc_gl_encode_stroke_cubic(backend, splitRight); } else { - vec2 tmp = leftHull[0]; + oc_vec2 tmp = leftHull[0]; leftHull[0] = leftHull[3]; leftHull[3] = tmp; tmp = leftHull[1]; leftHull[1] = leftHull[2]; leftHull[2] = tmp; - mg_gl_canvas_encode_element(backend, MG_PATH_CUBIC, rightHull); - mg_gl_canvas_encode_element(backend, MG_PATH_CUBIC, leftHull); + oc_gl_canvas_encode_element(backend, OC_PATH_CUBIC, rightHull); + oc_gl_canvas_encode_element(backend, OC_PATH_CUBIC, leftHull); - vec2 joint0[2] = {rightHull[3], leftHull[0]}; - vec2 joint1[2] = {leftHull[3], rightHull[0]}; - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, joint0); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, joint1); + oc_vec2 joint0[2] = {rightHull[3], leftHull[0]}; + oc_vec2 joint1[2] = {leftHull[3], rightHull[0]}; + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, joint0); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, joint1); } } } -void mg_gl_encode_stroke_element(mg_gl_canvas_backend* backend, - mg_path_elt* element, - vec2 currentPoint, - vec2* startTangent, - vec2* endTangent, - vec2* endPoint) +void oc_gl_encode_stroke_element(oc_gl_canvas_backend* backend, + oc_path_elt* element, + oc_vec2 currentPoint, + oc_vec2* startTangent, + oc_vec2* endTangent, + oc_vec2* endPoint) { - vec2 controlPoints[4] = {currentPoint, element->p[0], element->p[1], element->p[2]}; + oc_vec2 controlPoints[4] = {currentPoint, element->p[0], element->p[1], element->p[2]}; int endPointIndex = 0; switch(element->type) { - case MG_PATH_LINE: - mg_gl_encode_stroke_line(backend, controlPoints); + case OC_PATH_LINE: + oc_gl_encode_stroke_line(backend, controlPoints); endPointIndex = 1; break; - case MG_PATH_QUADRATIC: - mg_gl_encode_stroke_quadratic(backend, controlPoints); + case OC_PATH_QUADRATIC: + oc_gl_encode_stroke_quadratic(backend, controlPoints); endPointIndex = 2; break; - case MG_PATH_CUBIC: - mg_gl_encode_stroke_cubic(backend, controlPoints); + case OC_PATH_CUBIC: + oc_gl_encode_stroke_cubic(backend, controlPoints); endPointIndex = 3; break; - case MG_PATH_MOVE: - ASSERT(0, "should be unreachable"); + case OC_PATH_MOVE: + OC_ASSERT(0, "should be unreachable"); break; } @@ -829,7 +824,7 @@ void mg_gl_encode_stroke_element(mg_gl_canvas_backend* backend, if( controlPoints[i].x != controlPoints[0].x || controlPoints[i].y != controlPoints[0].y) { - *startTangent = (vec2){.x = controlPoints[i].x - controlPoints[0].x, + *startTangent = (oc_vec2){.x = controlPoints[i].x - controlPoints[0].x, .y = controlPoints[i].y - controlPoints[0].y}; break; } @@ -841,58 +836,58 @@ void mg_gl_encode_stroke_element(mg_gl_canvas_backend* backend, if( controlPoints[i].x != endPoint->x || controlPoints[i].y != endPoint->y) { - *endTangent = (vec2){.x = endPoint->x - controlPoints[i].x, + *endTangent = (oc_vec2){.x = endPoint->x - controlPoints[i].x, .y = endPoint->y - controlPoints[i].y}; break; } } - DEBUG_ASSERT(startTangent->x != 0 || startTangent->y != 0); + OC_DEBUG_ASSERT(startTangent->x != 0 || startTangent->y != 0); } -void mg_gl_stroke_cap(mg_gl_canvas_backend* backend, - vec2 p0, - vec2 direction) +void oc_gl_stroke_cap(oc_gl_canvas_backend* backend, + oc_vec2 p0, + oc_vec2 direction) { - mg_attributes* attributes = &backend->primitive->attributes; + oc_attributes* attributes = &backend->primitive->attributes; //NOTE(martin): compute the tangent and normal vectors (multiplied by half width) at the cap point - f32 dn = sqrt(Square(direction.x) + Square(direction.y)); + f32 dn = sqrt(oc_square(direction.x) + oc_square(direction.y)); f32 alpha = 0.5 * attributes->width/dn; - vec2 n0 = {-alpha*direction.y, + oc_vec2 n0 = {-alpha*direction.y, alpha*direction.x}; - vec2 m0 = {alpha*direction.x, + oc_vec2 m0 = {alpha*direction.x, alpha*direction.y}; - vec2 points[] = {{p0.x + n0.x, p0.y + n0.y}, + oc_vec2 points[] = {{p0.x + n0.x, p0.y + n0.y}, {p0.x + n0.x + m0.x, p0.y + n0.y + m0.y}, {p0.x - n0.x + m0.x, p0.y - n0.y + m0.y}, {p0.x - n0.x, p0.y - n0.y}, {p0.x + n0.x, p0.y + n0.y}}; - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+1); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+2); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+3); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+1); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+2); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+3); } -void mg_gl_stroke_joint(mg_gl_canvas_backend* backend, - vec2 p0, - vec2 t0, - vec2 t1) +void oc_gl_stroke_joint(oc_gl_canvas_backend* backend, + oc_vec2 p0, + oc_vec2 t0, + oc_vec2 t1) { - mg_attributes* attributes = &backend->primitive->attributes; + oc_attributes* attributes = &backend->primitive->attributes; //NOTE(martin): compute the normals at the joint point - f32 norm_t0 = sqrt(Square(t0.x) + Square(t0.y)); - f32 norm_t1 = sqrt(Square(t1.x) + Square(t1.y)); + f32 norm_t0 = sqrt(oc_square(t0.x) + oc_square(t0.y)); + f32 norm_t1 = sqrt(oc_square(t1.x) + oc_square(t1.y)); - vec2 n0 = {-t0.y, t0.x}; + oc_vec2 n0 = {-t0.y, t0.x}; n0.x /= norm_t0; n0.y /= norm_t0; - vec2 n1 = {-t1.y, t1.x}; + oc_vec2 n1 = {-t1.y, t1.x}; n1.x /= norm_t1; n1.y /= norm_t1; @@ -913,60 +908,60 @@ void mg_gl_stroke_joint(mg_gl_canvas_backend* backend, (this can be derived from writing the pythagoras theorems in the triangles of the joint) */ f32 halfW = 0.5 * attributes->width; - vec2 u = {n0.x + n1.x, n0.y + n1.y}; + oc_vec2 u = {n0.x + n1.x, n0.y + n1.y}; f32 uNormSquare = u.x*u.x + u.y*u.y; f32 alpha = attributes->width / uNormSquare; - vec2 v = {u.x * alpha, u.y * alpha}; + oc_vec2 v = {u.x * alpha, u.y * alpha}; - f32 excursionSquare = uNormSquare * Square(alpha - attributes->width/4); + f32 excursionSquare = uNormSquare * oc_square(alpha - attributes->width/4); - if( attributes->joint == MG_JOINT_MITER - && excursionSquare <= Square(attributes->maxJointExcursion)) + if( attributes->joint == OC_JOINT_MITER + && excursionSquare <= oc_square(attributes->maxJointExcursion)) { //NOTE(martin): add a mitter joint - vec2 points[] = {p0, + oc_vec2 points[] = {p0, {p0.x + n0.x*halfW, p0.y + n0.y*halfW}, {p0.x + v.x, p0.y + v.y}, {p0.x + n1.x*halfW, p0.y + n1.y*halfW}, p0}; - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+1); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+2); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+3); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+1); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+2); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+3); } else { //NOTE(martin): add a bevel joint - vec2 points[] = {p0, + oc_vec2 points[] = {p0, {p0.x + n0.x*halfW, p0.y + n0.y*halfW}, {p0.x + n1.x*halfW, p0.y + n1.y*halfW}, p0}; - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+1); - mg_gl_canvas_encode_element(backend, MG_PATH_LINE, points+2); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+1); + oc_gl_canvas_encode_element(backend, OC_PATH_LINE, points+2); } } -u32 mg_gl_encode_stroke_subpath(mg_gl_canvas_backend* backend, - mg_path_elt* elements, - mg_path_descriptor* path, +u32 oc_gl_encode_stroke_subpath(oc_gl_canvas_backend* backend, + oc_path_elt* elements, + oc_path_descriptor* path, u32 startIndex, - vec2 startPoint) + oc_vec2 startPoint) { u32 eltCount = path->count; - DEBUG_ASSERT(startIndex < eltCount); + OC_DEBUG_ASSERT(startIndex < eltCount); - vec2 currentPoint = startPoint; - vec2 endPoint = {0, 0}; - vec2 previousEndTangent = {0, 0}; - vec2 firstTangent = {0, 0}; - vec2 startTangent = {0, 0}; - vec2 endTangent = {0, 0}; + oc_vec2 currentPoint = startPoint; + oc_vec2 endPoint = {0, 0}; + oc_vec2 previousEndTangent = {0, 0}; + oc_vec2 firstTangent = {0, 0}; + oc_vec2 startTangent = {0, 0}; + oc_vec2 endTangent = {0, 0}; //NOTE(martin): encode first element and compute first tangent - mg_gl_encode_stroke_element(backend, elements + startIndex, currentPoint, &startTangent, &endTangent, &endPoint); + oc_gl_encode_stroke_element(backend, elements + startIndex, currentPoint, &startTangent, &endTangent, &endPoint); firstTangent = startTangent; previousEndTangent = endTangent; @@ -974,18 +969,18 @@ u32 mg_gl_encode_stroke_subpath(mg_gl_canvas_backend* backend, //NOTE(martin): encode subsequent elements along with their joints - mg_attributes* attributes = &backend->primitive->attributes; + oc_attributes* attributes = &backend->primitive->attributes; u32 eltIndex = startIndex + 1; for(; - eltIndexjoint != MG_JOINT_NONE) + if(attributes->joint != OC_JOINT_NONE) { - mg_gl_stroke_joint(backend, currentPoint, previousEndTangent, startTangent); + oc_gl_stroke_joint(backend, currentPoint, previousEndTangent, startTangent); } previousEndTangent = endTangent; currentPoint = endPoint; @@ -997,47 +992,47 @@ u32 mg_gl_encode_stroke_subpath(mg_gl_canvas_backend* backend, && startPoint.x == endPoint.x && startPoint.y == endPoint.y) { - if(attributes->joint != MG_JOINT_NONE) + if(attributes->joint != OC_JOINT_NONE) { //NOTE(martin): add a closing joint if the path is closed - mg_gl_stroke_joint(backend, endPoint, endTangent, firstTangent); + oc_gl_stroke_joint(backend, endPoint, endTangent, firstTangent); } } - else if(attributes->cap == MG_CAP_SQUARE) + else if(attributes->cap == OC_CAP_SQUARE) { //NOTE(martin): add start and end cap - mg_gl_stroke_cap(backend, startPoint, (vec2){-startTangent.x, -startTangent.y}); - mg_gl_stroke_cap(backend, endPoint, endTangent); + oc_gl_stroke_cap(backend, startPoint, (oc_vec2){-startTangent.x, -startTangent.y}); + oc_gl_stroke_cap(backend, endPoint, endTangent); } return(eltIndex); } -void mg_gl_encode_stroke(mg_gl_canvas_backend* backend, - mg_path_elt* elements, - mg_path_descriptor* path) +void oc_gl_encode_stroke(oc_gl_canvas_backend* backend, + oc_path_elt* elements, + oc_path_descriptor* path) { u32 eltCount = path->count; - DEBUG_ASSERT(eltCount); + OC_DEBUG_ASSERT(eltCount); - vec2 startPoint = path->startPoint; + oc_vec2 startPoint = path->startPoint; u32 startIndex = 0; while(startIndex < eltCount) { //NOTE(martin): eliminate leading moves - while(startIndex < eltCount && elements[startIndex].type == MG_PATH_MOVE) + while(startIndex < eltCount && elements[startIndex].type == OC_PATH_MOVE) { startPoint = elements[startIndex].p[0]; startIndex++; } if(startIndex < eltCount) { - startIndex = mg_gl_encode_stroke_subpath(backend, elements, path, startIndex, startPoint); + startIndex = oc_gl_encode_stroke_subpath(backend, elements, path, startIndex, startPoint); } } } -void mg_gl_grow_buffer_if_needed(GLuint buffer, i32 wantedSize, const char* name) +void oc_gl_grow_buffer_if_needed(GLuint buffer, i32 wantedSize, const char* name) { i32 oldSize = 0; glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer); @@ -1045,7 +1040,7 @@ void mg_gl_grow_buffer_if_needed(GLuint buffer, i32 wantedSize, const char* name if(oldSize < wantedSize) { - log_info("growing %s buffer\n", name); + oc_log_info("growing %s buffer\n", name); int newSize = wantedSize * 1.2; @@ -1056,20 +1051,20 @@ void mg_gl_grow_buffer_if_needed(GLuint buffer, i32 wantedSize, const char* name -void mg_gl_render_batch(mg_gl_canvas_backend* backend, - mg_wgl_surface* surface, - mg_image* images, +void oc_gl_render_batch(oc_gl_canvas_backend* backend, + oc_wgl_surface* surface, + oc_image* images, int tileSize, int nTilesX, int nTilesY, - vec2 viewportSize, + oc_vec2 viewportSize, f32 scale) { GLuint pathBuffer = backend->pathBuffer[backend->bufferIndex].buffer; GLuint elementBuffer = backend->elementBuffer[backend->bufferIndex].buffer; - int pathBufferOffset = backend->pathBatchStart * sizeof(mg_gl_path); - int elementBufferOffset = backend->eltBatchStart * sizeof(mg_gl_path_elt); + int pathBufferOffset = backend->pathBatchStart * sizeof(oc_gl_path); + int elementBufferOffset = backend->eltBatchStart * sizeof(oc_gl_path_elt); int pathCount = backend->pathCount - backend->pathBatchStart; int eltCount = backend->eltCount - backend->eltBatchStart; @@ -1081,18 +1076,18 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, //NOTE: update intermediate buffers size if needed //TODO: compute correct sizes - mg_gl_grow_buffer_if_needed(backend->pathQueueBuffer, pathCount * MG_GL_PATH_QUEUE_SIZE, "path queues"); - mg_gl_grow_buffer_if_needed(backend->tileQueueBuffer, backend->maxTileQueueCount * MG_GL_TILE_QUEUE_SIZE, "tile queues"); - mg_gl_grow_buffer_if_needed(backend->segmentBuffer, backend->maxSegmentCount * MG_GL_SEGMENT_SIZE, "segments"); - mg_gl_grow_buffer_if_needed(backend->screenTilesBuffer, nTilesX * nTilesY * MG_GL_SCREEN_TILE_SIZE, "screen tiles"); - mg_gl_grow_buffer_if_needed(backend->tileOpBuffer, backend->maxSegmentCount * 30 * MG_GL_TILE_OP_SIZE, "tile ops"); + oc_gl_grow_buffer_if_needed(backend->pathQueueBuffer, pathCount * OC_GL_PATH_QUEUE_SIZE, "path queues"); + oc_gl_grow_buffer_if_needed(backend->tileQueueBuffer, backend->maxTileQueueCount * OC_GL_TILE_QUEUE_SIZE, "tile queues"); + oc_gl_grow_buffer_if_needed(backend->segmentBuffer, backend->maxSegmentCount * OC_GL_SEGMENT_SIZE, "segments"); + oc_gl_grow_buffer_if_needed(backend->screenTilesBuffer, nTilesX * nTilesY * OC_GL_SCREEN_TILE_SIZE, "screen tiles"); + oc_gl_grow_buffer_if_needed(backend->tileOpBuffer, backend->maxSegmentCount * 30 * OC_GL_TILE_OP_SIZE, "tile ops"); //NOTE: make the buffers visible to gl glBindBuffer(GL_SHADER_STORAGE_BUFFER, pathBuffer); - glFlushMappedBufferRange(GL_SHADER_STORAGE_BUFFER, pathBufferOffset, pathCount*sizeof(mg_gl_path)); + glFlushMappedBufferRange(GL_SHADER_STORAGE_BUFFER, pathBufferOffset, pathCount*sizeof(oc_gl_path)); glBindBuffer(GL_SHADER_STORAGE_BUFFER, elementBuffer); - glFlushMappedBufferRange(GL_SHADER_STORAGE_BUFFER, elementBufferOffset, eltCount*sizeof(mg_gl_path_elt)); + glFlushMappedBufferRange(GL_SHADER_STORAGE_BUFFER, elementBufferOffset, eltCount*sizeof(oc_gl_path_elt)); //NOTE: clear out texture u8 clearColor[4] = {0}; @@ -1110,7 +1105,7 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(int), &zero, GL_DYNAMIC_COPY); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->rasterDispatchBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(mg_gl_dispatch_indirect_command), &zero, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(oc_gl_dispatch_indirect_command), &zero, GL_DYNAMIC_COPY); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->screenTilesCountBuffer); glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(int), &zero, GL_DYNAMIC_COPY); @@ -1120,7 +1115,7 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, int err = glGetError(); if(err) { - log_error("gl error %i\n", err); + oc_log_error("gl error %i\n", err); } //NOTE: path setup pass @@ -1140,7 +1135,7 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, for(int i=0; ipathBatchStart + i); glUniform1i(3, i); @@ -1157,7 +1152,7 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, err = glGetError(); if(err) { - log_error("gl error %i\n", err); + oc_log_error("gl error %i\n", err); } } @@ -1176,8 +1171,8 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, for(int i=0; ipathQueueBuffer); @@ -1217,7 +1212,7 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, err = glGetError(); if(err) { - log_error("gl error %i\n", err); + oc_log_error("gl error %i\n", err); } } @@ -1245,7 +1240,7 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, err = glGetError(); if(err) { - log_error("gl error %i\n", err); + oc_log_error("gl error %i\n", err); } } @@ -1273,11 +1268,11 @@ void mg_gl_render_batch(mg_gl_canvas_backend* backend, glBindImageTexture(0, backend->outTexture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8); - for(int i=0; imaxTileQueueCount = 0; } -void mg_gl_canvas_resize(mg_gl_canvas_backend* backend, vec2 size) +void oc_gl_canvas_resize(oc_gl_canvas_backend* backend, oc_vec2 size) { - int tileSize = MG_GL_TILE_SIZE; + int tileSize = OC_GL_TILE_SIZE; int nTilesX = (int)(size.x + tileSize - 1)/tileSize; int nTilesY = (int)(size.y + tileSize - 1)/tileSize; glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->screenTilesBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, nTilesX*nTilesY*MG_GL_SCREEN_TILE_SIZE, 0, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, nTilesX*nTilesY*OC_GL_SCREEN_TILE_SIZE, 0, GL_DYNAMIC_COPY); if(backend->outTexture) { @@ -1351,17 +1346,17 @@ void mg_gl_canvas_resize(mg_gl_canvas_backend* backend, vec2 size) backend->frameSize = size; } -void mg_gl_canvas_render(mg_canvas_backend* interface, - mg_color clearColor, +void oc_gl_canvas_render(oc_canvas_backend* interface, + oc_color clearColor, u32 primitiveCount, - mg_primitive* primitives, + oc_primitive* primitives, u32 eltCount, - mg_path_elt* pathElements) + oc_path_elt* pathElements) { - mg_gl_canvas_backend* backend = (mg_gl_canvas_backend*)interface; + oc_gl_canvas_backend* backend = (oc_gl_canvas_backend*)interface; //NOTE: roll input buffers - backend->bufferIndex = (backend->bufferIndex + 1) % MG_GL_INPUT_BUFFERS_COUNT; + backend->bufferIndex = (backend->bufferIndex + 1) % OC_GL_INPUT_BUFFERS_COUNT; if(backend->bufferSync[backend->bufferIndex] != 0) { glClientWaitSync(backend->bufferSync[backend->bufferIndex], GL_SYNC_FLUSH_COMMANDS_BIT, 0xffffffff); @@ -1370,20 +1365,20 @@ void mg_gl_canvas_render(mg_canvas_backend* interface, } //NOTE update screen tiles buffer size - mg_wgl_surface* surface = backend->surface; - vec2 surfaceSize = surface->interface.getSize((mg_surface_data*)surface); - vec2 contentsScaling = surface->interface.contentsScaling((mg_surface_data*)surface); + oc_wgl_surface* surface = backend->surface; + oc_vec2 surfaceSize = surface->interface.getSize((oc_surface_data*)surface); + oc_vec2 contentsScaling = surface->interface.contentsScaling((oc_surface_data*)surface); //TODO support scaling in both axes? f32 scale = contentsScaling.x; - vec2 viewportSize = {surfaceSize.x * scale, surfaceSize.y * scale}; - int tileSize = MG_GL_TILE_SIZE; + oc_vec2 viewportSize = {surfaceSize.x * scale, surfaceSize.y * scale}; + int tileSize = OC_GL_TILE_SIZE; int nTilesX = (int)(viewportSize.x + tileSize - 1)/tileSize; int nTilesY = (int)(viewportSize.y + tileSize - 1)/tileSize; if(viewportSize.x != backend->frameSize.x || viewportSize.y != backend->frameSize.y) { - mg_gl_canvas_resize(backend, viewportSize); + oc_gl_canvas_resize(backend, viewportSize); } glViewport(0, 0, viewportSize.x, viewportSize.y); @@ -1403,14 +1398,14 @@ void mg_gl_canvas_render(mg_canvas_backend* interface, backend->maxTileQueueCount = 0; //NOTE: encode and render batches - vec2 currentPos = {0}; - mg_image images[MG_GL_MAX_IMAGES_PER_BATCH] = {0}; + oc_vec2 currentPos = {0}; + oc_image images[OC_GL_MAX_IMAGES_PER_BATCH] = {0}; int imageCount = 0; backend->eltCount = 0; for(int primitiveIndex = 0; primitiveIndex < primitiveCount; primitiveIndex++) { - mg_primitive* primitive = &primitives[primitiveIndex]; + oc_primitive* primitive = &primitives[primitiveIndex]; if(primitive->attributes.image.h != 0) { @@ -1424,7 +1419,7 @@ void mg_gl_canvas_render(mg_canvas_backend* interface, } if(backend->currentImageIndex <= 0) { - if(imageCountattributes.image; backend->currentImageIndex = imageCount; @@ -1432,7 +1427,7 @@ void mg_gl_canvas_render(mg_canvas_backend* interface, } else { - mg_gl_render_batch(backend, + oc_gl_render_batch(backend, surface, images, tileSize, @@ -1455,12 +1450,12 @@ void mg_gl_canvas_render(mg_canvas_backend* interface, if(primitive->path.count) { backend->primitive = primitive; - backend->pathScreenExtents = (vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; - backend->pathUserExtents = (vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; + backend->pathScreenExtents = (oc_vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; + backend->pathUserExtents = (oc_vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; - if(primitive->cmd == MG_CMD_STROKE) + if(primitive->cmd == OC_CMD_STROKE) { - mg_gl_encode_stroke(backend, pathElements + primitive->path.startIndex, &primitive->path); + oc_gl_encode_stroke(backend, pathElements + primitive->path.startIndex, &primitive->path); } else { @@ -1469,40 +1464,40 @@ void mg_gl_canvas_render(mg_canvas_backend* interface, (eltIndex < primitive->path.count) && (primitive->path.startIndex + eltIndex < eltCount); eltIndex++) { - mg_path_elt* elt = &pathElements[primitive->path.startIndex + eltIndex]; + oc_path_elt* elt = &pathElements[primitive->path.startIndex + eltIndex]; - if(elt->type != MG_PATH_MOVE) + if(elt->type != OC_PATH_MOVE) { - vec2 p[4] = {currentPos, elt->p[0], elt->p[1], elt->p[2]}; - mg_gl_canvas_encode_element(backend, elt->type, p); + oc_vec2 p[4] = {currentPos, elt->p[0], elt->p[1], elt->p[2]}; + oc_gl_canvas_encode_element(backend, elt->type, p); segCount++; } switch(elt->type) { - case MG_PATH_MOVE: + case OC_PATH_MOVE: currentPos = elt->p[0]; break; - case MG_PATH_LINE: + case OC_PATH_LINE: currentPos = elt->p[0]; break; - case MG_PATH_QUADRATIC: + case OC_PATH_QUADRATIC: currentPos = elt->p[1]; break; - case MG_PATH_CUBIC: + case OC_PATH_CUBIC: currentPos = elt->p[2]; break; } } } //NOTE: push path - mg_gl_canvas_encode_path(backend, primitive, scale); + oc_gl_canvas_encode_path(backend, primitive, scale); } } - mg_gl_render_batch(backend, + oc_gl_render_batch(backend, surface, images, tileSize, @@ -1518,11 +1513,11 @@ void mg_gl_canvas_render(mg_canvas_backend* interface, //-------------------------------------------------------------------- // Image API //-------------------------------------------------------------------- -mg_image_data* mg_gl_canvas_image_create(mg_canvas_backend* interface, vec2 size) +oc_image_data* oc_gl_canvas_image_create(oc_canvas_backend* interface, oc_vec2 size) { - mg_gl_image* image = 0; + oc_gl_image* image = 0; - image = malloc_type(mg_gl_image); + image = oc_malloc_type(oc_gl_image); if(image) { glGenTextures(1, &image->texture); @@ -1533,24 +1528,24 @@ mg_image_data* mg_gl_canvas_image_create(mg_canvas_backend* interface, vec2 size image->interface.size = size; } - return((mg_image_data*)image); + return((oc_image_data*)image); } -void mg_gl_canvas_image_destroy(mg_canvas_backend* interface, mg_image_data* imageInterface) +void oc_gl_canvas_image_destroy(oc_canvas_backend* interface, oc_image_data* imageInterface) { //TODO: check that this image belongs to this backend - mg_gl_image* image = (mg_gl_image*)imageInterface; + oc_gl_image* image = (oc_gl_image*)imageInterface; glDeleteTextures(1, &image->texture); free(image); } -void mg_gl_canvas_image_upload_region(mg_canvas_backend* interface, - mg_image_data* imageInterface, - mp_rect region, +void oc_gl_canvas_image_upload_region(oc_canvas_backend* interface, + oc_image_data* imageInterface, + oc_rect region, u8* pixels) { //TODO: check that this image belongs to this backend - mg_gl_image* image = (mg_gl_image*)imageInterface; + oc_gl_image* image = (oc_gl_image*)imageInterface; glBindTexture(GL_TEXTURE_2D, image->texture); glTexSubImage2D(GL_TEXTURE_2D, 0, region.x, region.y, region.w, region.h, GL_RGBA, GL_UNSIGNED_BYTE, pixels); } @@ -1559,9 +1554,9 @@ void mg_gl_canvas_image_upload_region(mg_canvas_backend* interface, // Canvas setup / destroy //-------------------------------------------------------------------- -void mg_gl_canvas_destroy(mg_canvas_backend* interface) +void oc_gl_canvas_destroy(oc_canvas_backend* interface) { - mg_gl_canvas_backend* backend = (mg_gl_canvas_backend*)interface; + oc_gl_canvas_backend* backend = (oc_gl_canvas_backend*)interface; //////////////////////////////////////////////////////////////////// //TODO @@ -1570,7 +1565,7 @@ void mg_gl_canvas_destroy(mg_canvas_backend* interface) free(backend); } -static int mg_gl_compile_shader(const char* name, GLuint shader, const char* source) +static int oc_gl_compile_shader(const char* name, GLuint shader, const char* source) { int res = 0; @@ -1592,7 +1587,7 @@ static int mg_gl_compile_shader(const char* name, GLuint shader, const char* sou return(res); } -static int mg_gl_canvas_compile_compute_program_named(const char* name, const char* source, GLuint* outProgram) +static int oc_gl_canvas_compile_compute_program_named(const char* name, const char* source, GLuint* outProgram) { int res = 0; *outProgram = 0; @@ -1600,7 +1595,7 @@ static int mg_gl_canvas_compile_compute_program_named(const char* name, const ch GLuint shader = glCreateShader(GL_COMPUTE_SHADER); GLuint program = glCreateProgram(); - res |= mg_gl_compile_shader(name, shader, source); + res |= oc_gl_compile_shader(name, shader, source); if(!res) { @@ -1614,7 +1609,7 @@ static int mg_gl_canvas_compile_compute_program_named(const char* name, const ch char buffer[256]; int size = 0; glGetProgramInfoLog(program, 256, &size, buffer); - log_error("Shader link error (%s): %.*s\n", name, size, buffer); + oc_log_error("Shader link error (%s): %.*s\n", name, size, buffer); res = -1; } @@ -1626,7 +1621,7 @@ static int mg_gl_canvas_compile_compute_program_named(const char* name, const ch return(res); } -int mg_gl_canvas_compile_render_program_named(const char* progName, +int oc_gl_canvas_compile_render_program_named(const char* progName, const char* vertexName, const char* fragmentName, const char* vertexSrc, @@ -1640,8 +1635,8 @@ int mg_gl_canvas_compile_render_program_named(const char* progName, GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); GLuint program = glCreateProgram(); - res |= mg_gl_compile_shader(vertexName, vertexShader, vertexSrc); - res |= mg_gl_compile_shader(fragmentName, fragmentShader, fragmentSrc); + res |= oc_gl_compile_shader(vertexName, vertexShader, vertexSrc); + res |= oc_gl_compile_shader(fragmentName, fragmentShader, fragmentSrc); if(!res) { @@ -1656,7 +1651,7 @@ int mg_gl_canvas_compile_render_program_named(const char* progName, char buffer[256]; int size = 0; glGetProgramInfoLog(program, 256, &size, buffer); - log_error("Shader link error (%s): %.*s\n", progName, size, buffer); + oc_log_error("Shader link error (%s): %.*s\n", progName, size, buffer); res = -1; } else @@ -1667,50 +1662,50 @@ int mg_gl_canvas_compile_render_program_named(const char* progName, return(res); } -#define mg_gl_canvas_compile_compute_program(src, out) \ - mg_gl_canvas_compile_compute_program_named(#src, src, out) +#define oc_gl_canvas_compile_compute_program(src, out) \ + oc_gl_canvas_compile_compute_program_named(#src, src, out) -#define mg_gl_canvas_compile_render_program(progName, shaderSrc, vertexSrc, out) \ - mg_gl_canvas_compile_render_program_named(progName, #shaderSrc, #vertexSrc, shaderSrc, vertexSrc, out) +#define oc_gl_canvas_compile_render_program(progName, shaderSrc, vertexSrc, out) \ + oc_gl_canvas_compile_render_program_named(progName, #shaderSrc, #vertexSrc, shaderSrc, vertexSrc, out) -const u32 MG_GL_PATH_BUFFER_SIZE = (4<<10)*sizeof(mg_gl_path), - MG_GL_ELEMENT_BUFFER_SIZE = (4<<12)*sizeof(mg_gl_path_elt), - MG_GL_SEGMENT_BUFFER_SIZE = (4<<10)*MG_GL_SEGMENT_SIZE, - MG_GL_PATH_QUEUE_BUFFER_SIZE = (4<<10)*MG_GL_PATH_QUEUE_SIZE, - MG_GL_TILE_QUEUE_BUFFER_SIZE = (4<<10)*MG_GL_TILE_QUEUE_SIZE, - MG_GL_TILE_OP_BUFFER_SIZE = (4<<20)*MG_GL_TILE_OP_SIZE; +const u32 OC_GL_PATH_BUFFER_SIZE = (4<<10)*sizeof(oc_gl_path), + OC_GL_ELEMENT_BUFFER_SIZE = (4<<12)*sizeof(oc_gl_path_elt), + OC_GL_SEGMENT_BUFFER_SIZE = (4<<10)*OC_GL_SEGMENT_SIZE, + OC_GL_PATH_QUEUE_BUFFER_SIZE = (4<<10)*OC_GL_PATH_QUEUE_SIZE, + OC_GL_TILE_QUEUE_BUFFER_SIZE = (4<<10)*OC_GL_TILE_QUEUE_SIZE, + OC_GL_TILE_OP_BUFFER_SIZE = (4<<20)*OC_GL_TILE_OP_SIZE; -mg_canvas_backend* gl_canvas_backend_create(mg_wgl_surface* surface) +oc_canvas_backend* oc_gl_canvas_backend_create(oc_wgl_surface* surface) { - mg_gl_canvas_backend* backend = malloc_type(mg_gl_canvas_backend); + oc_gl_canvas_backend* backend = oc_malloc_type(oc_gl_canvas_backend); if(backend) { - memset(backend, 0, sizeof(mg_gl_canvas_backend)); + memset(backend, 0, sizeof(oc_gl_canvas_backend)); backend->surface = surface; - backend->msaaCount = MG_GL_MSAA_COUNT; + backend->msaaCount = OC_GL_MSAA_COUNT; //NOTE(martin): setup interface functions - backend->interface.destroy = mg_gl_canvas_destroy; - backend->interface.render = mg_gl_canvas_render; - backend->interface.imageCreate = mg_gl_canvas_image_create; - backend->interface.imageDestroy = mg_gl_canvas_image_destroy; - backend->interface.imageUploadRegion = mg_gl_canvas_image_upload_region; + backend->interface.destroy = oc_gl_canvas_destroy; + backend->interface.render = oc_gl_canvas_render; + backend->interface.imageCreate = oc_gl_canvas_image_create; + backend->interface.imageDestroy = oc_gl_canvas_image_destroy; + backend->interface.imageUploadRegion = oc_gl_canvas_image_upload_region; - surface->interface.prepare((mg_surface_data*)surface); + surface->interface.prepare((oc_surface_data*)surface); glGenVertexArrays(1, &backend->vao); glBindVertexArray(backend->vao); //NOTE: create programs int err = 0; - err |= mg_gl_canvas_compile_compute_program(glsl_path_setup, &backend->pathSetup); - err |= mg_gl_canvas_compile_compute_program(glsl_segment_setup, &backend->segmentSetup); - err |= mg_gl_canvas_compile_compute_program(glsl_backprop, &backend->backprop); - err |= mg_gl_canvas_compile_compute_program(glsl_merge, &backend->merge); - err |= mg_gl_canvas_compile_compute_program(glsl_balance_workgroups, &backend->balanceWorkgroups); - err |= mg_gl_canvas_compile_compute_program(glsl_raster, &backend->raster); - err |= mg_gl_canvas_compile_render_program("blit", glsl_blit_vertex, glsl_blit_fragment, &backend->blit); + err |= oc_gl_canvas_compile_compute_program(glsl_path_setup, &backend->pathSetup); + err |= oc_gl_canvas_compile_compute_program(glsl_segment_setup, &backend->segmentSetup); + err |= oc_gl_canvas_compile_compute_program(glsl_backprop, &backend->backprop); + err |= oc_gl_canvas_compile_compute_program(glsl_merge, &backend->merge); + err |= oc_gl_canvas_compile_compute_program(glsl_balance_workgroups, &backend->balanceWorkgroups); + err |= oc_gl_canvas_compile_compute_program(glsl_raster, &backend->raster); + err |= oc_gl_canvas_compile_render_program("blit", glsl_blit_vertex, glsl_blit_fragment, &backend->blit); if(glGetError() != GL_NO_ERROR) { @@ -1718,10 +1713,10 @@ mg_canvas_backend* gl_canvas_backend_create(mg_wgl_surface* surface) } //NOTE: create out texture - vec2 size = surface->interface.getSize((mg_surface_data*)surface); - vec2 scale = surface->interface.contentsScaling((mg_surface_data*)surface); + oc_vec2 size = surface->interface.getSize((oc_surface_data*)surface); + oc_vec2 scale = surface->interface.contentsScaling((oc_surface_data*)surface); - backend->frameSize = (vec2){size.x * scale.x, size.y * scale.y}; + backend->frameSize = (oc_vec2){size.x * scale.x, size.y * scale.y}; glGenTextures(1, &backend->outTexture); glBindTexture(GL_TEXTURE_2D, backend->outTexture); @@ -1733,26 +1728,26 @@ mg_canvas_backend* gl_canvas_backend_create(mg_wgl_surface* surface) glGenBuffers(1, &backend->dummyVertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, backend->dummyVertexBuffer); - for(int i=0; ipathBuffer[i].buffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->pathBuffer[i].buffer); - glBufferStorage(GL_SHADER_STORAGE_BUFFER, MG_GL_PATH_BUFFER_SIZE, 0, GL_MAP_WRITE_BIT|GL_MAP_PERSISTENT_BIT); - backend->pathBuffer[i].size = MG_GL_PATH_BUFFER_SIZE; + glBufferStorage(GL_SHADER_STORAGE_BUFFER, OC_GL_PATH_BUFFER_SIZE, 0, GL_MAP_WRITE_BIT|GL_MAP_PERSISTENT_BIT); + backend->pathBuffer[i].size = OC_GL_PATH_BUFFER_SIZE; backend->pathBuffer[i].contents = glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, - MG_GL_PATH_BUFFER_SIZE, + OC_GL_PATH_BUFFER_SIZE, GL_MAP_WRITE_BIT |GL_MAP_PERSISTENT_BIT |GL_MAP_FLUSH_EXPLICIT_BIT); glGenBuffers(1, &backend->elementBuffer[i].buffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->elementBuffer[i].buffer); - glBufferStorage(GL_SHADER_STORAGE_BUFFER, MG_GL_ELEMENT_BUFFER_SIZE, 0, GL_MAP_WRITE_BIT|GL_MAP_PERSISTENT_BIT); - backend->elementBuffer[i].size = MG_GL_ELEMENT_BUFFER_SIZE; + glBufferStorage(GL_SHADER_STORAGE_BUFFER, OC_GL_ELEMENT_BUFFER_SIZE, 0, GL_MAP_WRITE_BIT|GL_MAP_PERSISTENT_BIT); + backend->elementBuffer[i].size = OC_GL_ELEMENT_BUFFER_SIZE; backend->elementBuffer[i].contents = glMapBufferRange(GL_SHADER_STORAGE_BUFFER, 0, - MG_GL_ELEMENT_BUFFER_SIZE, + OC_GL_ELEMENT_BUFFER_SIZE, GL_MAP_WRITE_BIT |GL_MAP_PERSISTENT_BIT |GL_MAP_FLUSH_EXPLICIT_BIT); @@ -1760,7 +1755,7 @@ mg_canvas_backend* gl_canvas_backend_create(mg_wgl_surface* surface) glGenBuffers(1, &backend->segmentBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->segmentBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, MG_GL_SEGMENT_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, OC_GL_SEGMENT_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); glGenBuffers(1, &backend->segmentCountBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->segmentCountBuffer); @@ -1768,11 +1763,11 @@ mg_canvas_backend* gl_canvas_backend_create(mg_wgl_surface* surface) glGenBuffers(1, &backend->pathQueueBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->pathQueueBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, MG_GL_PATH_QUEUE_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, OC_GL_PATH_QUEUE_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); glGenBuffers(1, &backend->tileQueueBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->tileQueueBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, MG_GL_TILE_QUEUE_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, OC_GL_TILE_QUEUE_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); glGenBuffers(1, &backend->tileQueueCountBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->tileQueueCountBuffer); @@ -1780,19 +1775,19 @@ mg_canvas_backend* gl_canvas_backend_create(mg_wgl_surface* surface) glGenBuffers(1, &backend->tileOpBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->tileOpBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, MG_GL_TILE_OP_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, OC_GL_TILE_OP_BUFFER_SIZE, 0, GL_DYNAMIC_COPY); glGenBuffers(1, &backend->tileOpCountBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->tileOpCountBuffer); glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(int), 0, GL_DYNAMIC_COPY); - int tileSize = MG_GL_TILE_SIZE; + int tileSize = OC_GL_TILE_SIZE; int nTilesX = (int)(backend->frameSize.x + tileSize - 1)/tileSize; int nTilesY = (int)(backend->frameSize.y + tileSize - 1)/tileSize; glGenBuffers(1, &backend->screenTilesBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->screenTilesBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, nTilesX*nTilesY*MG_GL_SCREEN_TILE_SIZE, 0, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, nTilesX*nTilesY*OC_GL_SCREEN_TILE_SIZE, 0, GL_DYNAMIC_COPY); glGenBuffers(1, &backend->screenTilesCountBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->screenTilesCountBuffer); @@ -1800,33 +1795,33 @@ mg_canvas_backend* gl_canvas_backend_create(mg_wgl_surface* surface) glGenBuffers(1, &backend->rasterDispatchBuffer); glBindBuffer(GL_SHADER_STORAGE_BUFFER, backend->rasterDispatchBuffer); - glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(mg_gl_dispatch_indirect_command), 0, GL_DYNAMIC_COPY); + glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(oc_gl_dispatch_indirect_command), 0, GL_DYNAMIC_COPY); if(err) { - mg_gl_canvas_destroy((mg_canvas_backend*)backend); + oc_gl_canvas_destroy((oc_canvas_backend*)backend); backend = 0; } } - return((mg_canvas_backend*)backend); + return((oc_canvas_backend*)backend); } -mg_surface_data* gl_canvas_surface_create_for_window(mp_window window) +oc_surface_data* oc_gl_canvas_surface_create_for_window(oc_window window) { - mg_wgl_surface* surface = (mg_wgl_surface*)mg_wgl_surface_create_for_window(window); + oc_wgl_surface* surface = (oc_wgl_surface*)oc_wgl_surface_create_for_window(window); if(surface) { - surface->interface.backend = gl_canvas_backend_create(surface); + surface->interface.backend = oc_gl_canvas_backend_create(surface); if(surface->interface.backend) { - surface->interface.api = MG_CANVAS; + surface->interface.api = OC_CANVAS; } else { - surface->interface.destroy((mg_surface_data*)surface); + surface->interface.destroy((oc_surface_data*)surface); surface = 0; } } - return((mg_surface_data*)surface); + return((oc_surface_data*)surface); } diff --git a/src/graphics/gl_loader.c b/src/graphics/gl_loader.c index da206cc..87994a0 100644 --- a/src/graphics/gl_loader.c +++ b/src/graphics/gl_loader.c @@ -1,9450 +1,9450 @@ -/******************************************************** -* -* @file: gl_loader.c -* @note: auto-generated by glapi.py from gl.xml -* @date: 11/082023 -* -*********************************************************/ -#include"gl_loader.h" -#include"platform/platform.h" - -mp_thread_local mg_gl_api* __mgGLAPI = 0; -mg_gl_api __mgGLNoAPI; - -void mg_glGetProgramBinary_noimpl(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramBinary is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFrontFace_noimpl(GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFrontFace is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDisablei_noimpl(GLenum target, GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDisablei is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBeginConditionalRender_noimpl(GLuint id, GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBeginConditionalRender is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCopyTexSubImage3D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCopyTexSubImage3D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCompressedTexSubImage1D_noimpl(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCompressedTexSubImage1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4usv_noimpl(GLuint index, const GLushort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4usv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib2sv_noimpl(GLuint index, const GLshort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib2sv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix2x3fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix2x3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMultiDrawArraysIndirect_noimpl(GLenum mode, const void * indirect, GLsizei drawcount, GLsizei stride) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMultiDrawArraysIndirect is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glColorMaski_noimpl(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glColorMaski is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindVertexArray_noimpl(GLuint array) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindVertexArray is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform3d_noimpl(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetBufferParameteri64v_noimpl(GLenum target, GLenum pname, GLint64 * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetBufferParameteri64v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform4i_noimpl(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetAttachedShaders_noimpl(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetAttachedShaders is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glAttachShader_noimpl(GLuint program, GLuint shader) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glAttachShader is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI2ui_noimpl(GLuint index, GLuint x, GLuint y) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI2ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearColor_noimpl(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearColor is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexParameterIiv_noimpl(GLenum target, GLenum pname, const GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexParameterIiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4d_noimpl(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawTransformFeedbackStream_noimpl(GLenum mode, GLuint id, GLuint stream) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawTransformFeedbackStream is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4iv_noimpl(GLuint index, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCopyBufferSubData_noimpl(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCopyBufferSubData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDebugMessageInsert_noimpl(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDebugMessageInsert is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glViewportIndexedf_noimpl(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glViewportIndexedf is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform1fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glObjectPtrLabel_noimpl(const void * ptr, GLsizei length, const GLchar * label) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glObjectPtrLabel is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glStencilMaskSeparate_noimpl(GLenum face, GLuint mask) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glStencilMaskSeparate is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix3x4dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix3x4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFramebufferTexture1D_noimpl(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFramebufferTexture1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glViewport_noimpl(GLint x, GLint y, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glViewport is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenTextures_noimpl(GLsizei n, GLuint * textures) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenTextures is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformBlockBinding_noimpl(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformBlockBinding is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib3sv_noimpl(GLuint index, const GLshort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib3sv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix3x4fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix3x4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib2f_noimpl(GLuint index, GLfloat x, GLfloat y) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib2f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveUniform_noimpl(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveUniform is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glScissorIndexed_noimpl(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glScissorIndexed is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexParameterf_noimpl(GLenum target, GLenum pname, GLfloat param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexParameterf is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindSampler_noimpl(GLuint unit, GLuint sampler) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindSampler is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMultiDrawElementsIndirect_noimpl(GLenum mode, GLenum type, const void * indirect, GLsizei drawcount, GLsizei stride) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMultiDrawElementsIndirect is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearTexSubImage_noimpl(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearTexSubImage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsEnabledi_noimpl(GLenum target, GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsEnabledi is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glScissor_noimpl(GLint x, GLint y, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glScissor is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramBinary_noimpl(GLuint program, GLenum binaryFormat, const void * binary, GLsizei length) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramBinary is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDisable_noimpl(GLenum cap) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDisable is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveUniformBlockName_noimpl(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveUniformBlockName is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawRangeElementsBaseVertex_noimpl(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawRangeElementsBaseVertex is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDebugMessageCallback_noimpl(GLDEBUGPROC callback, const void * userParam) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDebugMessageCallback is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendEquationi_noimpl(GLuint buf, GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendEquationi is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4uiv_noimpl(GLuint index, const GLuint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendFunci_noimpl(GLuint buf, GLenum src, GLenum dst) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendFunci is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glValidateProgramPipeline_noimpl(GLuint pipeline) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glValidateProgramPipeline is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteVertexArrays_noimpl(GLsizei n, const GLuint * arrays) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteVertexArrays is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenRenderbuffers_noimpl(GLsizei n, GLuint * renderbuffers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenRenderbuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLenum mg_glCheckFramebufferStatus_noimpl(GLenum target) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCheckFramebufferStatus is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLenum)0); -} -void mg_glUniform1ui_noimpl(GLint location, GLuint v0) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform3ui_noimpl(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4bv_noimpl(GLuint index, const GLbyte * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4bv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLint mg_glGetProgramResourceLocationIndex_noimpl(GLuint program, GLenum programInterface, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramResourceLocationIndex is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLint)0); -} -void mg_glProgramUniform3fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPolygonOffset_noimpl(GLfloat factor, GLfloat units) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPolygonOffset is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsProgram_noimpl(GLuint program) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsProgram is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glClearDepthf_noimpl(GLfloat d) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearDepthf is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glEndConditionalRender_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glEndConditionalRender is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetObjectLabel_noimpl(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetObjectLabel is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix4x2fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix4x2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI3i_noimpl(GLuint index, GLint x, GLint y, GLint z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI3i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenSamplers_noimpl(GLsizei count, GLuint * samplers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenSamplers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI2uiv_noimpl(GLuint index, const GLuint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI2uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glStencilOpSeparate_noimpl(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glStencilOpSeparate is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetProgramInterfaceiv_noimpl(GLuint program, GLenum programInterface, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramInterfaceiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetObjectPtrLabel_noimpl(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetObjectPtrLabel is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix2fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetInteger64v_noimpl(GLenum pname, GLint64 * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetInteger64v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -const GLubyte * mg_glGetString_noimpl(GLenum name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetString is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((const GLubyte *)0); -} -GLboolean mg_glIsSync_noimpl(GLsync sync) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsSync is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glCopyTexImage1D_noimpl(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCopyTexImage1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glSamplerParameterIiv_noimpl(GLuint sampler, GLenum pname, const GLint * param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSamplerParameterIiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib3fv_noimpl(GLuint index, const GLfloat * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBeginQuery_noimpl(GLenum target, GLuint id) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBeginQuery is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetBufferPointerv_noimpl(GLenum target, GLenum pname, void ** params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetBufferPointerv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlitFramebuffer_noimpl(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlitFramebuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetSamplerParameteriv_noimpl(GLuint sampler, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetSamplerParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPointParameteri_noimpl(GLenum pname, GLint param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPointParameteri is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPolygonMode_noimpl(GLenum face, GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPolygonMode is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawElementsIndirect_noimpl(GLenum mode, GLenum type, const void * indirect) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawElementsIndirect is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexImage2DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexImage2DMultisample is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL3d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL3d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4i_noimpl(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetUniformfv_noimpl(GLuint program, GLint location, GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDebugMessageControl_noimpl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDebugMessageControl is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexParameteriv_noimpl(GLenum target, GLenum pname, const GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsBuffer_noimpl(GLuint buffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glProgramUniformMatrix3dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindFramebuffer_noimpl(GLenum target, GLuint framebuffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindFramebuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBufferStorage_noimpl(GLenum target, GLsizeiptr size, const void * data, GLbitfield flags) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBufferStorage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindTextures_noimpl(GLuint first, GLsizei count, const GLuint * textures) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindTextures is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCompressedTexImage3D_noimpl(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCompressedTexImage3D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix4x2dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix4x2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPushDebugGroup_noimpl(GLenum source, GLuint id, GLsizei length, const GLchar * message) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPushDebugGroup is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glSamplerParameteriv_noimpl(GLuint sampler, GLenum pname, const GLint * param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSamplerParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI2i_noimpl(GLuint index, GLint x, GLint y) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI2i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindTransformFeedback_noimpl(GLenum target, GLuint id) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindTransformFeedback is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetRenderbufferParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetRenderbufferParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2fv_noimpl(GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib1dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib1dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glSamplerParameteri_noimpl(GLuint sampler, GLenum pname, GLint param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSamplerParameteri is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexBufferRange_noimpl(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexBufferRange is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetShaderiv_noimpl(GLuint shader, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetShaderiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glStencilMask_noimpl(GLuint mask) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glStencilMask is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib3f_noimpl(GLuint index, GLfloat x, GLfloat y, GLfloat z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib3f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetProgramPipelineiv_noimpl(GLuint pipeline, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramPipelineiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteQueries_noimpl(GLsizei n, const GLuint * ids) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteQueries is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform3uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix2x4fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix2x4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform1f_noimpl(GLint location, GLfloat v0) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexSubImage1D_noimpl(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexSubImage1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearBufferiv_noimpl(GLenum buffer, GLint drawbuffer, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearBufferiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glInvalidateTexImage_noimpl(GLuint texture, GLint level) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glInvalidateTexImage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearBufferSubData_noimpl(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearBufferSubData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearTexImage_noimpl(GLuint texture, GLint level, GLenum format, GLenum type, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearTexImage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glRenderbufferStorageMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glRenderbufferStorageMultisample is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFramebufferTextureLayer_noimpl(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFramebufferTextureLayer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2f_noimpl(GLint location, GLfloat v0, GLfloat v1) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL4d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL4d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexImage2D_noimpl(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexImage2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glLogicOp_noimpl(GLenum opcode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glLogicOp is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindTexture_noimpl(GLenum target, GLuint texture) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindTexture is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib1fv_noimpl(GLuint index, const GLfloat * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib1fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix3fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLint mg_glGetFragDataIndex_noimpl(GLuint program, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetFragDataIndex is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLint)0); -} -void mg_glUniformMatrix2x3dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix2x3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetVertexAttribLdv_noimpl(GLuint index, GLenum pname, GLdouble * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetVertexAttribLdv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindRenderbuffer_noimpl(GLenum target, GLuint renderbuffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindRenderbuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform1d_noimpl(GLint location, GLdouble x) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix2x4fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix2x4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMinSampleShading_noimpl(GLfloat value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMinSampleShading is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCopyTexSubImage1D_noimpl(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCopyTexSubImage1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexImage1D_noimpl(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexImage1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib1f_noimpl(GLuint index, GLfloat x) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib1f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glLineWidth_noimpl(GLfloat width) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glLineWidth is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPointParameterf_noimpl(GLenum pname, GLfloat param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPointParameterf is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawElementsInstancedBaseVertexBaseInstance_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawElementsInstancedBaseVertexBaseInstance is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveSubroutineUniformiv_noimpl(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint * values) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveSubroutineUniformiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform4ui_noimpl(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribBinding_noimpl(GLuint attribindex, GLuint bindingindex) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribBinding is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTexParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTexParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glRenderbufferStorage_noimpl(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glRenderbufferStorage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4iv_noimpl(GLuint index, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix3fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetBooleanv_noimpl(GLenum pname, GLboolean * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetBooleanv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix2x3dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix2x3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix4dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2iv_noimpl(GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBufferData_noimpl(GLenum target, GLsizeiptr size, const void * data, GLenum usage) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBufferData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveSubroutineUniformName_noimpl(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveSubroutineUniformName is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -const GLubyte * mg_glGetStringi_noimpl(GLenum name, GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetStringi is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((const GLubyte *)0); -} -void mg_glBindImageTexture_noimpl(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindImageTexture is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix3x2dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix3x2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL4dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexStorage3DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexStorage3DMultisample is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDepthRangeArrayv_noimpl(GLuint first, GLsizei count, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDepthRangeArrayv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetUniformiv_noimpl(GLuint program, GLint location, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteTextures_noimpl(GLsizei n, const GLuint * textures) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteTextures is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLuint mg_glCreateShader_noimpl(GLenum type) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCreateShader is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLuint)0); -} -void mg_glVertexAttrib4s_noimpl(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4s is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPrimitiveBoundingBox_noimpl(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPrimitiveBoundingBox is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawBuffers_noimpl(GLsizei n, const GLenum * bufs) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawBuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib2dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexParameterIuiv_noimpl(GLenum target, GLenum pname, const GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexParameterIuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glQueryCounter_noimpl(GLuint id, GLenum target) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glQueryCounter is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL1dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL1dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform1d_noimpl(GLuint program, GLint location, GLdouble v0) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteRenderbuffers_noimpl(GLsizei n, const GLuint * renderbuffers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteRenderbuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPopDebugGroup_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPopDebugGroup is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMultiDrawArrays_noimpl(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMultiDrawArrays is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveUniformsiv_noimpl(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveUniformsiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFlush_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFlush is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glUnmapBuffer_noimpl(GLenum target) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUnmapBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glFramebufferTexture3D_noimpl(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFramebufferTexture3D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform1fv_noimpl(GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsFramebuffer_noimpl(GLuint framebuffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsFramebuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glValidateProgram_noimpl(GLuint program) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glValidateProgram is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetVertexAttribPointerv_noimpl(GLuint index, GLenum pname, void ** pointer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetVertexAttribPointerv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glReadnPixels_noimpl(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glReadnPixels is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribP2ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP2ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2i_noimpl(GLuint program, GLint location, GLint v0, GLint v1) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPatchParameteri_noimpl(GLenum pname, GLint value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPatchParameteri is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4Nub_noimpl(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4Nub is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenQueries_noimpl(GLsizei n, GLuint * ids) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenQueries is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2ui_noimpl(GLuint program, GLint location, GLuint v0, GLuint v1) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindSamplers_noimpl(GLuint first, GLsizei count, const GLuint * samplers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindSamplers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDisableVertexAttribArray_noimpl(GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDisableVertexAttribArray is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glEnablei_noimpl(GLenum target, GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glEnablei is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetSynciv_noimpl(GLsync sync, GLenum pname, GLsizei count, GLsizei * length, GLint * values) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetSynciv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib3s_noimpl(GLuint index, GLshort x, GLshort y, GLshort z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib3s is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTexParameterIiv_noimpl(GLenum target, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTexParameterIiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexBindingDivisor_noimpl(GLuint bindingindex, GLuint divisor) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexBindingDivisor is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDepthRangef_noimpl(GLfloat n, GLfloat f) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDepthRangef is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4Nuiv_noimpl(GLuint index, const GLuint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4Nuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFinish_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFinish is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendFunc_noimpl(GLenum sfactor, GLenum dfactor) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendFunc is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawTransformFeedbackStreamInstanced_noimpl(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawTransformFeedbackStreamInstanced is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix4x3fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix4x3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix4x2dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix4x2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2d_noimpl(GLint location, GLdouble x, GLdouble y) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetnUniformfv_noimpl(GLuint program, GLint location, GLsizei bufSize, GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetnUniformfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetFloati_v_noimpl(GLenum target, GLuint index, GLfloat * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetFloati_v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetInteger64i_v_noimpl(GLenum target, GLuint index, GLint64 * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetInteger64i_v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform3f_noimpl(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetFramebufferParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetFramebufferParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4bv_noimpl(GLuint index, const GLbyte * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4bv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteProgram_noimpl(GLuint program) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteProgram is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCopyTexImage2D_noimpl(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCopyTexImage2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetUniformuiv_noimpl(GLuint program, GLint location, GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawArraysIndirect_noimpl(GLenum mode, const void * indirect) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawArraysIndirect is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix4x2fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix4x2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFramebufferRenderbuffer_noimpl(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFramebufferRenderbuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2i_noimpl(GLint location, GLint v0, GLint v1) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform3dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glScissorIndexedv_noimpl(GLuint index, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glScissorIndexedv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2d_noimpl(GLuint program, GLint location, GLdouble v0, GLdouble v1) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4f_noimpl(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendEquationSeparatei_noimpl(GLuint buf, GLenum modeRGB, GLenum modeAlpha) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendEquationSeparatei is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetUniformdv_noimpl(GLuint program, GLint location, GLdouble * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformdv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawRangeElements_noimpl(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawRangeElements is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix3dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI1uiv_noimpl(GLuint index, const GLuint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI1uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBeginQueryIndexed_noimpl(GLenum target, GLuint index, GLuint id) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBeginQueryIndexed is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPointParameterfv_noimpl(GLenum pname, const GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPointParameterfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glSampleCoverage_noimpl(GLfloat value, GLboolean invert) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSampleCoverage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glResumeTransformFeedback_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glResumeTransformFeedback is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glReadPixels_noimpl(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glReadPixels is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glLinkProgram_noimpl(GLuint program) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glLinkProgram is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glWaitSync_noimpl(GLsync sync, GLbitfield flags, GLuint64 timeout) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glWaitSync is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glActiveShaderProgram_noimpl(GLuint pipeline, GLuint program) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glActiveShaderProgram is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetQueryObjectiv_noimpl(GLuint id, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetQueryObjectiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform3i_noimpl(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform1ui_noimpl(GLuint program, GLint location, GLuint v0) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendBarrier_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendBarrier is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4ubv_noimpl(GLuint index, const GLubyte * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4ubv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetQueryObjecti64v_noimpl(GLuint id, GLenum pname, GLint64 * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetQueryObjecti64v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix4dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform1iv_noimpl(GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glEnable_noimpl(GLenum cap) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glEnable is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenBuffers_noimpl(GLsizei n, GLuint * buffers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenBuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexStorage3D_noimpl(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexStorage3D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glInvalidateTexSubImage_noimpl(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glInvalidateTexSubImage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform1i_noimpl(GLuint program, GLint location, GLint v0) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendEquation_noimpl(GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendEquation is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDepthRange_noimpl(GLdouble n, GLdouble f) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDepthRange is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2dv_noimpl(GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendFuncSeparate_noimpl(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendFuncSeparate is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform1dv_noimpl(GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glEndQueryIndexed_noimpl(GLenum target, GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glEndQueryIndexed is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteTransformFeedbacks_noimpl(GLsizei n, const GLuint * ids) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteTransformFeedbacks is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendFuncSeparatei_noimpl(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendFuncSeparatei is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDepthFunc_noimpl(GLenum func) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDepthFunc is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glInvalidateBufferData_noimpl(GLuint buffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glInvalidateBufferData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindImageTextures_noimpl(GLuint first, GLsizei count, const GLuint * textures) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindImageTextures is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteFramebuffers_noimpl(GLsizei n, const GLuint * framebuffers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteFramebuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI2iv_noimpl(GLuint index, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI2iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4sv_noimpl(GLuint index, const GLshort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4sv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribFormat_noimpl(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribFormat is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void * mg_glMapBufferRange_noimpl(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMapBufferRange is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((void *)0); -} -void mg_glDetachShader_noimpl(GLuint program, GLuint shader) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDetachShader is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetBooleani_v_noimpl(GLenum target, GLuint index, GLboolean * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetBooleani_v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDepthRangeIndexed_noimpl(GLuint index, GLdouble n, GLdouble f) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDepthRangeIndexed is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPauseTransformFeedback_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPauseTransformFeedback is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL3dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPrimitiveRestartIndex_noimpl(GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPrimitiveRestartIndex is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform4d_noimpl(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTransformFeedbackVaryings_noimpl(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTransformFeedbackVaryings is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteBuffers_noimpl(GLsizei n, const GLuint * buffers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteBuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLint mg_glGetProgramResourceLocation_noimpl(GLuint program, GLenum programInterface, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramResourceLocation is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLint)0); -} -void mg_glUniform4f_noimpl(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetSamplerParameterfv_noimpl(GLuint sampler, GLenum pname, GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetSamplerParameterfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribP4ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP4ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsRenderbuffer_noimpl(GLuint renderbuffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsRenderbuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glVertexAttrib4Nbv_noimpl(GLuint index, const GLbyte * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4Nbv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4Nsv_noimpl(GLuint index, const GLshort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4Nsv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCullFace_noimpl(GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCullFace is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMultiDrawElementsBaseVertex_noimpl(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMultiDrawElementsBaseVertex is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI3ui_noimpl(GLuint index, GLuint x, GLuint y, GLuint z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI3ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLuint mg_glGetUniformBlockIndex_noimpl(GLuint program, const GLchar * uniformBlockName) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformBlockIndex is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLuint)0); -} -void mg_glUseProgramStages_noimpl(GLuint pipeline, GLbitfield stages, GLuint program) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUseProgramStages is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveAttrib_noimpl(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveAttrib is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawArraysInstancedBaseInstance_noimpl(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawArraysInstancedBaseInstance is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsProgramPipeline_noimpl(GLuint pipeline) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsProgramPipeline is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glProgramUniform1uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform3iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform3iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glReadBuffer_noimpl(GLenum src) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glReadBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteShader_noimpl(GLuint shader) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteShader is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLuint mg_glCreateShaderProgramv_noimpl(GLenum type, GLsizei count, const GLchar *const* strings) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCreateShaderProgramv is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLuint)0); -} -GLenum mg_glClientWaitSync_noimpl(GLsync sync, GLbitfield flags, GLuint64 timeout) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClientWaitSync is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLenum)0); -} -void mg_glCompressedTexImage1D_noimpl(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCompressedTexImage1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib2d_noimpl(GLuint index, GLdouble x, GLdouble y) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib2d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib3dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4i_noimpl(GLuint index, GLint x, GLint y, GLint z, GLint w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL2dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetDoublei_v_noimpl(GLenum target, GLuint index, GLdouble * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetDoublei_v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexParameterfv_noimpl(GLenum target, GLenum pname, const GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexParameterfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLint mg_glGetAttribLocation_noimpl(GLuint program, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetAttribLocation is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLint)0); -} -void mg_glVertexAttribP1ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP1ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribIFormat_noimpl(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribIFormat is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI1ui_noimpl(GLuint index, GLuint x) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI1ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetVertexAttribiv_noimpl(GLuint index, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetVertexAttribiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveSubroutineName_noimpl(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveSubroutineName is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsQuery_noimpl(GLuint id) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsQuery is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glVertexAttrib1sv_noimpl(GLuint index, const GLshort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib1sv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix2fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUseProgram_noimpl(GLuint program) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUseProgram is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClear_noimpl(GLbitfield mask) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClear is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4ubv_noimpl(GLuint index, const GLubyte * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4ubv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glInvalidateFramebuffer_noimpl(GLenum target, GLsizei numAttachments, const GLenum * attachments) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glInvalidateFramebuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPixelStorei_noimpl(GLenum pname, GLint param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPixelStorei is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform1i_noimpl(GLint location, GLint v0) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform1uiv_noimpl(GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform1uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexImage3DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexImage3DMultisample is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindBuffer_noimpl(GLenum target, GLuint buffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glActiveTexture_noimpl(GLenum texture) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glActiveTexture is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteSync_noimpl(GLsync sync) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteSync is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4Niv_noimpl(GLuint index, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4Niv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4uiv_noimpl(GLuint index, const GLuint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3fv_noimpl(GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenVertexArrays_noimpl(GLsizei n, GLuint * arrays) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenVertexArrays is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix3x2fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix3x2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindAttribLocation_noimpl(GLuint program, GLuint index, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindAttribLocation is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCopyTexSubImage2D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCopyTexSubImage2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendColor_noimpl(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendColor is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glReleaseShaderCompiler_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glReleaseShaderCompiler is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenTransformFeedbacks_noimpl(GLsizei n, GLuint * ids) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenTransformFeedbacks is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsShader_noimpl(GLuint shader) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsShader is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glDrawElementsInstancedBaseVertex_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawElementsInstancedBaseVertex is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribLFormat_noimpl(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribLFormat is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindBuffersRange_noimpl(GLenum target, GLuint first, GLsizei count, const GLuint * buffers, const GLintptr * offsets, const GLsizeiptr * sizes) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindBuffersRange is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glColorMask_noimpl(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glColorMask is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix2x4dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix2x4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetDoublev_noimpl(GLenum pname, GLdouble * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetDoublev is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix3x2dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix3x2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL2d_noimpl(GLuint index, GLdouble x, GLdouble y) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL2d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFlushMappedBufferRange_noimpl(GLenum target, GLintptr offset, GLsizeiptr length) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFlushMappedBufferRange is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPointParameteriv_noimpl(GLenum pname, const GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPointParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformSubroutinesuiv_noimpl(GLenum shadertype, GLsizei count, const GLuint * indices) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformSubroutinesuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix4x3fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix4x3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetBufferParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetBufferParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTexImage_noimpl(GLenum target, GLint level, GLenum format, GLenum type, void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTexImage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix2x4dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix2x4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI1iv_noimpl(GLuint index, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI1iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsSampler_noimpl(GLuint sampler) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsSampler is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glGetVertexAttribfv_noimpl(GLuint index, GLenum pname, GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetVertexAttribfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexStorage1D_noimpl(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexStorage1D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glViewportArrayv_noimpl(GLuint first, GLsizei count, const GLfloat * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glViewportArrayv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexImage3D_noimpl(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexImage3D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix4fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTexLevelParameteriv_noimpl(GLenum target, GLint level, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTexLevelParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetVertexAttribdv_noimpl(GLuint index, GLenum pname, GLdouble * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetVertexAttribdv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glInvalidateBufferSubData_noimpl(GLuint buffer, GLintptr offset, GLsizeiptr length) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glInvalidateBufferSubData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4f_noimpl(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib2s_noimpl(GLuint index, GLshort x, GLshort y) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib2s is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexSubImage3D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexSubImage3D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLint mg_glGetFragDataLocation_noimpl(GLuint program, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetFragDataLocation is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLint)0); -} -void mg_glVertexAttribI1i_noimpl(GLuint index, GLint x) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI1i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveAtomicCounterBufferiv_noimpl(GLuint program, GLuint bufferIndex, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveAtomicCounterBufferiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexStorage2DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexStorage2DMultisample is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindBuffersBase_noimpl(GLenum target, GLuint first, GLsizei count, const GLuint * buffers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindBuffersBase is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetUniformSubroutineuiv_noimpl(GLenum shadertype, GLint location, GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformSubroutineuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glEndTransformFeedback_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glEndTransformFeedback is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glShaderSource_noimpl(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glShaderSource is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetQueryObjectuiv_noimpl(GLuint id, GLenum pname, GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetQueryObjectuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTexLevelParameterfv_noimpl(GLenum target, GLint level, GLenum pname, GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTexLevelParameterfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3d_noimpl(GLint location, GLdouble x, GLdouble y, GLdouble z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearBufferfv_noimpl(GLenum buffer, GLint drawbuffer, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearBufferfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetSamplerParameterIiv_noimpl(GLuint sampler, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetSamplerParameterIiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMemoryBarrierByRegion_noimpl(GLbitfield barriers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMemoryBarrierByRegion is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenProgramPipelines_noimpl(GLsizei n, GLuint * pipelines) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenProgramPipelines is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindFragDataLocation_noimpl(GLuint program, GLuint color, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindFragDataLocation is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetShaderInfoLog_noimpl(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetShaderInfoLog is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTextureView_noimpl(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTextureView is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsEnabled_noimpl(GLenum cap) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsEnabled is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glPatchParameterfv_noimpl(GLenum pname, const GLfloat * values) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPatchParameterfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glHint_noimpl(GLenum target, GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glHint is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPixelStoref_noimpl(GLenum pname, GLfloat param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPixelStoref is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBlendEquationSeparate_noimpl(GLenum modeRGB, GLenum modeAlpha) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBlendEquationSeparate is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearBufferuiv_noimpl(GLenum buffer, GLint drawbuffer, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearBufferuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glObjectLabel_noimpl(GLenum identifier, GLuint name, GLsizei length, const GLchar * label) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glObjectLabel is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetPointerv_noimpl(GLenum pname, void ** params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetPointerv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteSamplers_noimpl(GLsizei count, const GLuint * samplers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteSamplers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glEnableVertexAttribArray_noimpl(GLuint index) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glEnableVertexAttribArray is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClampColor_noimpl(GLenum target, GLenum clamp) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClampColor is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetShaderPrecisionFormat_noimpl(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetShaderPrecisionFormat is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetnUniformiv_noimpl(GLuint program, GLint location, GLsizei bufSize, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetnUniformiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3iv_noimpl(GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI3uiv_noimpl(GLuint index, const GLuint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI3uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBufferSubData_noimpl(GLenum target, GLintptr offset, GLsizeiptr size, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBufferSubData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glSamplerParameterfv_noimpl(GLuint sampler, GLenum pname, const GLfloat * param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSamplerParameterfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4sv_noimpl(GLuint index, const GLshort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4sv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexBuffer_noimpl(GLenum target, GLenum internalformat, GLuint buffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLuint mg_glCreateProgram_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCreateProgram is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLuint)0); -} -void mg_glBindBufferRange_noimpl(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindBufferRange is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsTexture_noimpl(GLuint texture) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsTexture is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glUniformMatrix3x2fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix3x2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawElements_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawElements is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform1f_noimpl(GLuint program, GLint location, GLfloat v0) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3dv_noimpl(GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawElementsInstanced_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawElementsInstanced is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenerateMipmap_noimpl(GLenum target) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenerateMipmap is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4ui_noimpl(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetVertexAttribIuiv_noimpl(GLuint index, GLenum pname, GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetVertexAttribIuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearDepth_noimpl(GLdouble depth) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearDepth is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawTransformFeedback_noimpl(GLenum mode, GLuint id) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawTransformFeedback is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexSubImage2D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexSubImage2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribP4uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP4uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTexParameterIuiv_noimpl(GLenum target, GLenum pname, GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTexParameterIuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glPointSize_noimpl(GLfloat size) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glPointSize is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetCompressedTexImage_noimpl(GLenum target, GLint level, void * img) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetCompressedTexImage is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2uiv_noimpl(GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLsync mg_glFenceSync_noimpl(GLenum condition, GLbitfield flags) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFenceSync is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLsync)0); -} -void * mg_glMapBuffer_noimpl(GLenum target, GLenum access) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMapBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((void *)0); -} -void mg_glGetFramebufferAttachmentParameteriv_noimpl(GLenum target, GLenum attachment, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetFramebufferAttachmentParameteriv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBeginTransformFeedback_noimpl(GLenum primitiveMode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBeginTransformFeedback is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexParameteri_noimpl(GLenum target, GLenum pname, GLint param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexParameteri is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTexParameterfv_noimpl(GLenum target, GLenum pname, GLfloat * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTexParameterfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribL1d_noimpl(GLuint index, GLdouble x) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribL1d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4Nusv_noimpl(GLuint index, const GLushort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4Nusv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2f_noimpl(GLuint program, GLint location, GLfloat v0, GLfloat v1) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib1d_noimpl(GLuint index, GLdouble x) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib1d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLenum mg_glGetError_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetError is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLenum)0); -} -void mg_glVertexAttribP2uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP2uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix4x3dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix4x3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetShaderSource_noimpl(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetShaderSource is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glStencilFuncSeparate_noimpl(GLenum face, GLenum func, GLint ref, GLuint mask) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glStencilFuncSeparate is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFramebufferTexture_noimpl(GLenum target, GLenum attachment, GLuint texture, GLint level) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFramebufferTexture is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix4x3dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix4x3dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform4dv_noimpl(GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetProgramInfoLog_noimpl(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramInfoLog is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix3x4dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix3x4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix3x4fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix3x4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCompressedTexSubImage3D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCompressedTexSubImage3D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawElementsInstancedBaseInstance_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLuint baseinstance) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawElementsInstancedBaseInstance is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindBufferBase_noimpl(GLenum target, GLuint index, GLuint buffer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindBufferBase is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix2dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetTransformFeedbackVarying_noimpl(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetTransformFeedbackVarying is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCompressedTexImage2D_noimpl(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCompressedTexImage2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetUniformIndices_noimpl(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformIndices is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glTexStorage2D_noimpl(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glTexStorage2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4usv_noimpl(GLuint index, const GLushort * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4usv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveUniformBlockiv_noimpl(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveUniformBlockiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCopyImageSubData_noimpl(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCopyImageSubData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI4ui_noimpl(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI4ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4fv_noimpl(GLuint index, const GLfloat * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform1iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindVertexBuffers_noimpl(GLuint first, GLsizei count, const GLuint * buffers, const GLintptr * offsets, const GLsizei * strides) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindVertexBuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProvokingVertex_noimpl(GLenum mode) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProvokingVertex is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3uiv_noimpl(GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsVertexArray_noimpl(GLuint array) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsVertexArray is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glViewportIndexedfv_noimpl(GLuint index, const GLfloat * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glViewportIndexedfv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDispatchCompute_noimpl(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDispatchCompute is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawArrays_noimpl(GLenum mode, GLint first, GLsizei count) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawArrays is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetQueryIndexediv_noimpl(GLenum target, GLuint index, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetQueryIndexediv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3ui_noimpl(GLint location, GLuint v0, GLuint v1, GLuint v2) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMultiDrawElements_noimpl(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMultiDrawElements is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearBufferfi_noimpl(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearBufferfi is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix2dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix2dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribP3ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP3ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribI3iv_noimpl(GLuint index, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribI3iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramParameteri_noimpl(GLuint program, GLenum pname, GLint value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramParameteri is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform4uiv_noimpl(GLint location, GLsizei count, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniformMatrix4fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniformMatrix4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib2fv_noimpl(GLuint index, const GLfloat * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLenum mg_glGetGraphicsResetStatus_noimpl(void) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetGraphicsResetStatus is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLenum)0); -} -void mg_glShaderBinary_noimpl(GLsizei count, const GLuint * shaders, GLenum binaryFormat, const void * binary, GLsizei length) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glShaderBinary is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glShaderStorageBlockBinding_noimpl(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glShaderStorageBlockBinding is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawArraysInstanced_noimpl(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawArraysInstanced is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLuint mg_glGetSubroutineIndex_noimpl(GLuint program, GLenum shadertype, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetSubroutineIndex is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLuint)0); -} -void mg_glGetVertexAttribIiv_noimpl(GLuint index, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetVertexAttribIiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawElementsBaseVertex_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawElementsBaseVertex is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetProgramResourceName_noimpl(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramResourceName is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetInternalformativ_noimpl(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetInternalformativ is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform4fv_noimpl(GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribLPointer_noimpl(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribLPointer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetSamplerParameterIuiv_noimpl(GLuint sampler, GLenum pname, GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetSamplerParameterIuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib3d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib3d is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glSamplerParameterf_noimpl(GLuint sampler, GLenum pname, GLfloat param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSamplerParameterf is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGenFramebuffers_noimpl(GLsizei n, GLuint * framebuffers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGenFramebuffers is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetQueryObjectui64v_noimpl(GLuint id, GLenum pname, GLuint64 * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetQueryObjectui64v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetProgramResourceiv_noimpl(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei count, GLsizei * length, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramResourceiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribP3uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP3uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4dv_noimpl(GLuint index, const GLdouble * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLboolean mg_glIsTransformFeedback_noimpl(GLuint id) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glIsTransformFeedback is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLboolean)0); -} -void mg_glDispatchComputeIndirect_noimpl(GLintptr indirect) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDispatchComputeIndirect is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCompressedTexSubImage2D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCompressedTexSubImage2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindVertexBuffer_noimpl(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindVertexBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform1dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform1dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glStencilOp_noimpl(GLenum fail, GLenum zfail, GLenum zpass) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glStencilOp is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib1s_noimpl(GLuint index, GLshort x) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib1s is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetMultisamplefv_noimpl(GLenum pname, GLuint index, GLfloat * val) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetMultisamplefv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetQueryiv_noimpl(GLenum target, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetQueryiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindProgramPipeline_noimpl(GLuint pipeline) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindProgramPipeline is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFramebufferParameteri_noimpl(GLenum target, GLenum pname, GLint param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFramebufferParameteri is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetIntegeri_v_noimpl(GLenum target, GLuint index, GLint * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetIntegeri_v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetIntegerv_noimpl(GLenum pname, GLint * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetIntegerv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDeleteProgramPipelines_noimpl(GLsizei n, const GLuint * pipelines) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDeleteProgramPipelines is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glClearBufferData_noimpl(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearBufferData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform2fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform2fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLint mg_glGetSubroutineUniformLocation_noimpl(GLuint program, GLenum shadertype, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetSubroutineUniformLocation is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLint)0); -} -void mg_glGetProgramiv_noimpl(GLuint program, GLenum pname, GLint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDepthMask_noimpl(GLboolean flag) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDepthMask is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribIPointer_noimpl(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribIPointer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetActiveUniformName_noimpl(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetActiveUniformName is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribP1uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribP1uiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniformMatrix2x3fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniformMatrix2x3fv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLint mg_glGetUniformLocation_noimpl(GLuint program, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetUniformLocation is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLint)0); -} -void mg_glSampleMaski_noimpl(GLuint maskNumber, GLbitfield mask) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSampleMaski is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetBufferSubData_noimpl(GLenum target, GLintptr offset, GLsizeiptr size, void * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetBufferSubData is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform4iv_noimpl(GLint location, GLsizei count, const GLint * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform4iv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribPointer_noimpl(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribPointer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glFramebufferTexture2D_noimpl(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glFramebufferTexture2D is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetnUniformuiv_noimpl(GLuint program, GLint location, GLsizei bufSize, GLuint * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetnUniformuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetInternalformati64v_noimpl(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 * params) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetInternalformati64v is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glCompileShader_noimpl(GLuint shader) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glCompileShader is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawBuffer_noimpl(GLenum buf) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawBuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3f_noimpl(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3f is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glDrawTransformFeedbackInstanced_noimpl(GLenum mode, GLuint id, GLsizei instancecount) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glDrawTransformFeedbackInstanced is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glProgramUniform4dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glProgramUniform4dv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetProgramStageiv_noimpl(GLuint program, GLenum shadertype, GLenum pname, GLint * values) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramStageiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glStencilFunc_noimpl(GLenum func, GLint ref, GLuint mask) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glStencilFunc is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLuint mg_glGetProgramResourceIndex_noimpl(GLuint program, GLenum programInterface, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramResourceIndex is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLuint)0); -} -void mg_glClearStencil_noimpl(GLint s) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glClearStencil is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glScissorArrayv_noimpl(GLuint first, GLsizei count, const GLint * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glScissorArrayv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glMemoryBarrier_noimpl(GLbitfield barriers) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glMemoryBarrier is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glSamplerParameterIuiv_noimpl(GLuint sampler, GLenum pname, const GLuint * param) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glSamplerParameterIuiv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetFloatv_noimpl(GLenum pname, GLfloat * data) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetFloatv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glBindFragDataLocationIndexed_noimpl(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glBindFragDataLocationIndexed is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glEndQuery_noimpl(GLenum target) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glEndQuery is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttrib4Nubv_noimpl(GLuint index, const GLubyte * v) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttrib4Nubv is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glGetProgramPipelineInfoLog_noimpl(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetProgramPipelineInfoLog is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glVertexAttribDivisor_noimpl(GLuint index, GLuint divisor) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glVertexAttribDivisor is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform3i_noimpl(GLint location, GLint v0, GLint v1, GLint v2) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform3i is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glUniform2ui_noimpl(GLint location, GLuint v0, GLuint v1) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glUniform2ui is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -void mg_glInvalidateSubFramebuffer_noimpl(GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glInvalidateSubFramebuffer is not part of currently selected %s API\n", __mgGLAPI->name); - } -} -GLuint mg_glGetDebugMessageLog_noimpl(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog) -{ - if(__mgGLAPI == &__mgGLNoAPI) - { - log_error("No GL or GLES API is selected. Make sure you call mg_surface_prepare() before calling OpenGL API functions.\n"); - } - else - { - log_error("glGetDebugMessageLog is not part of currently selected %s API\n", __mgGLAPI->name); - } - return((GLuint)0); -} -mg_gl_api __mgGLNoAPI = { - .GetProgramBinary = mg_glGetProgramBinary_noimpl, - .FrontFace = mg_glFrontFace_noimpl, - .Disablei = mg_glDisablei_noimpl, - .BeginConditionalRender = mg_glBeginConditionalRender_noimpl, - .CopyTexSubImage3D = mg_glCopyTexSubImage3D_noimpl, - .CompressedTexSubImage1D = mg_glCompressedTexSubImage1D_noimpl, - .VertexAttribI4usv = mg_glVertexAttribI4usv_noimpl, - .VertexAttrib2sv = mg_glVertexAttrib2sv_noimpl, - .UniformMatrix2x3fv = mg_glUniformMatrix2x3fv_noimpl, - .MultiDrawArraysIndirect = mg_glMultiDrawArraysIndirect_noimpl, - .ColorMaski = mg_glColorMaski_noimpl, - .BindVertexArray = mg_glBindVertexArray_noimpl, - .ProgramUniform3d = mg_glProgramUniform3d_noimpl, - .GetBufferParameteri64v = mg_glGetBufferParameteri64v_noimpl, - .Uniform4i = mg_glUniform4i_noimpl, - .GetAttachedShaders = mg_glGetAttachedShaders_noimpl, - .AttachShader = mg_glAttachShader_noimpl, - .VertexAttribI2ui = mg_glVertexAttribI2ui_noimpl, - .ClearColor = mg_glClearColor_noimpl, - .TexParameterIiv = mg_glTexParameterIiv_noimpl, - .ProgramUniform4d = mg_glProgramUniform4d_noimpl, - .DrawTransformFeedbackStream = mg_glDrawTransformFeedbackStream_noimpl, - .VertexAttribI4iv = mg_glVertexAttribI4iv_noimpl, - .CopyBufferSubData = mg_glCopyBufferSubData_noimpl, - .DebugMessageInsert = mg_glDebugMessageInsert_noimpl, - .ViewportIndexedf = mg_glViewportIndexedf_noimpl, - .ProgramUniform1fv = mg_glProgramUniform1fv_noimpl, - .ObjectPtrLabel = mg_glObjectPtrLabel_noimpl, - .StencilMaskSeparate = mg_glStencilMaskSeparate_noimpl, - .UniformMatrix3x4dv = mg_glUniformMatrix3x4dv_noimpl, - .FramebufferTexture1D = mg_glFramebufferTexture1D_noimpl, - .Viewport = mg_glViewport_noimpl, - .GenTextures = mg_glGenTextures_noimpl, - .UniformBlockBinding = mg_glUniformBlockBinding_noimpl, - .VertexAttrib3sv = mg_glVertexAttrib3sv_noimpl, - .ProgramUniformMatrix3x4fv = mg_glProgramUniformMatrix3x4fv_noimpl, - .VertexAttrib2f = mg_glVertexAttrib2f_noimpl, - .GetActiveUniform = mg_glGetActiveUniform_noimpl, - .ScissorIndexed = mg_glScissorIndexed_noimpl, - .TexParameterf = mg_glTexParameterf_noimpl, - .BindSampler = mg_glBindSampler_noimpl, - .MultiDrawElementsIndirect = mg_glMultiDrawElementsIndirect_noimpl, - .ClearTexSubImage = mg_glClearTexSubImage_noimpl, - .IsEnabledi = mg_glIsEnabledi_noimpl, - .Scissor = mg_glScissor_noimpl, - .ProgramBinary = mg_glProgramBinary_noimpl, - .Disable = mg_glDisable_noimpl, - .GetActiveUniformBlockName = mg_glGetActiveUniformBlockName_noimpl, - .DrawRangeElementsBaseVertex = mg_glDrawRangeElementsBaseVertex_noimpl, - .DebugMessageCallback = mg_glDebugMessageCallback_noimpl, - .BlendEquationi = mg_glBlendEquationi_noimpl, - .VertexAttribI4uiv = mg_glVertexAttribI4uiv_noimpl, - .BlendFunci = mg_glBlendFunci_noimpl, - .ValidateProgramPipeline = mg_glValidateProgramPipeline_noimpl, - .DeleteVertexArrays = mg_glDeleteVertexArrays_noimpl, - .GenRenderbuffers = mg_glGenRenderbuffers_noimpl, - .CheckFramebufferStatus = mg_glCheckFramebufferStatus_noimpl, - .Uniform1ui = mg_glUniform1ui_noimpl, - .ProgramUniform3ui = mg_glProgramUniform3ui_noimpl, - .VertexAttrib4bv = mg_glVertexAttrib4bv_noimpl, - .GetProgramResourceLocationIndex = mg_glGetProgramResourceLocationIndex_noimpl, - .ProgramUniform3fv = mg_glProgramUniform3fv_noimpl, - .PolygonOffset = mg_glPolygonOffset_noimpl, - .IsProgram = mg_glIsProgram_noimpl, - .ClearDepthf = mg_glClearDepthf_noimpl, - .EndConditionalRender = mg_glEndConditionalRender_noimpl, - .GetObjectLabel = mg_glGetObjectLabel_noimpl, - .ProgramUniformMatrix4x2fv = mg_glProgramUniformMatrix4x2fv_noimpl, - .VertexAttribI3i = mg_glVertexAttribI3i_noimpl, - .GenSamplers = mg_glGenSamplers_noimpl, - .VertexAttribI2uiv = mg_glVertexAttribI2uiv_noimpl, - .StencilOpSeparate = mg_glStencilOpSeparate_noimpl, - .GetProgramInterfaceiv = mg_glGetProgramInterfaceiv_noimpl, - .GetObjectPtrLabel = mg_glGetObjectPtrLabel_noimpl, - .UniformMatrix2fv = mg_glUniformMatrix2fv_noimpl, - .GetInteger64v = mg_glGetInteger64v_noimpl, - .GetString = mg_glGetString_noimpl, - .IsSync = mg_glIsSync_noimpl, - .CopyTexImage1D = mg_glCopyTexImage1D_noimpl, - .SamplerParameterIiv = mg_glSamplerParameterIiv_noimpl, - .VertexAttrib3fv = mg_glVertexAttrib3fv_noimpl, - .BeginQuery = mg_glBeginQuery_noimpl, - .GetBufferPointerv = mg_glGetBufferPointerv_noimpl, - .BlitFramebuffer = mg_glBlitFramebuffer_noimpl, - .GetSamplerParameteriv = mg_glGetSamplerParameteriv_noimpl, - .PointParameteri = mg_glPointParameteri_noimpl, - .PolygonMode = mg_glPolygonMode_noimpl, - .DrawElementsIndirect = mg_glDrawElementsIndirect_noimpl, - .TexImage2DMultisample = mg_glTexImage2DMultisample_noimpl, - .VertexAttribL3d = mg_glVertexAttribL3d_noimpl, - .ProgramUniform4i = mg_glProgramUniform4i_noimpl, - .GetUniformfv = mg_glGetUniformfv_noimpl, - .DebugMessageControl = mg_glDebugMessageControl_noimpl, - .TexParameteriv = mg_glTexParameteriv_noimpl, - .IsBuffer = mg_glIsBuffer_noimpl, - .ProgramUniformMatrix3dv = mg_glProgramUniformMatrix3dv_noimpl, - .BindFramebuffer = mg_glBindFramebuffer_noimpl, - .BufferStorage = mg_glBufferStorage_noimpl, - .ProgramUniform4fv = mg_glProgramUniform4fv_noimpl, - .BindTextures = mg_glBindTextures_noimpl, - .CompressedTexImage3D = mg_glCompressedTexImage3D_noimpl, - .ProgramUniformMatrix4x2dv = mg_glProgramUniformMatrix4x2dv_noimpl, - .PushDebugGroup = mg_glPushDebugGroup_noimpl, - .SamplerParameteriv = mg_glSamplerParameteriv_noimpl, - .VertexAttribI2i = mg_glVertexAttribI2i_noimpl, - .BindTransformFeedback = mg_glBindTransformFeedback_noimpl, - .GetRenderbufferParameteriv = mg_glGetRenderbufferParameteriv_noimpl, - .Uniform2fv = mg_glUniform2fv_noimpl, - .VertexAttrib1dv = mg_glVertexAttrib1dv_noimpl, - .SamplerParameteri = mg_glSamplerParameteri_noimpl, - .TexBufferRange = mg_glTexBufferRange_noimpl, - .GetShaderiv = mg_glGetShaderiv_noimpl, - .StencilMask = mg_glStencilMask_noimpl, - .VertexAttrib3f = mg_glVertexAttrib3f_noimpl, - .GetProgramPipelineiv = mg_glGetProgramPipelineiv_noimpl, - .DeleteQueries = mg_glDeleteQueries_noimpl, - .ProgramUniform3uiv = mg_glProgramUniform3uiv_noimpl, - .ProgramUniformMatrix2x4fv = mg_glProgramUniformMatrix2x4fv_noimpl, - .Uniform1f = mg_glUniform1f_noimpl, - .TexSubImage1D = mg_glTexSubImage1D_noimpl, - .ClearBufferiv = mg_glClearBufferiv_noimpl, - .ProgramUniform4uiv = mg_glProgramUniform4uiv_noimpl, - .InvalidateTexImage = mg_glInvalidateTexImage_noimpl, - .ClearBufferSubData = mg_glClearBufferSubData_noimpl, - .ClearTexImage = mg_glClearTexImage_noimpl, - .VertexAttrib4d = mg_glVertexAttrib4d_noimpl, - .RenderbufferStorageMultisample = mg_glRenderbufferStorageMultisample_noimpl, - .FramebufferTextureLayer = mg_glFramebufferTextureLayer_noimpl, - .Uniform2f = mg_glUniform2f_noimpl, - .VertexAttribL4d = mg_glVertexAttribL4d_noimpl, - .TexImage2D = mg_glTexImage2D_noimpl, - .LogicOp = mg_glLogicOp_noimpl, - .BindTexture = mg_glBindTexture_noimpl, - .VertexAttrib1fv = mg_glVertexAttrib1fv_noimpl, - .ProgramUniformMatrix3fv = mg_glProgramUniformMatrix3fv_noimpl, - .GetFragDataIndex = mg_glGetFragDataIndex_noimpl, - .UniformMatrix2x3dv = mg_glUniformMatrix2x3dv_noimpl, - .GetVertexAttribLdv = mg_glGetVertexAttribLdv_noimpl, - .BindRenderbuffer = mg_glBindRenderbuffer_noimpl, - .Uniform1d = mg_glUniform1d_noimpl, - .UniformMatrix2x4fv = mg_glUniformMatrix2x4fv_noimpl, - .MinSampleShading = mg_glMinSampleShading_noimpl, - .CopyTexSubImage1D = mg_glCopyTexSubImage1D_noimpl, - .TexImage1D = mg_glTexImage1D_noimpl, - .VertexAttrib1f = mg_glVertexAttrib1f_noimpl, - .LineWidth = mg_glLineWidth_noimpl, - .PointParameterf = mg_glPointParameterf_noimpl, - .DrawElementsInstancedBaseVertexBaseInstance = mg_glDrawElementsInstancedBaseVertexBaseInstance_noimpl, - .GetActiveSubroutineUniformiv = mg_glGetActiveSubroutineUniformiv_noimpl, - .Uniform4ui = mg_glUniform4ui_noimpl, - .VertexAttribBinding = mg_glVertexAttribBinding_noimpl, - .GetTexParameteriv = mg_glGetTexParameteriv_noimpl, - .RenderbufferStorage = mg_glRenderbufferStorage_noimpl, - .VertexAttrib4iv = mg_glVertexAttrib4iv_noimpl, - .UniformMatrix3fv = mg_glUniformMatrix3fv_noimpl, - .GetBooleanv = mg_glGetBooleanv_noimpl, - .ProgramUniformMatrix2x3dv = mg_glProgramUniformMatrix2x3dv_noimpl, - .ProgramUniformMatrix4dv = mg_glProgramUniformMatrix4dv_noimpl, - .Uniform2iv = mg_glUniform2iv_noimpl, - .BufferData = mg_glBufferData_noimpl, - .GetActiveSubroutineUniformName = mg_glGetActiveSubroutineUniformName_noimpl, - .GetStringi = mg_glGetStringi_noimpl, - .BindImageTexture = mg_glBindImageTexture_noimpl, - .ProgramUniformMatrix3x2dv = mg_glProgramUniformMatrix3x2dv_noimpl, - .VertexAttribL4dv = mg_glVertexAttribL4dv_noimpl, - .TexStorage3DMultisample = mg_glTexStorage3DMultisample_noimpl, - .DepthRangeArrayv = mg_glDepthRangeArrayv_noimpl, - .GetUniformiv = mg_glGetUniformiv_noimpl, - .DeleteTextures = mg_glDeleteTextures_noimpl, - .CreateShader = mg_glCreateShader_noimpl, - .VertexAttrib4s = mg_glVertexAttrib4s_noimpl, - .PrimitiveBoundingBox = mg_glPrimitiveBoundingBox_noimpl, - .DrawBuffers = mg_glDrawBuffers_noimpl, - .VertexAttrib2dv = mg_glVertexAttrib2dv_noimpl, - .TexParameterIuiv = mg_glTexParameterIuiv_noimpl, - .QueryCounter = mg_glQueryCounter_noimpl, - .VertexAttribL1dv = mg_glVertexAttribL1dv_noimpl, - .ProgramUniform1d = mg_glProgramUniform1d_noimpl, - .DeleteRenderbuffers = mg_glDeleteRenderbuffers_noimpl, - .PopDebugGroup = mg_glPopDebugGroup_noimpl, - .MultiDrawArrays = mg_glMultiDrawArrays_noimpl, - .GetActiveUniformsiv = mg_glGetActiveUniformsiv_noimpl, - .Flush = mg_glFlush_noimpl, - .UnmapBuffer = mg_glUnmapBuffer_noimpl, - .FramebufferTexture3D = mg_glFramebufferTexture3D_noimpl, - .Uniform1fv = mg_glUniform1fv_noimpl, - .IsFramebuffer = mg_glIsFramebuffer_noimpl, - .ValidateProgram = mg_glValidateProgram_noimpl, - .GetVertexAttribPointerv = mg_glGetVertexAttribPointerv_noimpl, - .ReadnPixels = mg_glReadnPixels_noimpl, - .VertexAttribP2ui = mg_glVertexAttribP2ui_noimpl, - .ProgramUniform2i = mg_glProgramUniform2i_noimpl, - .PatchParameteri = mg_glPatchParameteri_noimpl, - .VertexAttrib4Nub = mg_glVertexAttrib4Nub_noimpl, - .GenQueries = mg_glGenQueries_noimpl, - .ProgramUniform2ui = mg_glProgramUniform2ui_noimpl, - .BindSamplers = mg_glBindSamplers_noimpl, - .DisableVertexAttribArray = mg_glDisableVertexAttribArray_noimpl, - .Enablei = mg_glEnablei_noimpl, - .GetSynciv = mg_glGetSynciv_noimpl, - .VertexAttrib3s = mg_glVertexAttrib3s_noimpl, - .GetTexParameterIiv = mg_glGetTexParameterIiv_noimpl, - .VertexBindingDivisor = mg_glVertexBindingDivisor_noimpl, - .DepthRangef = mg_glDepthRangef_noimpl, - .VertexAttrib4Nuiv = mg_glVertexAttrib4Nuiv_noimpl, - .Finish = mg_glFinish_noimpl, - .BlendFunc = mg_glBlendFunc_noimpl, - .DrawTransformFeedbackStreamInstanced = mg_glDrawTransformFeedbackStreamInstanced_noimpl, - .UniformMatrix4x3fv = mg_glUniformMatrix4x3fv_noimpl, - .UniformMatrix4x2dv = mg_glUniformMatrix4x2dv_noimpl, - .Uniform2d = mg_glUniform2d_noimpl, - .GetnUniformfv = mg_glGetnUniformfv_noimpl, - .GetFloati_v = mg_glGetFloati_v_noimpl, - .GetInteger64i_v = mg_glGetInteger64i_v_noimpl, - .ProgramUniform3f = mg_glProgramUniform3f_noimpl, - .GetFramebufferParameteriv = mg_glGetFramebufferParameteriv_noimpl, - .VertexAttribI4bv = mg_glVertexAttribI4bv_noimpl, - .DeleteProgram = mg_glDeleteProgram_noimpl, - .CopyTexImage2D = mg_glCopyTexImage2D_noimpl, - .GetUniformuiv = mg_glGetUniformuiv_noimpl, - .DrawArraysIndirect = mg_glDrawArraysIndirect_noimpl, - .UniformMatrix4x2fv = mg_glUniformMatrix4x2fv_noimpl, - .FramebufferRenderbuffer = mg_glFramebufferRenderbuffer_noimpl, - .Uniform2i = mg_glUniform2i_noimpl, - .ProgramUniform3dv = mg_glProgramUniform3dv_noimpl, - .ScissorIndexedv = mg_glScissorIndexedv_noimpl, - .ProgramUniform2d = mg_glProgramUniform2d_noimpl, - .VertexAttrib4f = mg_glVertexAttrib4f_noimpl, - .BlendEquationSeparatei = mg_glBlendEquationSeparatei_noimpl, - .GetUniformdv = mg_glGetUniformdv_noimpl, - .DrawRangeElements = mg_glDrawRangeElements_noimpl, - .UniformMatrix3dv = mg_glUniformMatrix3dv_noimpl, - .ProgramUniform2uiv = mg_glProgramUniform2uiv_noimpl, - .VertexAttribI1uiv = mg_glVertexAttribI1uiv_noimpl, - .BeginQueryIndexed = mg_glBeginQueryIndexed_noimpl, - .PointParameterfv = mg_glPointParameterfv_noimpl, - .SampleCoverage = mg_glSampleCoverage_noimpl, - .ResumeTransformFeedback = mg_glResumeTransformFeedback_noimpl, - .ReadPixels = mg_glReadPixels_noimpl, - .LinkProgram = mg_glLinkProgram_noimpl, - .WaitSync = mg_glWaitSync_noimpl, - .ActiveShaderProgram = mg_glActiveShaderProgram_noimpl, - .GetQueryObjectiv = mg_glGetQueryObjectiv_noimpl, - .ProgramUniform3i = mg_glProgramUniform3i_noimpl, - .ProgramUniform1ui = mg_glProgramUniform1ui_noimpl, - .BlendBarrier = mg_glBlendBarrier_noimpl, - .VertexAttribI4ubv = mg_glVertexAttribI4ubv_noimpl, - .GetQueryObjecti64v = mg_glGetQueryObjecti64v_noimpl, - .UniformMatrix4dv = mg_glUniformMatrix4dv_noimpl, - .Uniform1iv = mg_glUniform1iv_noimpl, - .Enable = mg_glEnable_noimpl, - .GenBuffers = mg_glGenBuffers_noimpl, - .TexStorage3D = mg_glTexStorage3D_noimpl, - .InvalidateTexSubImage = mg_glInvalidateTexSubImage_noimpl, - .ProgramUniform1i = mg_glProgramUniform1i_noimpl, - .BlendEquation = mg_glBlendEquation_noimpl, - .DepthRange = mg_glDepthRange_noimpl, - .Uniform2dv = mg_glUniform2dv_noimpl, - .BlendFuncSeparate = mg_glBlendFuncSeparate_noimpl, - .Uniform1dv = mg_glUniform1dv_noimpl, - .EndQueryIndexed = mg_glEndQueryIndexed_noimpl, - .DeleteTransformFeedbacks = mg_glDeleteTransformFeedbacks_noimpl, - .BlendFuncSeparatei = mg_glBlendFuncSeparatei_noimpl, - .DepthFunc = mg_glDepthFunc_noimpl, - .InvalidateBufferData = mg_glInvalidateBufferData_noimpl, - .BindImageTextures = mg_glBindImageTextures_noimpl, - .DeleteFramebuffers = mg_glDeleteFramebuffers_noimpl, - .VertexAttribI2iv = mg_glVertexAttribI2iv_noimpl, - .VertexAttrib4sv = mg_glVertexAttrib4sv_noimpl, - .VertexAttribFormat = mg_glVertexAttribFormat_noimpl, - .MapBufferRange = mg_glMapBufferRange_noimpl, - .DetachShader = mg_glDetachShader_noimpl, - .GetBooleani_v = mg_glGetBooleani_v_noimpl, - .DepthRangeIndexed = mg_glDepthRangeIndexed_noimpl, - .PauseTransformFeedback = mg_glPauseTransformFeedback_noimpl, - .VertexAttribL3dv = mg_glVertexAttribL3dv_noimpl, - .PrimitiveRestartIndex = mg_glPrimitiveRestartIndex_noimpl, - .Uniform4d = mg_glUniform4d_noimpl, - .TransformFeedbackVaryings = mg_glTransformFeedbackVaryings_noimpl, - .DeleteBuffers = mg_glDeleteBuffers_noimpl, - .GetProgramResourceLocation = mg_glGetProgramResourceLocation_noimpl, - .Uniform4f = mg_glUniform4f_noimpl, - .GetSamplerParameterfv = mg_glGetSamplerParameterfv_noimpl, - .VertexAttribP4ui = mg_glVertexAttribP4ui_noimpl, - .IsRenderbuffer = mg_glIsRenderbuffer_noimpl, - .VertexAttrib4Nbv = mg_glVertexAttrib4Nbv_noimpl, - .VertexAttrib4Nsv = mg_glVertexAttrib4Nsv_noimpl, - .CullFace = mg_glCullFace_noimpl, - .MultiDrawElementsBaseVertex = mg_glMultiDrawElementsBaseVertex_noimpl, - .VertexAttribI3ui = mg_glVertexAttribI3ui_noimpl, - .GetUniformBlockIndex = mg_glGetUniformBlockIndex_noimpl, - .UseProgramStages = mg_glUseProgramStages_noimpl, - .GetActiveAttrib = mg_glGetActiveAttrib_noimpl, - .DrawArraysInstancedBaseInstance = mg_glDrawArraysInstancedBaseInstance_noimpl, - .IsProgramPipeline = mg_glIsProgramPipeline_noimpl, - .ProgramUniform1uiv = mg_glProgramUniform1uiv_noimpl, - .ProgramUniform3iv = mg_glProgramUniform3iv_noimpl, - .ReadBuffer = mg_glReadBuffer_noimpl, - .DeleteShader = mg_glDeleteShader_noimpl, - .CreateShaderProgramv = mg_glCreateShaderProgramv_noimpl, - .ClientWaitSync = mg_glClientWaitSync_noimpl, - .CompressedTexImage1D = mg_glCompressedTexImage1D_noimpl, - .VertexAttrib2d = mg_glVertexAttrib2d_noimpl, - .VertexAttrib3dv = mg_glVertexAttrib3dv_noimpl, - .VertexAttribI4i = mg_glVertexAttribI4i_noimpl, - .VertexAttribL2dv = mg_glVertexAttribL2dv_noimpl, - .GetDoublei_v = mg_glGetDoublei_v_noimpl, - .TexParameterfv = mg_glTexParameterfv_noimpl, - .GetAttribLocation = mg_glGetAttribLocation_noimpl, - .VertexAttribP1ui = mg_glVertexAttribP1ui_noimpl, - .VertexAttribIFormat = mg_glVertexAttribIFormat_noimpl, - .VertexAttribI1ui = mg_glVertexAttribI1ui_noimpl, - .GetVertexAttribiv = mg_glGetVertexAttribiv_noimpl, - .GetActiveSubroutineName = mg_glGetActiveSubroutineName_noimpl, - .IsQuery = mg_glIsQuery_noimpl, - .VertexAttrib1sv = mg_glVertexAttrib1sv_noimpl, - .ProgramUniformMatrix2fv = mg_glProgramUniformMatrix2fv_noimpl, - .UseProgram = mg_glUseProgram_noimpl, - .Clear = mg_glClear_noimpl, - .VertexAttrib4ubv = mg_glVertexAttrib4ubv_noimpl, - .InvalidateFramebuffer = mg_glInvalidateFramebuffer_noimpl, - .PixelStorei = mg_glPixelStorei_noimpl, - .Uniform1i = mg_glUniform1i_noimpl, - .Uniform1uiv = mg_glUniform1uiv_noimpl, - .TexImage3DMultisample = mg_glTexImage3DMultisample_noimpl, - .BindBuffer = mg_glBindBuffer_noimpl, - .ActiveTexture = mg_glActiveTexture_noimpl, - .DeleteSync = mg_glDeleteSync_noimpl, - .VertexAttrib4Niv = mg_glVertexAttrib4Niv_noimpl, - .VertexAttrib4uiv = mg_glVertexAttrib4uiv_noimpl, - .Uniform3fv = mg_glUniform3fv_noimpl, - .GenVertexArrays = mg_glGenVertexArrays_noimpl, - .ProgramUniformMatrix3x2fv = mg_glProgramUniformMatrix3x2fv_noimpl, - .BindAttribLocation = mg_glBindAttribLocation_noimpl, - .CopyTexSubImage2D = mg_glCopyTexSubImage2D_noimpl, - .BlendColor = mg_glBlendColor_noimpl, - .ReleaseShaderCompiler = mg_glReleaseShaderCompiler_noimpl, - .GenTransformFeedbacks = mg_glGenTransformFeedbacks_noimpl, - .IsShader = mg_glIsShader_noimpl, - .DrawElementsInstancedBaseVertex = mg_glDrawElementsInstancedBaseVertex_noimpl, - .VertexAttribLFormat = mg_glVertexAttribLFormat_noimpl, - .BindBuffersRange = mg_glBindBuffersRange_noimpl, - .ColorMask = mg_glColorMask_noimpl, - .UniformMatrix2x4dv = mg_glUniformMatrix2x4dv_noimpl, - .GetDoublev = mg_glGetDoublev_noimpl, - .UniformMatrix3x2dv = mg_glUniformMatrix3x2dv_noimpl, - .VertexAttribL2d = mg_glVertexAttribL2d_noimpl, - .FlushMappedBufferRange = mg_glFlushMappedBufferRange_noimpl, - .ProgramUniform2iv = mg_glProgramUniform2iv_noimpl, - .PointParameteriv = mg_glPointParameteriv_noimpl, - .UniformSubroutinesuiv = mg_glUniformSubroutinesuiv_noimpl, - .ProgramUniformMatrix4x3fv = mg_glProgramUniformMatrix4x3fv_noimpl, - .GetBufferParameteriv = mg_glGetBufferParameteriv_noimpl, - .GetTexImage = mg_glGetTexImage_noimpl, - .ProgramUniformMatrix2x4dv = mg_glProgramUniformMatrix2x4dv_noimpl, - .VertexAttribI1iv = mg_glVertexAttribI1iv_noimpl, - .IsSampler = mg_glIsSampler_noimpl, - .GetVertexAttribfv = mg_glGetVertexAttribfv_noimpl, - .TexStorage1D = mg_glTexStorage1D_noimpl, - .ViewportArrayv = mg_glViewportArrayv_noimpl, - .TexImage3D = mg_glTexImage3D_noimpl, - .ProgramUniformMatrix4fv = mg_glProgramUniformMatrix4fv_noimpl, - .GetTexLevelParameteriv = mg_glGetTexLevelParameteriv_noimpl, - .GetVertexAttribdv = mg_glGetVertexAttribdv_noimpl, - .InvalidateBufferSubData = mg_glInvalidateBufferSubData_noimpl, - .ProgramUniform4f = mg_glProgramUniform4f_noimpl, - .VertexAttrib2s = mg_glVertexAttrib2s_noimpl, - .TexSubImage3D = mg_glTexSubImage3D_noimpl, - .GetFragDataLocation = mg_glGetFragDataLocation_noimpl, - .VertexAttribI1i = mg_glVertexAttribI1i_noimpl, - .GetActiveAtomicCounterBufferiv = mg_glGetActiveAtomicCounterBufferiv_noimpl, - .TexStorage2DMultisample = mg_glTexStorage2DMultisample_noimpl, - .BindBuffersBase = mg_glBindBuffersBase_noimpl, - .GetUniformSubroutineuiv = mg_glGetUniformSubroutineuiv_noimpl, - .EndTransformFeedback = mg_glEndTransformFeedback_noimpl, - .ShaderSource = mg_glShaderSource_noimpl, - .GetQueryObjectuiv = mg_glGetQueryObjectuiv_noimpl, - .GetTexLevelParameterfv = mg_glGetTexLevelParameterfv_noimpl, - .Uniform3d = mg_glUniform3d_noimpl, - .ClearBufferfv = mg_glClearBufferfv_noimpl, - .GetSamplerParameterIiv = mg_glGetSamplerParameterIiv_noimpl, - .MemoryBarrierByRegion = mg_glMemoryBarrierByRegion_noimpl, - .GenProgramPipelines = mg_glGenProgramPipelines_noimpl, - .BindFragDataLocation = mg_glBindFragDataLocation_noimpl, - .GetShaderInfoLog = mg_glGetShaderInfoLog_noimpl, - .TextureView = mg_glTextureView_noimpl, - .IsEnabled = mg_glIsEnabled_noimpl, - .PatchParameterfv = mg_glPatchParameterfv_noimpl, - .Hint = mg_glHint_noimpl, - .PixelStoref = mg_glPixelStoref_noimpl, - .ProgramUniform4iv = mg_glProgramUniform4iv_noimpl, - .BlendEquationSeparate = mg_glBlendEquationSeparate_noimpl, - .ClearBufferuiv = mg_glClearBufferuiv_noimpl, - .ObjectLabel = mg_glObjectLabel_noimpl, - .GetPointerv = mg_glGetPointerv_noimpl, - .DeleteSamplers = mg_glDeleteSamplers_noimpl, - .ProgramUniform2dv = mg_glProgramUniform2dv_noimpl, - .EnableVertexAttribArray = mg_glEnableVertexAttribArray_noimpl, - .ClampColor = mg_glClampColor_noimpl, - .GetShaderPrecisionFormat = mg_glGetShaderPrecisionFormat_noimpl, - .GetnUniformiv = mg_glGetnUniformiv_noimpl, - .Uniform3iv = mg_glUniform3iv_noimpl, - .VertexAttribI3uiv = mg_glVertexAttribI3uiv_noimpl, - .BufferSubData = mg_glBufferSubData_noimpl, - .SamplerParameterfv = mg_glSamplerParameterfv_noimpl, - .VertexAttribI4sv = mg_glVertexAttribI4sv_noimpl, - .TexBuffer = mg_glTexBuffer_noimpl, - .CreateProgram = mg_glCreateProgram_noimpl, - .BindBufferRange = mg_glBindBufferRange_noimpl, - .IsTexture = mg_glIsTexture_noimpl, - .UniformMatrix3x2fv = mg_glUniformMatrix3x2fv_noimpl, - .DrawElements = mg_glDrawElements_noimpl, - .ProgramUniform1f = mg_glProgramUniform1f_noimpl, - .Uniform3dv = mg_glUniform3dv_noimpl, - .DrawElementsInstanced = mg_glDrawElementsInstanced_noimpl, - .GenerateMipmap = mg_glGenerateMipmap_noimpl, - .ProgramUniform4ui = mg_glProgramUniform4ui_noimpl, - .GetVertexAttribIuiv = mg_glGetVertexAttribIuiv_noimpl, - .ClearDepth = mg_glClearDepth_noimpl, - .DrawTransformFeedback = mg_glDrawTransformFeedback_noimpl, - .TexSubImage2D = mg_glTexSubImage2D_noimpl, - .VertexAttribP4uiv = mg_glVertexAttribP4uiv_noimpl, - .GetTexParameterIuiv = mg_glGetTexParameterIuiv_noimpl, - .PointSize = mg_glPointSize_noimpl, - .GetCompressedTexImage = mg_glGetCompressedTexImage_noimpl, - .Uniform2uiv = mg_glUniform2uiv_noimpl, - .FenceSync = mg_glFenceSync_noimpl, - .MapBuffer = mg_glMapBuffer_noimpl, - .GetFramebufferAttachmentParameteriv = mg_glGetFramebufferAttachmentParameteriv_noimpl, - .BeginTransformFeedback = mg_glBeginTransformFeedback_noimpl, - .TexParameteri = mg_glTexParameteri_noimpl, - .GetTexParameterfv = mg_glGetTexParameterfv_noimpl, - .VertexAttribL1d = mg_glVertexAttribL1d_noimpl, - .VertexAttrib4Nusv = mg_glVertexAttrib4Nusv_noimpl, - .ProgramUniform2f = mg_glProgramUniform2f_noimpl, - .VertexAttrib1d = mg_glVertexAttrib1d_noimpl, - .GetError = mg_glGetError_noimpl, - .VertexAttribP2uiv = mg_glVertexAttribP2uiv_noimpl, - .UniformMatrix4x3dv = mg_glUniformMatrix4x3dv_noimpl, - .GetShaderSource = mg_glGetShaderSource_noimpl, - .StencilFuncSeparate = mg_glStencilFuncSeparate_noimpl, - .FramebufferTexture = mg_glFramebufferTexture_noimpl, - .ProgramUniformMatrix4x3dv = mg_glProgramUniformMatrix4x3dv_noimpl, - .Uniform4dv = mg_glUniform4dv_noimpl, - .GetProgramInfoLog = mg_glGetProgramInfoLog_noimpl, - .ProgramUniformMatrix3x4dv = mg_glProgramUniformMatrix3x4dv_noimpl, - .UniformMatrix3x4fv = mg_glUniformMatrix3x4fv_noimpl, - .CompressedTexSubImage3D = mg_glCompressedTexSubImage3D_noimpl, - .DrawElementsInstancedBaseInstance = mg_glDrawElementsInstancedBaseInstance_noimpl, - .BindBufferBase = mg_glBindBufferBase_noimpl, - .UniformMatrix2dv = mg_glUniformMatrix2dv_noimpl, - .GetTransformFeedbackVarying = mg_glGetTransformFeedbackVarying_noimpl, - .CompressedTexImage2D = mg_glCompressedTexImage2D_noimpl, - .GetUniformIndices = mg_glGetUniformIndices_noimpl, - .TexStorage2D = mg_glTexStorage2D_noimpl, - .VertexAttrib4usv = mg_glVertexAttrib4usv_noimpl, - .GetActiveUniformBlockiv = mg_glGetActiveUniformBlockiv_noimpl, - .CopyImageSubData = mg_glCopyImageSubData_noimpl, - .VertexAttribI4ui = mg_glVertexAttribI4ui_noimpl, - .VertexAttrib4fv = mg_glVertexAttrib4fv_noimpl, - .ProgramUniform1iv = mg_glProgramUniform1iv_noimpl, - .BindVertexBuffers = mg_glBindVertexBuffers_noimpl, - .ProvokingVertex = mg_glProvokingVertex_noimpl, - .Uniform3uiv = mg_glUniform3uiv_noimpl, - .IsVertexArray = mg_glIsVertexArray_noimpl, - .ViewportIndexedfv = mg_glViewportIndexedfv_noimpl, - .DispatchCompute = mg_glDispatchCompute_noimpl, - .DrawArrays = mg_glDrawArrays_noimpl, - .GetQueryIndexediv = mg_glGetQueryIndexediv_noimpl, - .Uniform3ui = mg_glUniform3ui_noimpl, - .MultiDrawElements = mg_glMultiDrawElements_noimpl, - .ClearBufferfi = mg_glClearBufferfi_noimpl, - .ProgramUniformMatrix2dv = mg_glProgramUniformMatrix2dv_noimpl, - .VertexAttribP3ui = mg_glVertexAttribP3ui_noimpl, - .VertexAttribI3iv = mg_glVertexAttribI3iv_noimpl, - .ProgramParameteri = mg_glProgramParameteri_noimpl, - .Uniform4uiv = mg_glUniform4uiv_noimpl, - .UniformMatrix4fv = mg_glUniformMatrix4fv_noimpl, - .VertexAttrib2fv = mg_glVertexAttrib2fv_noimpl, - .GetGraphicsResetStatus = mg_glGetGraphicsResetStatus_noimpl, - .ShaderBinary = mg_glShaderBinary_noimpl, - .ShaderStorageBlockBinding = mg_glShaderStorageBlockBinding_noimpl, - .DrawArraysInstanced = mg_glDrawArraysInstanced_noimpl, - .GetSubroutineIndex = mg_glGetSubroutineIndex_noimpl, - .GetVertexAttribIiv = mg_glGetVertexAttribIiv_noimpl, - .DrawElementsBaseVertex = mg_glDrawElementsBaseVertex_noimpl, - .GetProgramResourceName = mg_glGetProgramResourceName_noimpl, - .GetInternalformativ = mg_glGetInternalformativ_noimpl, - .Uniform4fv = mg_glUniform4fv_noimpl, - .VertexAttribLPointer = mg_glVertexAttribLPointer_noimpl, - .GetSamplerParameterIuiv = mg_glGetSamplerParameterIuiv_noimpl, - .VertexAttrib3d = mg_glVertexAttrib3d_noimpl, - .SamplerParameterf = mg_glSamplerParameterf_noimpl, - .GenFramebuffers = mg_glGenFramebuffers_noimpl, - .GetQueryObjectui64v = mg_glGetQueryObjectui64v_noimpl, - .GetProgramResourceiv = mg_glGetProgramResourceiv_noimpl, - .VertexAttribP3uiv = mg_glVertexAttribP3uiv_noimpl, - .VertexAttrib4dv = mg_glVertexAttrib4dv_noimpl, - .IsTransformFeedback = mg_glIsTransformFeedback_noimpl, - .DispatchComputeIndirect = mg_glDispatchComputeIndirect_noimpl, - .CompressedTexSubImage2D = mg_glCompressedTexSubImage2D_noimpl, - .BindVertexBuffer = mg_glBindVertexBuffer_noimpl, - .ProgramUniform1dv = mg_glProgramUniform1dv_noimpl, - .StencilOp = mg_glStencilOp_noimpl, - .VertexAttrib1s = mg_glVertexAttrib1s_noimpl, - .GetMultisamplefv = mg_glGetMultisamplefv_noimpl, - .GetQueryiv = mg_glGetQueryiv_noimpl, - .BindProgramPipeline = mg_glBindProgramPipeline_noimpl, - .FramebufferParameteri = mg_glFramebufferParameteri_noimpl, - .GetIntegeri_v = mg_glGetIntegeri_v_noimpl, - .GetIntegerv = mg_glGetIntegerv_noimpl, - .DeleteProgramPipelines = mg_glDeleteProgramPipelines_noimpl, - .ClearBufferData = mg_glClearBufferData_noimpl, - .ProgramUniform2fv = mg_glProgramUniform2fv_noimpl, - .GetSubroutineUniformLocation = mg_glGetSubroutineUniformLocation_noimpl, - .GetProgramiv = mg_glGetProgramiv_noimpl, - .DepthMask = mg_glDepthMask_noimpl, - .VertexAttribIPointer = mg_glVertexAttribIPointer_noimpl, - .GetActiveUniformName = mg_glGetActiveUniformName_noimpl, - .VertexAttribP1uiv = mg_glVertexAttribP1uiv_noimpl, - .ProgramUniformMatrix2x3fv = mg_glProgramUniformMatrix2x3fv_noimpl, - .GetUniformLocation = mg_glGetUniformLocation_noimpl, - .SampleMaski = mg_glSampleMaski_noimpl, - .GetBufferSubData = mg_glGetBufferSubData_noimpl, - .Uniform4iv = mg_glUniform4iv_noimpl, - .VertexAttribPointer = mg_glVertexAttribPointer_noimpl, - .FramebufferTexture2D = mg_glFramebufferTexture2D_noimpl, - .GetnUniformuiv = mg_glGetnUniformuiv_noimpl, - .GetInternalformati64v = mg_glGetInternalformati64v_noimpl, - .CompileShader = mg_glCompileShader_noimpl, - .DrawBuffer = mg_glDrawBuffer_noimpl, - .Uniform3f = mg_glUniform3f_noimpl, - .DrawTransformFeedbackInstanced = mg_glDrawTransformFeedbackInstanced_noimpl, - .ProgramUniform4dv = mg_glProgramUniform4dv_noimpl, - .GetProgramStageiv = mg_glGetProgramStageiv_noimpl, - .StencilFunc = mg_glStencilFunc_noimpl, - .GetProgramResourceIndex = mg_glGetProgramResourceIndex_noimpl, - .ClearStencil = mg_glClearStencil_noimpl, - .ScissorArrayv = mg_glScissorArrayv_noimpl, - .MemoryBarrier = mg_glMemoryBarrier_noimpl, - .SamplerParameterIuiv = mg_glSamplerParameterIuiv_noimpl, - .GetFloatv = mg_glGetFloatv_noimpl, - .BindFragDataLocationIndexed = mg_glBindFragDataLocationIndexed_noimpl, - .EndQuery = mg_glEndQuery_noimpl, - .VertexAttrib4Nubv = mg_glVertexAttrib4Nubv_noimpl, - .GetProgramPipelineInfoLog = mg_glGetProgramPipelineInfoLog_noimpl, - .VertexAttribDivisor = mg_glVertexAttribDivisor_noimpl, - .Uniform3i = mg_glUniform3i_noimpl, - .Uniform2ui = mg_glUniform2ui_noimpl, - .InvalidateSubFramebuffer = mg_glInvalidateSubFramebuffer_noimpl, - .GetDebugMessageLog = mg_glGetDebugMessageLog_noimpl, -}; - -void mg_gl_load_gl41(mg_gl_api* api, mg_gl_load_proc loadProc) -{ - api->name = "gl41"; - api->GetProgramBinary = loadProc("glGetProgramBinary"); - api->FrontFace = loadProc("glFrontFace"); - api->Disablei = loadProc("glDisablei"); - api->BeginConditionalRender = loadProc("glBeginConditionalRender"); - api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); - api->CompressedTexSubImage1D = loadProc("glCompressedTexSubImage1D"); - api->VertexAttribI4usv = loadProc("glVertexAttribI4usv"); - api->VertexAttrib2sv = loadProc("glVertexAttrib2sv"); - api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); - api->MultiDrawArraysIndirect = mg_glMultiDrawArraysIndirect_noimpl; - api->ColorMaski = loadProc("glColorMaski"); - api->BindVertexArray = loadProc("glBindVertexArray"); - api->ProgramUniform3d = loadProc("glProgramUniform3d"); - api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); - api->Uniform4i = loadProc("glUniform4i"); - api->GetAttachedShaders = loadProc("glGetAttachedShaders"); - api->AttachShader = loadProc("glAttachShader"); - api->VertexAttribI2ui = loadProc("glVertexAttribI2ui"); - api->ClearColor = loadProc("glClearColor"); - api->TexParameterIiv = loadProc("glTexParameterIiv"); - api->ProgramUniform4d = loadProc("glProgramUniform4d"); - api->DrawTransformFeedbackStream = loadProc("glDrawTransformFeedbackStream"); - api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); - api->CopyBufferSubData = loadProc("glCopyBufferSubData"); - api->DebugMessageInsert = mg_glDebugMessageInsert_noimpl; - api->ViewportIndexedf = loadProc("glViewportIndexedf"); - api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); - api->ObjectPtrLabel = mg_glObjectPtrLabel_noimpl; - api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); - api->UniformMatrix3x4dv = loadProc("glUniformMatrix3x4dv"); - api->FramebufferTexture1D = loadProc("glFramebufferTexture1D"); - api->Viewport = loadProc("glViewport"); - api->GenTextures = loadProc("glGenTextures"); - api->UniformBlockBinding = loadProc("glUniformBlockBinding"); - api->VertexAttrib3sv = loadProc("glVertexAttrib3sv"); - api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); - api->VertexAttrib2f = loadProc("glVertexAttrib2f"); - api->GetActiveUniform = loadProc("glGetActiveUniform"); - api->ScissorIndexed = loadProc("glScissorIndexed"); - api->TexParameterf = loadProc("glTexParameterf"); - api->BindSampler = loadProc("glBindSampler"); - api->MultiDrawElementsIndirect = mg_glMultiDrawElementsIndirect_noimpl; - api->ClearTexSubImage = mg_glClearTexSubImage_noimpl; - api->IsEnabledi = loadProc("glIsEnabledi"); - api->Scissor = loadProc("glScissor"); - api->ProgramBinary = loadProc("glProgramBinary"); - api->Disable = loadProc("glDisable"); - api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); - api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); - api->DebugMessageCallback = mg_glDebugMessageCallback_noimpl; - api->BlendEquationi = loadProc("glBlendEquationi"); - api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); - api->BlendFunci = loadProc("glBlendFunci"); - api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); - api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); - api->GenRenderbuffers = loadProc("glGenRenderbuffers"); - api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); - api->Uniform1ui = loadProc("glUniform1ui"); - api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); - api->VertexAttrib4bv = loadProc("glVertexAttrib4bv"); - api->GetProgramResourceLocationIndex = mg_glGetProgramResourceLocationIndex_noimpl; - api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); - api->PolygonOffset = loadProc("glPolygonOffset"); - api->IsProgram = loadProc("glIsProgram"); - api->ClearDepthf = loadProc("glClearDepthf"); - api->EndConditionalRender = loadProc("glEndConditionalRender"); - api->GetObjectLabel = mg_glGetObjectLabel_noimpl; - api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); - api->VertexAttribI3i = loadProc("glVertexAttribI3i"); - api->GenSamplers = loadProc("glGenSamplers"); - api->VertexAttribI2uiv = loadProc("glVertexAttribI2uiv"); - api->StencilOpSeparate = loadProc("glStencilOpSeparate"); - api->GetProgramInterfaceiv = mg_glGetProgramInterfaceiv_noimpl; - api->GetObjectPtrLabel = mg_glGetObjectPtrLabel_noimpl; - api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); - api->GetInteger64v = loadProc("glGetInteger64v"); - api->GetString = loadProc("glGetString"); - api->IsSync = loadProc("glIsSync"); - api->CopyTexImage1D = loadProc("glCopyTexImage1D"); - api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); - api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); - api->BeginQuery = loadProc("glBeginQuery"); - api->GetBufferPointerv = loadProc("glGetBufferPointerv"); - api->BlitFramebuffer = loadProc("glBlitFramebuffer"); - api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); - api->PointParameteri = loadProc("glPointParameteri"); - api->PolygonMode = loadProc("glPolygonMode"); - api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); - api->TexImage2DMultisample = loadProc("glTexImage2DMultisample"); - api->VertexAttribL3d = loadProc("glVertexAttribL3d"); - api->ProgramUniform4i = loadProc("glProgramUniform4i"); - api->GetUniformfv = loadProc("glGetUniformfv"); - api->DebugMessageControl = mg_glDebugMessageControl_noimpl; - api->TexParameteriv = loadProc("glTexParameteriv"); - api->IsBuffer = loadProc("glIsBuffer"); - api->ProgramUniformMatrix3dv = loadProc("glProgramUniformMatrix3dv"); - api->BindFramebuffer = loadProc("glBindFramebuffer"); - api->BufferStorage = mg_glBufferStorage_noimpl; - api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); - api->BindTextures = mg_glBindTextures_noimpl; - api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); - api->ProgramUniformMatrix4x2dv = loadProc("glProgramUniformMatrix4x2dv"); - api->PushDebugGroup = mg_glPushDebugGroup_noimpl; - api->SamplerParameteriv = loadProc("glSamplerParameteriv"); - api->VertexAttribI2i = loadProc("glVertexAttribI2i"); - api->BindTransformFeedback = loadProc("glBindTransformFeedback"); - api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); - api->Uniform2fv = loadProc("glUniform2fv"); - api->VertexAttrib1dv = loadProc("glVertexAttrib1dv"); - api->SamplerParameteri = loadProc("glSamplerParameteri"); - api->TexBufferRange = mg_glTexBufferRange_noimpl; - api->GetShaderiv = loadProc("glGetShaderiv"); - api->StencilMask = loadProc("glStencilMask"); - api->VertexAttrib3f = loadProc("glVertexAttrib3f"); - api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); - api->DeleteQueries = loadProc("glDeleteQueries"); - api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); - api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); - api->Uniform1f = loadProc("glUniform1f"); - api->TexSubImage1D = loadProc("glTexSubImage1D"); - api->ClearBufferiv = loadProc("glClearBufferiv"); - api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); - api->InvalidateTexImage = mg_glInvalidateTexImage_noimpl; - api->ClearBufferSubData = mg_glClearBufferSubData_noimpl; - api->ClearTexImage = mg_glClearTexImage_noimpl; - api->VertexAttrib4d = loadProc("glVertexAttrib4d"); - api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); - api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); - api->Uniform2f = loadProc("glUniform2f"); - api->VertexAttribL4d = loadProc("glVertexAttribL4d"); - api->TexImage2D = loadProc("glTexImage2D"); - api->LogicOp = loadProc("glLogicOp"); - api->BindTexture = loadProc("glBindTexture"); - api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); - api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); - api->GetFragDataIndex = loadProc("glGetFragDataIndex"); - api->UniformMatrix2x3dv = loadProc("glUniformMatrix2x3dv"); - api->GetVertexAttribLdv = loadProc("glGetVertexAttribLdv"); - api->BindRenderbuffer = loadProc("glBindRenderbuffer"); - api->Uniform1d = loadProc("glUniform1d"); - api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); - api->MinSampleShading = loadProc("glMinSampleShading"); - api->CopyTexSubImage1D = loadProc("glCopyTexSubImage1D"); - api->TexImage1D = loadProc("glTexImage1D"); - api->VertexAttrib1f = loadProc("glVertexAttrib1f"); - api->LineWidth = loadProc("glLineWidth"); - api->PointParameterf = loadProc("glPointParameterf"); - api->DrawElementsInstancedBaseVertexBaseInstance = mg_glDrawElementsInstancedBaseVertexBaseInstance_noimpl; - api->GetActiveSubroutineUniformiv = loadProc("glGetActiveSubroutineUniformiv"); - api->Uniform4ui = loadProc("glUniform4ui"); - api->VertexAttribBinding = mg_glVertexAttribBinding_noimpl; - api->GetTexParameteriv = loadProc("glGetTexParameteriv"); - api->RenderbufferStorage = loadProc("glRenderbufferStorage"); - api->VertexAttrib4iv = loadProc("glVertexAttrib4iv"); - api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); - api->GetBooleanv = loadProc("glGetBooleanv"); - api->ProgramUniformMatrix2x3dv = loadProc("glProgramUniformMatrix2x3dv"); - api->ProgramUniformMatrix4dv = loadProc("glProgramUniformMatrix4dv"); - api->Uniform2iv = loadProc("glUniform2iv"); - api->BufferData = loadProc("glBufferData"); - api->GetActiveSubroutineUniformName = loadProc("glGetActiveSubroutineUniformName"); - api->GetStringi = loadProc("glGetStringi"); - api->BindImageTexture = mg_glBindImageTexture_noimpl; - api->ProgramUniformMatrix3x2dv = loadProc("glProgramUniformMatrix3x2dv"); - api->VertexAttribL4dv = loadProc("glVertexAttribL4dv"); - api->TexStorage3DMultisample = mg_glTexStorage3DMultisample_noimpl; - api->DepthRangeArrayv = loadProc("glDepthRangeArrayv"); - api->GetUniformiv = loadProc("glGetUniformiv"); - api->DeleteTextures = loadProc("glDeleteTextures"); - api->CreateShader = loadProc("glCreateShader"); - api->VertexAttrib4s = loadProc("glVertexAttrib4s"); - api->PrimitiveBoundingBox = mg_glPrimitiveBoundingBox_noimpl; - api->DrawBuffers = loadProc("glDrawBuffers"); - api->VertexAttrib2dv = loadProc("glVertexAttrib2dv"); - api->TexParameterIuiv = loadProc("glTexParameterIuiv"); - api->QueryCounter = loadProc("glQueryCounter"); - api->VertexAttribL1dv = loadProc("glVertexAttribL1dv"); - api->ProgramUniform1d = loadProc("glProgramUniform1d"); - api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); - api->PopDebugGroup = mg_glPopDebugGroup_noimpl; - api->MultiDrawArrays = loadProc("glMultiDrawArrays"); - api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); - api->Flush = loadProc("glFlush"); - api->UnmapBuffer = loadProc("glUnmapBuffer"); - api->FramebufferTexture3D = loadProc("glFramebufferTexture3D"); - api->Uniform1fv = loadProc("glUniform1fv"); - api->IsFramebuffer = loadProc("glIsFramebuffer"); - api->ValidateProgram = loadProc("glValidateProgram"); - api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); - api->ReadnPixels = mg_glReadnPixels_noimpl; - api->VertexAttribP2ui = loadProc("glVertexAttribP2ui"); - api->ProgramUniform2i = loadProc("glProgramUniform2i"); - api->PatchParameteri = loadProc("glPatchParameteri"); - api->VertexAttrib4Nub = loadProc("glVertexAttrib4Nub"); - api->GenQueries = loadProc("glGenQueries"); - api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); - api->BindSamplers = mg_glBindSamplers_noimpl; - api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); - api->Enablei = loadProc("glEnablei"); - api->GetSynciv = loadProc("glGetSynciv"); - api->VertexAttrib3s = loadProc("glVertexAttrib3s"); - api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); - api->VertexBindingDivisor = mg_glVertexBindingDivisor_noimpl; - api->DepthRangef = loadProc("glDepthRangef"); - api->VertexAttrib4Nuiv = loadProc("glVertexAttrib4Nuiv"); - api->Finish = loadProc("glFinish"); - api->BlendFunc = loadProc("glBlendFunc"); - api->DrawTransformFeedbackStreamInstanced = mg_glDrawTransformFeedbackStreamInstanced_noimpl; - api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); - api->UniformMatrix4x2dv = loadProc("glUniformMatrix4x2dv"); - api->Uniform2d = loadProc("glUniform2d"); - api->GetnUniformfv = mg_glGetnUniformfv_noimpl; - api->GetFloati_v = loadProc("glGetFloati_v"); - api->GetInteger64i_v = loadProc("glGetInteger64i_v"); - api->ProgramUniform3f = loadProc("glProgramUniform3f"); - api->GetFramebufferParameteriv = mg_glGetFramebufferParameteriv_noimpl; - api->VertexAttribI4bv = loadProc("glVertexAttribI4bv"); - api->DeleteProgram = loadProc("glDeleteProgram"); - api->CopyTexImage2D = loadProc("glCopyTexImage2D"); - api->GetUniformuiv = loadProc("glGetUniformuiv"); - api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); - api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); - api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); - api->Uniform2i = loadProc("glUniform2i"); - api->ProgramUniform3dv = loadProc("glProgramUniform3dv"); - api->ScissorIndexedv = loadProc("glScissorIndexedv"); - api->ProgramUniform2d = loadProc("glProgramUniform2d"); - api->VertexAttrib4f = loadProc("glVertexAttrib4f"); - api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); - api->GetUniformdv = loadProc("glGetUniformdv"); - api->DrawRangeElements = loadProc("glDrawRangeElements"); - api->UniformMatrix3dv = loadProc("glUniformMatrix3dv"); - api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); - api->VertexAttribI1uiv = loadProc("glVertexAttribI1uiv"); - api->BeginQueryIndexed = loadProc("glBeginQueryIndexed"); - api->PointParameterfv = loadProc("glPointParameterfv"); - api->SampleCoverage = loadProc("glSampleCoverage"); - api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); - api->ReadPixels = loadProc("glReadPixels"); - api->LinkProgram = loadProc("glLinkProgram"); - api->WaitSync = loadProc("glWaitSync"); - api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); - api->GetQueryObjectiv = loadProc("glGetQueryObjectiv"); - api->ProgramUniform3i = loadProc("glProgramUniform3i"); - api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); - api->BlendBarrier = mg_glBlendBarrier_noimpl; - api->VertexAttribI4ubv = loadProc("glVertexAttribI4ubv"); - api->GetQueryObjecti64v = loadProc("glGetQueryObjecti64v"); - api->UniformMatrix4dv = loadProc("glUniformMatrix4dv"); - api->Uniform1iv = loadProc("glUniform1iv"); - api->Enable = loadProc("glEnable"); - api->GenBuffers = loadProc("glGenBuffers"); - api->TexStorage3D = mg_glTexStorage3D_noimpl; - api->InvalidateTexSubImage = mg_glInvalidateTexSubImage_noimpl; - api->ProgramUniform1i = loadProc("glProgramUniform1i"); - api->BlendEquation = loadProc("glBlendEquation"); - api->DepthRange = loadProc("glDepthRange"); - api->Uniform2dv = loadProc("glUniform2dv"); - api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); - api->Uniform1dv = loadProc("glUniform1dv"); - api->EndQueryIndexed = loadProc("glEndQueryIndexed"); - api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); - api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); - api->DepthFunc = loadProc("glDepthFunc"); - api->InvalidateBufferData = mg_glInvalidateBufferData_noimpl; - api->BindImageTextures = mg_glBindImageTextures_noimpl; - api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); - api->VertexAttribI2iv = loadProc("glVertexAttribI2iv"); - api->VertexAttrib4sv = loadProc("glVertexAttrib4sv"); - api->VertexAttribFormat = mg_glVertexAttribFormat_noimpl; - api->MapBufferRange = loadProc("glMapBufferRange"); - api->DetachShader = loadProc("glDetachShader"); - api->GetBooleani_v = loadProc("glGetBooleani_v"); - api->DepthRangeIndexed = loadProc("glDepthRangeIndexed"); - api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); - api->VertexAttribL3dv = loadProc("glVertexAttribL3dv"); - api->PrimitiveRestartIndex = loadProc("glPrimitiveRestartIndex"); - api->Uniform4d = loadProc("glUniform4d"); - api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); - api->DeleteBuffers = loadProc("glDeleteBuffers"); - api->GetProgramResourceLocation = mg_glGetProgramResourceLocation_noimpl; - api->Uniform4f = loadProc("glUniform4f"); - api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); - api->VertexAttribP4ui = loadProc("glVertexAttribP4ui"); - api->IsRenderbuffer = loadProc("glIsRenderbuffer"); - api->VertexAttrib4Nbv = loadProc("glVertexAttrib4Nbv"); - api->VertexAttrib4Nsv = loadProc("glVertexAttrib4Nsv"); - api->CullFace = loadProc("glCullFace"); - api->MultiDrawElementsBaseVertex = loadProc("glMultiDrawElementsBaseVertex"); - api->VertexAttribI3ui = loadProc("glVertexAttribI3ui"); - api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); - api->UseProgramStages = loadProc("glUseProgramStages"); - api->GetActiveAttrib = loadProc("glGetActiveAttrib"); - api->DrawArraysInstancedBaseInstance = mg_glDrawArraysInstancedBaseInstance_noimpl; - api->IsProgramPipeline = loadProc("glIsProgramPipeline"); - api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); - api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); - api->ReadBuffer = loadProc("glReadBuffer"); - api->DeleteShader = loadProc("glDeleteShader"); - api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); - api->ClientWaitSync = loadProc("glClientWaitSync"); - api->CompressedTexImage1D = loadProc("glCompressedTexImage1D"); - api->VertexAttrib2d = loadProc("glVertexAttrib2d"); - api->VertexAttrib3dv = loadProc("glVertexAttrib3dv"); - api->VertexAttribI4i = loadProc("glVertexAttribI4i"); - api->VertexAttribL2dv = loadProc("glVertexAttribL2dv"); - api->GetDoublei_v = loadProc("glGetDoublei_v"); - api->TexParameterfv = loadProc("glTexParameterfv"); - api->GetAttribLocation = loadProc("glGetAttribLocation"); - api->VertexAttribP1ui = loadProc("glVertexAttribP1ui"); - api->VertexAttribIFormat = mg_glVertexAttribIFormat_noimpl; - api->VertexAttribI1ui = loadProc("glVertexAttribI1ui"); - api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); - api->GetActiveSubroutineName = loadProc("glGetActiveSubroutineName"); - api->IsQuery = loadProc("glIsQuery"); - api->VertexAttrib1sv = loadProc("glVertexAttrib1sv"); - api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); - api->UseProgram = loadProc("glUseProgram"); - api->Clear = loadProc("glClear"); - api->VertexAttrib4ubv = loadProc("glVertexAttrib4ubv"); - api->InvalidateFramebuffer = mg_glInvalidateFramebuffer_noimpl; - api->PixelStorei = loadProc("glPixelStorei"); - api->Uniform1i = loadProc("glUniform1i"); - api->Uniform1uiv = loadProc("glUniform1uiv"); - api->TexImage3DMultisample = loadProc("glTexImage3DMultisample"); - api->BindBuffer = loadProc("glBindBuffer"); - api->ActiveTexture = loadProc("glActiveTexture"); - api->DeleteSync = loadProc("glDeleteSync"); - api->VertexAttrib4Niv = loadProc("glVertexAttrib4Niv"); - api->VertexAttrib4uiv = loadProc("glVertexAttrib4uiv"); - api->Uniform3fv = loadProc("glUniform3fv"); - api->GenVertexArrays = loadProc("glGenVertexArrays"); - api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); - api->BindAttribLocation = loadProc("glBindAttribLocation"); - api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); - api->BlendColor = loadProc("glBlendColor"); - api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); - api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); - api->IsShader = loadProc("glIsShader"); - api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); - api->VertexAttribLFormat = mg_glVertexAttribLFormat_noimpl; - api->BindBuffersRange = mg_glBindBuffersRange_noimpl; - api->ColorMask = loadProc("glColorMask"); - api->UniformMatrix2x4dv = loadProc("glUniformMatrix2x4dv"); - api->GetDoublev = loadProc("glGetDoublev"); - api->UniformMatrix3x2dv = loadProc("glUniformMatrix3x2dv"); - api->VertexAttribL2d = loadProc("glVertexAttribL2d"); - api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); - api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); - api->PointParameteriv = loadProc("glPointParameteriv"); - api->UniformSubroutinesuiv = loadProc("glUniformSubroutinesuiv"); - api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); - api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); - api->GetTexImage = loadProc("glGetTexImage"); - api->ProgramUniformMatrix2x4dv = loadProc("glProgramUniformMatrix2x4dv"); - api->VertexAttribI1iv = loadProc("glVertexAttribI1iv"); - api->IsSampler = loadProc("glIsSampler"); - api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); - api->TexStorage1D = mg_glTexStorage1D_noimpl; - api->ViewportArrayv = loadProc("glViewportArrayv"); - api->TexImage3D = loadProc("glTexImage3D"); - api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); - api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); - api->GetVertexAttribdv = loadProc("glGetVertexAttribdv"); - api->InvalidateBufferSubData = mg_glInvalidateBufferSubData_noimpl; - api->ProgramUniform4f = loadProc("glProgramUniform4f"); - api->VertexAttrib2s = loadProc("glVertexAttrib2s"); - api->TexSubImage3D = loadProc("glTexSubImage3D"); - api->GetFragDataLocation = loadProc("glGetFragDataLocation"); - api->VertexAttribI1i = loadProc("glVertexAttribI1i"); - api->GetActiveAtomicCounterBufferiv = mg_glGetActiveAtomicCounterBufferiv_noimpl; - api->TexStorage2DMultisample = mg_glTexStorage2DMultisample_noimpl; - api->BindBuffersBase = mg_glBindBuffersBase_noimpl; - api->GetUniformSubroutineuiv = loadProc("glGetUniformSubroutineuiv"); - api->EndTransformFeedback = loadProc("glEndTransformFeedback"); - api->ShaderSource = loadProc("glShaderSource"); - api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); - api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); - api->Uniform3d = loadProc("glUniform3d"); - api->ClearBufferfv = loadProc("glClearBufferfv"); - api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); - api->MemoryBarrierByRegion = mg_glMemoryBarrierByRegion_noimpl; - api->GenProgramPipelines = loadProc("glGenProgramPipelines"); - api->BindFragDataLocation = loadProc("glBindFragDataLocation"); - api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); - api->TextureView = mg_glTextureView_noimpl; - api->IsEnabled = loadProc("glIsEnabled"); - api->PatchParameterfv = loadProc("glPatchParameterfv"); - api->Hint = loadProc("glHint"); - api->PixelStoref = loadProc("glPixelStoref"); - api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); - api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); - api->ClearBufferuiv = loadProc("glClearBufferuiv"); - api->ObjectLabel = mg_glObjectLabel_noimpl; - api->GetPointerv = mg_glGetPointerv_noimpl; - api->DeleteSamplers = loadProc("glDeleteSamplers"); - api->ProgramUniform2dv = loadProc("glProgramUniform2dv"); - api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); - api->ClampColor = loadProc("glClampColor"); - api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); - api->GetnUniformiv = mg_glGetnUniformiv_noimpl; - api->Uniform3iv = loadProc("glUniform3iv"); - api->VertexAttribI3uiv = loadProc("glVertexAttribI3uiv"); - api->BufferSubData = loadProc("glBufferSubData"); - api->SamplerParameterfv = loadProc("glSamplerParameterfv"); - api->VertexAttribI4sv = loadProc("glVertexAttribI4sv"); - api->TexBuffer = loadProc("glTexBuffer"); - api->CreateProgram = loadProc("glCreateProgram"); - api->BindBufferRange = loadProc("glBindBufferRange"); - api->IsTexture = loadProc("glIsTexture"); - api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); - api->DrawElements = loadProc("glDrawElements"); - api->ProgramUniform1f = loadProc("glProgramUniform1f"); - api->Uniform3dv = loadProc("glUniform3dv"); - api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); - api->GenerateMipmap = loadProc("glGenerateMipmap"); - api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); - api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); - api->ClearDepth = loadProc("glClearDepth"); - api->DrawTransformFeedback = loadProc("glDrawTransformFeedback"); - api->TexSubImage2D = loadProc("glTexSubImage2D"); - api->VertexAttribP4uiv = loadProc("glVertexAttribP4uiv"); - api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); - api->PointSize = loadProc("glPointSize"); - api->GetCompressedTexImage = loadProc("glGetCompressedTexImage"); - api->Uniform2uiv = loadProc("glUniform2uiv"); - api->FenceSync = loadProc("glFenceSync"); - api->MapBuffer = loadProc("glMapBuffer"); - api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); - api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); - api->TexParameteri = loadProc("glTexParameteri"); - api->GetTexParameterfv = loadProc("glGetTexParameterfv"); - api->VertexAttribL1d = loadProc("glVertexAttribL1d"); - api->VertexAttrib4Nusv = loadProc("glVertexAttrib4Nusv"); - api->ProgramUniform2f = loadProc("glProgramUniform2f"); - api->VertexAttrib1d = loadProc("glVertexAttrib1d"); - api->GetError = loadProc("glGetError"); - api->VertexAttribP2uiv = loadProc("glVertexAttribP2uiv"); - api->UniformMatrix4x3dv = loadProc("glUniformMatrix4x3dv"); - api->GetShaderSource = loadProc("glGetShaderSource"); - api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); - api->FramebufferTexture = loadProc("glFramebufferTexture"); - api->ProgramUniformMatrix4x3dv = loadProc("glProgramUniformMatrix4x3dv"); - api->Uniform4dv = loadProc("glUniform4dv"); - api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); - api->ProgramUniformMatrix3x4dv = loadProc("glProgramUniformMatrix3x4dv"); - api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); - api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); - api->DrawElementsInstancedBaseInstance = mg_glDrawElementsInstancedBaseInstance_noimpl; - api->BindBufferBase = loadProc("glBindBufferBase"); - api->UniformMatrix2dv = loadProc("glUniformMatrix2dv"); - api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); - api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); - api->GetUniformIndices = loadProc("glGetUniformIndices"); - api->TexStorage2D = mg_glTexStorage2D_noimpl; - api->VertexAttrib4usv = loadProc("glVertexAttrib4usv"); - api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); - api->CopyImageSubData = mg_glCopyImageSubData_noimpl; - api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); - api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); - api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); - api->BindVertexBuffers = mg_glBindVertexBuffers_noimpl; - api->ProvokingVertex = loadProc("glProvokingVertex"); - api->Uniform3uiv = loadProc("glUniform3uiv"); - api->IsVertexArray = loadProc("glIsVertexArray"); - api->ViewportIndexedfv = loadProc("glViewportIndexedfv"); - api->DispatchCompute = mg_glDispatchCompute_noimpl; - api->DrawArrays = loadProc("glDrawArrays"); - api->GetQueryIndexediv = loadProc("glGetQueryIndexediv"); - api->Uniform3ui = loadProc("glUniform3ui"); - api->MultiDrawElements = loadProc("glMultiDrawElements"); - api->ClearBufferfi = loadProc("glClearBufferfi"); - api->ProgramUniformMatrix2dv = loadProc("glProgramUniformMatrix2dv"); - api->VertexAttribP3ui = loadProc("glVertexAttribP3ui"); - api->VertexAttribI3iv = loadProc("glVertexAttribI3iv"); - api->ProgramParameteri = loadProc("glProgramParameteri"); - api->Uniform4uiv = loadProc("glUniform4uiv"); - api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); - api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); - api->GetGraphicsResetStatus = mg_glGetGraphicsResetStatus_noimpl; - api->ShaderBinary = loadProc("glShaderBinary"); - api->ShaderStorageBlockBinding = mg_glShaderStorageBlockBinding_noimpl; - api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); - api->GetSubroutineIndex = loadProc("glGetSubroutineIndex"); - api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); - api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); - api->GetProgramResourceName = mg_glGetProgramResourceName_noimpl; - api->GetInternalformativ = mg_glGetInternalformativ_noimpl; - api->Uniform4fv = loadProc("glUniform4fv"); - api->VertexAttribLPointer = loadProc("glVertexAttribLPointer"); - api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); - api->VertexAttrib3d = loadProc("glVertexAttrib3d"); - api->SamplerParameterf = loadProc("glSamplerParameterf"); - api->GenFramebuffers = loadProc("glGenFramebuffers"); - api->GetQueryObjectui64v = loadProc("glGetQueryObjectui64v"); - api->GetProgramResourceiv = mg_glGetProgramResourceiv_noimpl; - api->VertexAttribP3uiv = loadProc("glVertexAttribP3uiv"); - api->VertexAttrib4dv = loadProc("glVertexAttrib4dv"); - api->IsTransformFeedback = loadProc("glIsTransformFeedback"); - api->DispatchComputeIndirect = mg_glDispatchComputeIndirect_noimpl; - api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); - api->BindVertexBuffer = mg_glBindVertexBuffer_noimpl; - api->ProgramUniform1dv = loadProc("glProgramUniform1dv"); - api->StencilOp = loadProc("glStencilOp"); - api->VertexAttrib1s = loadProc("glVertexAttrib1s"); - api->GetMultisamplefv = loadProc("glGetMultisamplefv"); - api->GetQueryiv = loadProc("glGetQueryiv"); - api->BindProgramPipeline = loadProc("glBindProgramPipeline"); - api->FramebufferParameteri = mg_glFramebufferParameteri_noimpl; - api->GetIntegeri_v = loadProc("glGetIntegeri_v"); - api->GetIntegerv = loadProc("glGetIntegerv"); - api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); - api->ClearBufferData = mg_glClearBufferData_noimpl; - api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); - api->GetSubroutineUniformLocation = loadProc("glGetSubroutineUniformLocation"); - api->GetProgramiv = loadProc("glGetProgramiv"); - api->DepthMask = loadProc("glDepthMask"); - api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); - api->GetActiveUniformName = loadProc("glGetActiveUniformName"); - api->VertexAttribP1uiv = loadProc("glVertexAttribP1uiv"); - api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); - api->GetUniformLocation = loadProc("glGetUniformLocation"); - api->SampleMaski = loadProc("glSampleMaski"); - api->GetBufferSubData = loadProc("glGetBufferSubData"); - api->Uniform4iv = loadProc("glUniform4iv"); - api->VertexAttribPointer = loadProc("glVertexAttribPointer"); - api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); - api->GetnUniformuiv = mg_glGetnUniformuiv_noimpl; - api->GetInternalformati64v = mg_glGetInternalformati64v_noimpl; - api->CompileShader = loadProc("glCompileShader"); - api->DrawBuffer = loadProc("glDrawBuffer"); - api->Uniform3f = loadProc("glUniform3f"); - api->DrawTransformFeedbackInstanced = mg_glDrawTransformFeedbackInstanced_noimpl; - api->ProgramUniform4dv = loadProc("glProgramUniform4dv"); - api->GetProgramStageiv = loadProc("glGetProgramStageiv"); - api->StencilFunc = loadProc("glStencilFunc"); - api->GetProgramResourceIndex = mg_glGetProgramResourceIndex_noimpl; - api->ClearStencil = loadProc("glClearStencil"); - api->ScissorArrayv = loadProc("glScissorArrayv"); - api->MemoryBarrier = mg_glMemoryBarrier_noimpl; - api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); - api->GetFloatv = loadProc("glGetFloatv"); - api->BindFragDataLocationIndexed = loadProc("glBindFragDataLocationIndexed"); - api->EndQuery = loadProc("glEndQuery"); - api->VertexAttrib4Nubv = loadProc("glVertexAttrib4Nubv"); - api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); - api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); - api->Uniform3i = loadProc("glUniform3i"); - api->Uniform2ui = loadProc("glUniform2ui"); - api->InvalidateSubFramebuffer = mg_glInvalidateSubFramebuffer_noimpl; - api->GetDebugMessageLog = mg_glGetDebugMessageLog_noimpl; -} - -void mg_gl_load_gl43(mg_gl_api* api, mg_gl_load_proc loadProc) -{ - api->name = "gl43"; - api->GetProgramBinary = loadProc("glGetProgramBinary"); - api->FrontFace = loadProc("glFrontFace"); - api->Disablei = loadProc("glDisablei"); - api->BeginConditionalRender = loadProc("glBeginConditionalRender"); - api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); - api->CompressedTexSubImage1D = loadProc("glCompressedTexSubImage1D"); - api->VertexAttribI4usv = loadProc("glVertexAttribI4usv"); - api->VertexAttrib2sv = loadProc("glVertexAttrib2sv"); - api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); - api->MultiDrawArraysIndirect = loadProc("glMultiDrawArraysIndirect"); - api->ColorMaski = loadProc("glColorMaski"); - api->BindVertexArray = loadProc("glBindVertexArray"); - api->ProgramUniform3d = loadProc("glProgramUniform3d"); - api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); - api->Uniform4i = loadProc("glUniform4i"); - api->GetAttachedShaders = loadProc("glGetAttachedShaders"); - api->AttachShader = loadProc("glAttachShader"); - api->VertexAttribI2ui = loadProc("glVertexAttribI2ui"); - api->ClearColor = loadProc("glClearColor"); - api->TexParameterIiv = loadProc("glTexParameterIiv"); - api->ProgramUniform4d = loadProc("glProgramUniform4d"); - api->DrawTransformFeedbackStream = loadProc("glDrawTransformFeedbackStream"); - api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); - api->CopyBufferSubData = loadProc("glCopyBufferSubData"); - api->DebugMessageInsert = loadProc("glDebugMessageInsert"); - api->ViewportIndexedf = loadProc("glViewportIndexedf"); - api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); - api->ObjectPtrLabel = loadProc("glObjectPtrLabel"); - api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); - api->UniformMatrix3x4dv = loadProc("glUniformMatrix3x4dv"); - api->FramebufferTexture1D = loadProc("glFramebufferTexture1D"); - api->Viewport = loadProc("glViewport"); - api->GenTextures = loadProc("glGenTextures"); - api->UniformBlockBinding = loadProc("glUniformBlockBinding"); - api->VertexAttrib3sv = loadProc("glVertexAttrib3sv"); - api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); - api->VertexAttrib2f = loadProc("glVertexAttrib2f"); - api->GetActiveUniform = loadProc("glGetActiveUniform"); - api->ScissorIndexed = loadProc("glScissorIndexed"); - api->TexParameterf = loadProc("glTexParameterf"); - api->BindSampler = loadProc("glBindSampler"); - api->MultiDrawElementsIndirect = loadProc("glMultiDrawElementsIndirect"); - api->ClearTexSubImage = mg_glClearTexSubImage_noimpl; - api->IsEnabledi = loadProc("glIsEnabledi"); - api->Scissor = loadProc("glScissor"); - api->ProgramBinary = loadProc("glProgramBinary"); - api->Disable = loadProc("glDisable"); - api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); - api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); - api->DebugMessageCallback = loadProc("glDebugMessageCallback"); - api->BlendEquationi = loadProc("glBlendEquationi"); - api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); - api->BlendFunci = loadProc("glBlendFunci"); - api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); - api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); - api->GenRenderbuffers = loadProc("glGenRenderbuffers"); - api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); - api->Uniform1ui = loadProc("glUniform1ui"); - api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); - api->VertexAttrib4bv = loadProc("glVertexAttrib4bv"); - api->GetProgramResourceLocationIndex = loadProc("glGetProgramResourceLocationIndex"); - api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); - api->PolygonOffset = loadProc("glPolygonOffset"); - api->IsProgram = loadProc("glIsProgram"); - api->ClearDepthf = loadProc("glClearDepthf"); - api->EndConditionalRender = loadProc("glEndConditionalRender"); - api->GetObjectLabel = loadProc("glGetObjectLabel"); - api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); - api->VertexAttribI3i = loadProc("glVertexAttribI3i"); - api->GenSamplers = loadProc("glGenSamplers"); - api->VertexAttribI2uiv = loadProc("glVertexAttribI2uiv"); - api->StencilOpSeparate = loadProc("glStencilOpSeparate"); - api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); - api->GetObjectPtrLabel = loadProc("glGetObjectPtrLabel"); - api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); - api->GetInteger64v = loadProc("glGetInteger64v"); - api->GetString = loadProc("glGetString"); - api->IsSync = loadProc("glIsSync"); - api->CopyTexImage1D = loadProc("glCopyTexImage1D"); - api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); - api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); - api->BeginQuery = loadProc("glBeginQuery"); - api->GetBufferPointerv = loadProc("glGetBufferPointerv"); - api->BlitFramebuffer = loadProc("glBlitFramebuffer"); - api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); - api->PointParameteri = loadProc("glPointParameteri"); - api->PolygonMode = loadProc("glPolygonMode"); - api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); - api->TexImage2DMultisample = loadProc("glTexImage2DMultisample"); - api->VertexAttribL3d = loadProc("glVertexAttribL3d"); - api->ProgramUniform4i = loadProc("glProgramUniform4i"); - api->GetUniformfv = loadProc("glGetUniformfv"); - api->DebugMessageControl = loadProc("glDebugMessageControl"); - api->TexParameteriv = loadProc("glTexParameteriv"); - api->IsBuffer = loadProc("glIsBuffer"); - api->ProgramUniformMatrix3dv = loadProc("glProgramUniformMatrix3dv"); - api->BindFramebuffer = loadProc("glBindFramebuffer"); - api->BufferStorage = mg_glBufferStorage_noimpl; - api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); - api->BindTextures = mg_glBindTextures_noimpl; - api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); - api->ProgramUniformMatrix4x2dv = loadProc("glProgramUniformMatrix4x2dv"); - api->PushDebugGroup = loadProc("glPushDebugGroup"); - api->SamplerParameteriv = loadProc("glSamplerParameteriv"); - api->VertexAttribI2i = loadProc("glVertexAttribI2i"); - api->BindTransformFeedback = loadProc("glBindTransformFeedback"); - api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); - api->Uniform2fv = loadProc("glUniform2fv"); - api->VertexAttrib1dv = loadProc("glVertexAttrib1dv"); - api->SamplerParameteri = loadProc("glSamplerParameteri"); - api->TexBufferRange = loadProc("glTexBufferRange"); - api->GetShaderiv = loadProc("glGetShaderiv"); - api->StencilMask = loadProc("glStencilMask"); - api->VertexAttrib3f = loadProc("glVertexAttrib3f"); - api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); - api->DeleteQueries = loadProc("glDeleteQueries"); - api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); - api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); - api->Uniform1f = loadProc("glUniform1f"); - api->TexSubImage1D = loadProc("glTexSubImage1D"); - api->ClearBufferiv = loadProc("glClearBufferiv"); - api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); - api->InvalidateTexImage = loadProc("glInvalidateTexImage"); - api->ClearBufferSubData = loadProc("glClearBufferSubData"); - api->ClearTexImage = mg_glClearTexImage_noimpl; - api->VertexAttrib4d = loadProc("glVertexAttrib4d"); - api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); - api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); - api->Uniform2f = loadProc("glUniform2f"); - api->VertexAttribL4d = loadProc("glVertexAttribL4d"); - api->TexImage2D = loadProc("glTexImage2D"); - api->LogicOp = loadProc("glLogicOp"); - api->BindTexture = loadProc("glBindTexture"); - api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); - api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); - api->GetFragDataIndex = loadProc("glGetFragDataIndex"); - api->UniformMatrix2x3dv = loadProc("glUniformMatrix2x3dv"); - api->GetVertexAttribLdv = loadProc("glGetVertexAttribLdv"); - api->BindRenderbuffer = loadProc("glBindRenderbuffer"); - api->Uniform1d = loadProc("glUniform1d"); - api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); - api->MinSampleShading = loadProc("glMinSampleShading"); - api->CopyTexSubImage1D = loadProc("glCopyTexSubImage1D"); - api->TexImage1D = loadProc("glTexImage1D"); - api->VertexAttrib1f = loadProc("glVertexAttrib1f"); - api->LineWidth = loadProc("glLineWidth"); - api->PointParameterf = loadProc("glPointParameterf"); - api->DrawElementsInstancedBaseVertexBaseInstance = loadProc("glDrawElementsInstancedBaseVertexBaseInstance"); - api->GetActiveSubroutineUniformiv = loadProc("glGetActiveSubroutineUniformiv"); - api->Uniform4ui = loadProc("glUniform4ui"); - api->VertexAttribBinding = loadProc("glVertexAttribBinding"); - api->GetTexParameteriv = loadProc("glGetTexParameteriv"); - api->RenderbufferStorage = loadProc("glRenderbufferStorage"); - api->VertexAttrib4iv = loadProc("glVertexAttrib4iv"); - api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); - api->GetBooleanv = loadProc("glGetBooleanv"); - api->ProgramUniformMatrix2x3dv = loadProc("glProgramUniformMatrix2x3dv"); - api->ProgramUniformMatrix4dv = loadProc("glProgramUniformMatrix4dv"); - api->Uniform2iv = loadProc("glUniform2iv"); - api->BufferData = loadProc("glBufferData"); - api->GetActiveSubroutineUniformName = loadProc("glGetActiveSubroutineUniformName"); - api->GetStringi = loadProc("glGetStringi"); - api->BindImageTexture = loadProc("glBindImageTexture"); - api->ProgramUniformMatrix3x2dv = loadProc("glProgramUniformMatrix3x2dv"); - api->VertexAttribL4dv = loadProc("glVertexAttribL4dv"); - api->TexStorage3DMultisample = loadProc("glTexStorage3DMultisample"); - api->DepthRangeArrayv = loadProc("glDepthRangeArrayv"); - api->GetUniformiv = loadProc("glGetUniformiv"); - api->DeleteTextures = loadProc("glDeleteTextures"); - api->CreateShader = loadProc("glCreateShader"); - api->VertexAttrib4s = loadProc("glVertexAttrib4s"); - api->PrimitiveBoundingBox = mg_glPrimitiveBoundingBox_noimpl; - api->DrawBuffers = loadProc("glDrawBuffers"); - api->VertexAttrib2dv = loadProc("glVertexAttrib2dv"); - api->TexParameterIuiv = loadProc("glTexParameterIuiv"); - api->QueryCounter = loadProc("glQueryCounter"); - api->VertexAttribL1dv = loadProc("glVertexAttribL1dv"); - api->ProgramUniform1d = loadProc("glProgramUniform1d"); - api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); - api->PopDebugGroup = loadProc("glPopDebugGroup"); - api->MultiDrawArrays = loadProc("glMultiDrawArrays"); - api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); - api->Flush = loadProc("glFlush"); - api->UnmapBuffer = loadProc("glUnmapBuffer"); - api->FramebufferTexture3D = loadProc("glFramebufferTexture3D"); - api->Uniform1fv = loadProc("glUniform1fv"); - api->IsFramebuffer = loadProc("glIsFramebuffer"); - api->ValidateProgram = loadProc("glValidateProgram"); - api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); - api->ReadnPixels = mg_glReadnPixels_noimpl; - api->VertexAttribP2ui = loadProc("glVertexAttribP2ui"); - api->ProgramUniform2i = loadProc("glProgramUniform2i"); - api->PatchParameteri = loadProc("glPatchParameteri"); - api->VertexAttrib4Nub = loadProc("glVertexAttrib4Nub"); - api->GenQueries = loadProc("glGenQueries"); - api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); - api->BindSamplers = mg_glBindSamplers_noimpl; - api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); - api->Enablei = loadProc("glEnablei"); - api->GetSynciv = loadProc("glGetSynciv"); - api->VertexAttrib3s = loadProc("glVertexAttrib3s"); - api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); - api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); - api->DepthRangef = loadProc("glDepthRangef"); - api->VertexAttrib4Nuiv = loadProc("glVertexAttrib4Nuiv"); - api->Finish = loadProc("glFinish"); - api->BlendFunc = loadProc("glBlendFunc"); - api->DrawTransformFeedbackStreamInstanced = loadProc("glDrawTransformFeedbackStreamInstanced"); - api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); - api->UniformMatrix4x2dv = loadProc("glUniformMatrix4x2dv"); - api->Uniform2d = loadProc("glUniform2d"); - api->GetnUniformfv = mg_glGetnUniformfv_noimpl; - api->GetFloati_v = loadProc("glGetFloati_v"); - api->GetInteger64i_v = loadProc("glGetInteger64i_v"); - api->ProgramUniform3f = loadProc("glProgramUniform3f"); - api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); - api->VertexAttribI4bv = loadProc("glVertexAttribI4bv"); - api->DeleteProgram = loadProc("glDeleteProgram"); - api->CopyTexImage2D = loadProc("glCopyTexImage2D"); - api->GetUniformuiv = loadProc("glGetUniformuiv"); - api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); - api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); - api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); - api->Uniform2i = loadProc("glUniform2i"); - api->ProgramUniform3dv = loadProc("glProgramUniform3dv"); - api->ScissorIndexedv = loadProc("glScissorIndexedv"); - api->ProgramUniform2d = loadProc("glProgramUniform2d"); - api->VertexAttrib4f = loadProc("glVertexAttrib4f"); - api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); - api->GetUniformdv = loadProc("glGetUniformdv"); - api->DrawRangeElements = loadProc("glDrawRangeElements"); - api->UniformMatrix3dv = loadProc("glUniformMatrix3dv"); - api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); - api->VertexAttribI1uiv = loadProc("glVertexAttribI1uiv"); - api->BeginQueryIndexed = loadProc("glBeginQueryIndexed"); - api->PointParameterfv = loadProc("glPointParameterfv"); - api->SampleCoverage = loadProc("glSampleCoverage"); - api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); - api->ReadPixels = loadProc("glReadPixels"); - api->LinkProgram = loadProc("glLinkProgram"); - api->WaitSync = loadProc("glWaitSync"); - api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); - api->GetQueryObjectiv = loadProc("glGetQueryObjectiv"); - api->ProgramUniform3i = loadProc("glProgramUniform3i"); - api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); - api->BlendBarrier = mg_glBlendBarrier_noimpl; - api->VertexAttribI4ubv = loadProc("glVertexAttribI4ubv"); - api->GetQueryObjecti64v = loadProc("glGetQueryObjecti64v"); - api->UniformMatrix4dv = loadProc("glUniformMatrix4dv"); - api->Uniform1iv = loadProc("glUniform1iv"); - api->Enable = loadProc("glEnable"); - api->GenBuffers = loadProc("glGenBuffers"); - api->TexStorage3D = loadProc("glTexStorage3D"); - api->InvalidateTexSubImage = loadProc("glInvalidateTexSubImage"); - api->ProgramUniform1i = loadProc("glProgramUniform1i"); - api->BlendEquation = loadProc("glBlendEquation"); - api->DepthRange = loadProc("glDepthRange"); - api->Uniform2dv = loadProc("glUniform2dv"); - api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); - api->Uniform1dv = loadProc("glUniform1dv"); - api->EndQueryIndexed = loadProc("glEndQueryIndexed"); - api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); - api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); - api->DepthFunc = loadProc("glDepthFunc"); - api->InvalidateBufferData = loadProc("glInvalidateBufferData"); - api->BindImageTextures = mg_glBindImageTextures_noimpl; - api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); - api->VertexAttribI2iv = loadProc("glVertexAttribI2iv"); - api->VertexAttrib4sv = loadProc("glVertexAttrib4sv"); - api->VertexAttribFormat = loadProc("glVertexAttribFormat"); - api->MapBufferRange = loadProc("glMapBufferRange"); - api->DetachShader = loadProc("glDetachShader"); - api->GetBooleani_v = loadProc("glGetBooleani_v"); - api->DepthRangeIndexed = loadProc("glDepthRangeIndexed"); - api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); - api->VertexAttribL3dv = loadProc("glVertexAttribL3dv"); - api->PrimitiveRestartIndex = loadProc("glPrimitiveRestartIndex"); - api->Uniform4d = loadProc("glUniform4d"); - api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); - api->DeleteBuffers = loadProc("glDeleteBuffers"); - api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); - api->Uniform4f = loadProc("glUniform4f"); - api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); - api->VertexAttribP4ui = loadProc("glVertexAttribP4ui"); - api->IsRenderbuffer = loadProc("glIsRenderbuffer"); - api->VertexAttrib4Nbv = loadProc("glVertexAttrib4Nbv"); - api->VertexAttrib4Nsv = loadProc("glVertexAttrib4Nsv"); - api->CullFace = loadProc("glCullFace"); - api->MultiDrawElementsBaseVertex = loadProc("glMultiDrawElementsBaseVertex"); - api->VertexAttribI3ui = loadProc("glVertexAttribI3ui"); - api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); - api->UseProgramStages = loadProc("glUseProgramStages"); - api->GetActiveAttrib = loadProc("glGetActiveAttrib"); - api->DrawArraysInstancedBaseInstance = loadProc("glDrawArraysInstancedBaseInstance"); - api->IsProgramPipeline = loadProc("glIsProgramPipeline"); - api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); - api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); - api->ReadBuffer = loadProc("glReadBuffer"); - api->DeleteShader = loadProc("glDeleteShader"); - api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); - api->ClientWaitSync = loadProc("glClientWaitSync"); - api->CompressedTexImage1D = loadProc("glCompressedTexImage1D"); - api->VertexAttrib2d = loadProc("glVertexAttrib2d"); - api->VertexAttrib3dv = loadProc("glVertexAttrib3dv"); - api->VertexAttribI4i = loadProc("glVertexAttribI4i"); - api->VertexAttribL2dv = loadProc("glVertexAttribL2dv"); - api->GetDoublei_v = loadProc("glGetDoublei_v"); - api->TexParameterfv = loadProc("glTexParameterfv"); - api->GetAttribLocation = loadProc("glGetAttribLocation"); - api->VertexAttribP1ui = loadProc("glVertexAttribP1ui"); - api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); - api->VertexAttribI1ui = loadProc("glVertexAttribI1ui"); - api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); - api->GetActiveSubroutineName = loadProc("glGetActiveSubroutineName"); - api->IsQuery = loadProc("glIsQuery"); - api->VertexAttrib1sv = loadProc("glVertexAttrib1sv"); - api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); - api->UseProgram = loadProc("glUseProgram"); - api->Clear = loadProc("glClear"); - api->VertexAttrib4ubv = loadProc("glVertexAttrib4ubv"); - api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); - api->PixelStorei = loadProc("glPixelStorei"); - api->Uniform1i = loadProc("glUniform1i"); - api->Uniform1uiv = loadProc("glUniform1uiv"); - api->TexImage3DMultisample = loadProc("glTexImage3DMultisample"); - api->BindBuffer = loadProc("glBindBuffer"); - api->ActiveTexture = loadProc("glActiveTexture"); - api->DeleteSync = loadProc("glDeleteSync"); - api->VertexAttrib4Niv = loadProc("glVertexAttrib4Niv"); - api->VertexAttrib4uiv = loadProc("glVertexAttrib4uiv"); - api->Uniform3fv = loadProc("glUniform3fv"); - api->GenVertexArrays = loadProc("glGenVertexArrays"); - api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); - api->BindAttribLocation = loadProc("glBindAttribLocation"); - api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); - api->BlendColor = loadProc("glBlendColor"); - api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); - api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); - api->IsShader = loadProc("glIsShader"); - api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); - api->VertexAttribLFormat = loadProc("glVertexAttribLFormat"); - api->BindBuffersRange = mg_glBindBuffersRange_noimpl; - api->ColorMask = loadProc("glColorMask"); - api->UniformMatrix2x4dv = loadProc("glUniformMatrix2x4dv"); - api->GetDoublev = loadProc("glGetDoublev"); - api->UniformMatrix3x2dv = loadProc("glUniformMatrix3x2dv"); - api->VertexAttribL2d = loadProc("glVertexAttribL2d"); - api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); - api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); - api->PointParameteriv = loadProc("glPointParameteriv"); - api->UniformSubroutinesuiv = loadProc("glUniformSubroutinesuiv"); - api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); - api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); - api->GetTexImage = loadProc("glGetTexImage"); - api->ProgramUniformMatrix2x4dv = loadProc("glProgramUniformMatrix2x4dv"); - api->VertexAttribI1iv = loadProc("glVertexAttribI1iv"); - api->IsSampler = loadProc("glIsSampler"); - api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); - api->TexStorage1D = loadProc("glTexStorage1D"); - api->ViewportArrayv = loadProc("glViewportArrayv"); - api->TexImage3D = loadProc("glTexImage3D"); - api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); - api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); - api->GetVertexAttribdv = loadProc("glGetVertexAttribdv"); - api->InvalidateBufferSubData = loadProc("glInvalidateBufferSubData"); - api->ProgramUniform4f = loadProc("glProgramUniform4f"); - api->VertexAttrib2s = loadProc("glVertexAttrib2s"); - api->TexSubImage3D = loadProc("glTexSubImage3D"); - api->GetFragDataLocation = loadProc("glGetFragDataLocation"); - api->VertexAttribI1i = loadProc("glVertexAttribI1i"); - api->GetActiveAtomicCounterBufferiv = loadProc("glGetActiveAtomicCounterBufferiv"); - api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); - api->BindBuffersBase = mg_glBindBuffersBase_noimpl; - api->GetUniformSubroutineuiv = loadProc("glGetUniformSubroutineuiv"); - api->EndTransformFeedback = loadProc("glEndTransformFeedback"); - api->ShaderSource = loadProc("glShaderSource"); - api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); - api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); - api->Uniform3d = loadProc("glUniform3d"); - api->ClearBufferfv = loadProc("glClearBufferfv"); - api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); - api->MemoryBarrierByRegion = mg_glMemoryBarrierByRegion_noimpl; - api->GenProgramPipelines = loadProc("glGenProgramPipelines"); - api->BindFragDataLocation = loadProc("glBindFragDataLocation"); - api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); - api->TextureView = loadProc("glTextureView"); - api->IsEnabled = loadProc("glIsEnabled"); - api->PatchParameterfv = loadProc("glPatchParameterfv"); - api->Hint = loadProc("glHint"); - api->PixelStoref = loadProc("glPixelStoref"); - api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); - api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); - api->ClearBufferuiv = loadProc("glClearBufferuiv"); - api->ObjectLabel = loadProc("glObjectLabel"); - api->GetPointerv = loadProc("glGetPointerv"); - api->DeleteSamplers = loadProc("glDeleteSamplers"); - api->ProgramUniform2dv = loadProc("glProgramUniform2dv"); - api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); - api->ClampColor = loadProc("glClampColor"); - api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); - api->GetnUniformiv = mg_glGetnUniformiv_noimpl; - api->Uniform3iv = loadProc("glUniform3iv"); - api->VertexAttribI3uiv = loadProc("glVertexAttribI3uiv"); - api->BufferSubData = loadProc("glBufferSubData"); - api->SamplerParameterfv = loadProc("glSamplerParameterfv"); - api->VertexAttribI4sv = loadProc("glVertexAttribI4sv"); - api->TexBuffer = loadProc("glTexBuffer"); - api->CreateProgram = loadProc("glCreateProgram"); - api->BindBufferRange = loadProc("glBindBufferRange"); - api->IsTexture = loadProc("glIsTexture"); - api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); - api->DrawElements = loadProc("glDrawElements"); - api->ProgramUniform1f = loadProc("glProgramUniform1f"); - api->Uniform3dv = loadProc("glUniform3dv"); - api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); - api->GenerateMipmap = loadProc("glGenerateMipmap"); - api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); - api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); - api->ClearDepth = loadProc("glClearDepth"); - api->DrawTransformFeedback = loadProc("glDrawTransformFeedback"); - api->TexSubImage2D = loadProc("glTexSubImage2D"); - api->VertexAttribP4uiv = loadProc("glVertexAttribP4uiv"); - api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); - api->PointSize = loadProc("glPointSize"); - api->GetCompressedTexImage = loadProc("glGetCompressedTexImage"); - api->Uniform2uiv = loadProc("glUniform2uiv"); - api->FenceSync = loadProc("glFenceSync"); - api->MapBuffer = loadProc("glMapBuffer"); - api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); - api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); - api->TexParameteri = loadProc("glTexParameteri"); - api->GetTexParameterfv = loadProc("glGetTexParameterfv"); - api->VertexAttribL1d = loadProc("glVertexAttribL1d"); - api->VertexAttrib4Nusv = loadProc("glVertexAttrib4Nusv"); - api->ProgramUniform2f = loadProc("glProgramUniform2f"); - api->VertexAttrib1d = loadProc("glVertexAttrib1d"); - api->GetError = loadProc("glGetError"); - api->VertexAttribP2uiv = loadProc("glVertexAttribP2uiv"); - api->UniformMatrix4x3dv = loadProc("glUniformMatrix4x3dv"); - api->GetShaderSource = loadProc("glGetShaderSource"); - api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); - api->FramebufferTexture = loadProc("glFramebufferTexture"); - api->ProgramUniformMatrix4x3dv = loadProc("glProgramUniformMatrix4x3dv"); - api->Uniform4dv = loadProc("glUniform4dv"); - api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); - api->ProgramUniformMatrix3x4dv = loadProc("glProgramUniformMatrix3x4dv"); - api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); - api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); - api->DrawElementsInstancedBaseInstance = loadProc("glDrawElementsInstancedBaseInstance"); - api->BindBufferBase = loadProc("glBindBufferBase"); - api->UniformMatrix2dv = loadProc("glUniformMatrix2dv"); - api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); - api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); - api->GetUniformIndices = loadProc("glGetUniformIndices"); - api->TexStorage2D = loadProc("glTexStorage2D"); - api->VertexAttrib4usv = loadProc("glVertexAttrib4usv"); - api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); - api->CopyImageSubData = loadProc("glCopyImageSubData"); - api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); - api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); - api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); - api->BindVertexBuffers = mg_glBindVertexBuffers_noimpl; - api->ProvokingVertex = loadProc("glProvokingVertex"); - api->Uniform3uiv = loadProc("glUniform3uiv"); - api->IsVertexArray = loadProc("glIsVertexArray"); - api->ViewportIndexedfv = loadProc("glViewportIndexedfv"); - api->DispatchCompute = loadProc("glDispatchCompute"); - api->DrawArrays = loadProc("glDrawArrays"); - api->GetQueryIndexediv = loadProc("glGetQueryIndexediv"); - api->Uniform3ui = loadProc("glUniform3ui"); - api->MultiDrawElements = loadProc("glMultiDrawElements"); - api->ClearBufferfi = loadProc("glClearBufferfi"); - api->ProgramUniformMatrix2dv = loadProc("glProgramUniformMatrix2dv"); - api->VertexAttribP3ui = loadProc("glVertexAttribP3ui"); - api->VertexAttribI3iv = loadProc("glVertexAttribI3iv"); - api->ProgramParameteri = loadProc("glProgramParameteri"); - api->Uniform4uiv = loadProc("glUniform4uiv"); - api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); - api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); - api->GetGraphicsResetStatus = mg_glGetGraphicsResetStatus_noimpl; - api->ShaderBinary = loadProc("glShaderBinary"); - api->ShaderStorageBlockBinding = loadProc("glShaderStorageBlockBinding"); - api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); - api->GetSubroutineIndex = loadProc("glGetSubroutineIndex"); - api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); - api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); - api->GetProgramResourceName = loadProc("glGetProgramResourceName"); - api->GetInternalformativ = loadProc("glGetInternalformativ"); - api->Uniform4fv = loadProc("glUniform4fv"); - api->VertexAttribLPointer = loadProc("glVertexAttribLPointer"); - api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); - api->VertexAttrib3d = loadProc("glVertexAttrib3d"); - api->SamplerParameterf = loadProc("glSamplerParameterf"); - api->GenFramebuffers = loadProc("glGenFramebuffers"); - api->GetQueryObjectui64v = loadProc("glGetQueryObjectui64v"); - api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); - api->VertexAttribP3uiv = loadProc("glVertexAttribP3uiv"); - api->VertexAttrib4dv = loadProc("glVertexAttrib4dv"); - api->IsTransformFeedback = loadProc("glIsTransformFeedback"); - api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); - api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); - api->BindVertexBuffer = loadProc("glBindVertexBuffer"); - api->ProgramUniform1dv = loadProc("glProgramUniform1dv"); - api->StencilOp = loadProc("glStencilOp"); - api->VertexAttrib1s = loadProc("glVertexAttrib1s"); - api->GetMultisamplefv = loadProc("glGetMultisamplefv"); - api->GetQueryiv = loadProc("glGetQueryiv"); - api->BindProgramPipeline = loadProc("glBindProgramPipeline"); - api->FramebufferParameteri = loadProc("glFramebufferParameteri"); - api->GetIntegeri_v = loadProc("glGetIntegeri_v"); - api->GetIntegerv = loadProc("glGetIntegerv"); - api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); - api->ClearBufferData = loadProc("glClearBufferData"); - api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); - api->GetSubroutineUniformLocation = loadProc("glGetSubroutineUniformLocation"); - api->GetProgramiv = loadProc("glGetProgramiv"); - api->DepthMask = loadProc("glDepthMask"); - api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); - api->GetActiveUniformName = loadProc("glGetActiveUniformName"); - api->VertexAttribP1uiv = loadProc("glVertexAttribP1uiv"); - api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); - api->GetUniformLocation = loadProc("glGetUniformLocation"); - api->SampleMaski = loadProc("glSampleMaski"); - api->GetBufferSubData = loadProc("glGetBufferSubData"); - api->Uniform4iv = loadProc("glUniform4iv"); - api->VertexAttribPointer = loadProc("glVertexAttribPointer"); - api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); - api->GetnUniformuiv = mg_glGetnUniformuiv_noimpl; - api->GetInternalformati64v = loadProc("glGetInternalformati64v"); - api->CompileShader = loadProc("glCompileShader"); - api->DrawBuffer = loadProc("glDrawBuffer"); - api->Uniform3f = loadProc("glUniform3f"); - api->DrawTransformFeedbackInstanced = loadProc("glDrawTransformFeedbackInstanced"); - api->ProgramUniform4dv = loadProc("glProgramUniform4dv"); - api->GetProgramStageiv = loadProc("glGetProgramStageiv"); - api->StencilFunc = loadProc("glStencilFunc"); - api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); - api->ClearStencil = loadProc("glClearStencil"); - api->ScissorArrayv = loadProc("glScissorArrayv"); - api->MemoryBarrier = loadProc("glMemoryBarrier"); - api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); - api->GetFloatv = loadProc("glGetFloatv"); - api->BindFragDataLocationIndexed = loadProc("glBindFragDataLocationIndexed"); - api->EndQuery = loadProc("glEndQuery"); - api->VertexAttrib4Nubv = loadProc("glVertexAttrib4Nubv"); - api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); - api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); - api->Uniform3i = loadProc("glUniform3i"); - api->Uniform2ui = loadProc("glUniform2ui"); - api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); - api->GetDebugMessageLog = loadProc("glGetDebugMessageLog"); -} - -void mg_gl_load_gl44(mg_gl_api* api, mg_gl_load_proc loadProc) -{ - api->name = "gl44"; - api->GetProgramBinary = loadProc("glGetProgramBinary"); - api->FrontFace = loadProc("glFrontFace"); - api->Disablei = loadProc("glDisablei"); - api->BeginConditionalRender = loadProc("glBeginConditionalRender"); - api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); - api->CompressedTexSubImage1D = loadProc("glCompressedTexSubImage1D"); - api->VertexAttribI4usv = loadProc("glVertexAttribI4usv"); - api->VertexAttrib2sv = loadProc("glVertexAttrib2sv"); - api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); - api->MultiDrawArraysIndirect = loadProc("glMultiDrawArraysIndirect"); - api->ColorMaski = loadProc("glColorMaski"); - api->BindVertexArray = loadProc("glBindVertexArray"); - api->ProgramUniform3d = loadProc("glProgramUniform3d"); - api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); - api->Uniform4i = loadProc("glUniform4i"); - api->GetAttachedShaders = loadProc("glGetAttachedShaders"); - api->AttachShader = loadProc("glAttachShader"); - api->VertexAttribI2ui = loadProc("glVertexAttribI2ui"); - api->ClearColor = loadProc("glClearColor"); - api->TexParameterIiv = loadProc("glTexParameterIiv"); - api->ProgramUniform4d = loadProc("glProgramUniform4d"); - api->DrawTransformFeedbackStream = loadProc("glDrawTransformFeedbackStream"); - api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); - api->CopyBufferSubData = loadProc("glCopyBufferSubData"); - api->DebugMessageInsert = loadProc("glDebugMessageInsert"); - api->ViewportIndexedf = loadProc("glViewportIndexedf"); - api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); - api->ObjectPtrLabel = loadProc("glObjectPtrLabel"); - api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); - api->UniformMatrix3x4dv = loadProc("glUniformMatrix3x4dv"); - api->FramebufferTexture1D = loadProc("glFramebufferTexture1D"); - api->Viewport = loadProc("glViewport"); - api->GenTextures = loadProc("glGenTextures"); - api->UniformBlockBinding = loadProc("glUniformBlockBinding"); - api->VertexAttrib3sv = loadProc("glVertexAttrib3sv"); - api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); - api->VertexAttrib2f = loadProc("glVertexAttrib2f"); - api->GetActiveUniform = loadProc("glGetActiveUniform"); - api->ScissorIndexed = loadProc("glScissorIndexed"); - api->TexParameterf = loadProc("glTexParameterf"); - api->BindSampler = loadProc("glBindSampler"); - api->MultiDrawElementsIndirect = loadProc("glMultiDrawElementsIndirect"); - api->ClearTexSubImage = loadProc("glClearTexSubImage"); - api->IsEnabledi = loadProc("glIsEnabledi"); - api->Scissor = loadProc("glScissor"); - api->ProgramBinary = loadProc("glProgramBinary"); - api->Disable = loadProc("glDisable"); - api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); - api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); - api->DebugMessageCallback = loadProc("glDebugMessageCallback"); - api->BlendEquationi = loadProc("glBlendEquationi"); - api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); - api->BlendFunci = loadProc("glBlendFunci"); - api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); - api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); - api->GenRenderbuffers = loadProc("glGenRenderbuffers"); - api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); - api->Uniform1ui = loadProc("glUniform1ui"); - api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); - api->VertexAttrib4bv = loadProc("glVertexAttrib4bv"); - api->GetProgramResourceLocationIndex = loadProc("glGetProgramResourceLocationIndex"); - api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); - api->PolygonOffset = loadProc("glPolygonOffset"); - api->IsProgram = loadProc("glIsProgram"); - api->ClearDepthf = loadProc("glClearDepthf"); - api->EndConditionalRender = loadProc("glEndConditionalRender"); - api->GetObjectLabel = loadProc("glGetObjectLabel"); - api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); - api->VertexAttribI3i = loadProc("glVertexAttribI3i"); - api->GenSamplers = loadProc("glGenSamplers"); - api->VertexAttribI2uiv = loadProc("glVertexAttribI2uiv"); - api->StencilOpSeparate = loadProc("glStencilOpSeparate"); - api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); - api->GetObjectPtrLabel = loadProc("glGetObjectPtrLabel"); - api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); - api->GetInteger64v = loadProc("glGetInteger64v"); - api->GetString = loadProc("glGetString"); - api->IsSync = loadProc("glIsSync"); - api->CopyTexImage1D = loadProc("glCopyTexImage1D"); - api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); - api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); - api->BeginQuery = loadProc("glBeginQuery"); - api->GetBufferPointerv = loadProc("glGetBufferPointerv"); - api->BlitFramebuffer = loadProc("glBlitFramebuffer"); - api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); - api->PointParameteri = loadProc("glPointParameteri"); - api->PolygonMode = loadProc("glPolygonMode"); - api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); - api->TexImage2DMultisample = loadProc("glTexImage2DMultisample"); - api->VertexAttribL3d = loadProc("glVertexAttribL3d"); - api->ProgramUniform4i = loadProc("glProgramUniform4i"); - api->GetUniformfv = loadProc("glGetUniformfv"); - api->DebugMessageControl = loadProc("glDebugMessageControl"); - api->TexParameteriv = loadProc("glTexParameteriv"); - api->IsBuffer = loadProc("glIsBuffer"); - api->ProgramUniformMatrix3dv = loadProc("glProgramUniformMatrix3dv"); - api->BindFramebuffer = loadProc("glBindFramebuffer"); - api->BufferStorage = loadProc("glBufferStorage"); - api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); - api->BindTextures = loadProc("glBindTextures"); - api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); - api->ProgramUniformMatrix4x2dv = loadProc("glProgramUniformMatrix4x2dv"); - api->PushDebugGroup = loadProc("glPushDebugGroup"); - api->SamplerParameteriv = loadProc("glSamplerParameteriv"); - api->VertexAttribI2i = loadProc("glVertexAttribI2i"); - api->BindTransformFeedback = loadProc("glBindTransformFeedback"); - api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); - api->Uniform2fv = loadProc("glUniform2fv"); - api->VertexAttrib1dv = loadProc("glVertexAttrib1dv"); - api->SamplerParameteri = loadProc("glSamplerParameteri"); - api->TexBufferRange = loadProc("glTexBufferRange"); - api->GetShaderiv = loadProc("glGetShaderiv"); - api->StencilMask = loadProc("glStencilMask"); - api->VertexAttrib3f = loadProc("glVertexAttrib3f"); - api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); - api->DeleteQueries = loadProc("glDeleteQueries"); - api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); - api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); - api->Uniform1f = loadProc("glUniform1f"); - api->TexSubImage1D = loadProc("glTexSubImage1D"); - api->ClearBufferiv = loadProc("glClearBufferiv"); - api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); - api->InvalidateTexImage = loadProc("glInvalidateTexImage"); - api->ClearBufferSubData = loadProc("glClearBufferSubData"); - api->ClearTexImage = loadProc("glClearTexImage"); - api->VertexAttrib4d = loadProc("glVertexAttrib4d"); - api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); - api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); - api->Uniform2f = loadProc("glUniform2f"); - api->VertexAttribL4d = loadProc("glVertexAttribL4d"); - api->TexImage2D = loadProc("glTexImage2D"); - api->LogicOp = loadProc("glLogicOp"); - api->BindTexture = loadProc("glBindTexture"); - api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); - api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); - api->GetFragDataIndex = loadProc("glGetFragDataIndex"); - api->UniformMatrix2x3dv = loadProc("glUniformMatrix2x3dv"); - api->GetVertexAttribLdv = loadProc("glGetVertexAttribLdv"); - api->BindRenderbuffer = loadProc("glBindRenderbuffer"); - api->Uniform1d = loadProc("glUniform1d"); - api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); - api->MinSampleShading = loadProc("glMinSampleShading"); - api->CopyTexSubImage1D = loadProc("glCopyTexSubImage1D"); - api->TexImage1D = loadProc("glTexImage1D"); - api->VertexAttrib1f = loadProc("glVertexAttrib1f"); - api->LineWidth = loadProc("glLineWidth"); - api->PointParameterf = loadProc("glPointParameterf"); - api->DrawElementsInstancedBaseVertexBaseInstance = loadProc("glDrawElementsInstancedBaseVertexBaseInstance"); - api->GetActiveSubroutineUniformiv = loadProc("glGetActiveSubroutineUniformiv"); - api->Uniform4ui = loadProc("glUniform4ui"); - api->VertexAttribBinding = loadProc("glVertexAttribBinding"); - api->GetTexParameteriv = loadProc("glGetTexParameteriv"); - api->RenderbufferStorage = loadProc("glRenderbufferStorage"); - api->VertexAttrib4iv = loadProc("glVertexAttrib4iv"); - api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); - api->GetBooleanv = loadProc("glGetBooleanv"); - api->ProgramUniformMatrix2x3dv = loadProc("glProgramUniformMatrix2x3dv"); - api->ProgramUniformMatrix4dv = loadProc("glProgramUniformMatrix4dv"); - api->Uniform2iv = loadProc("glUniform2iv"); - api->BufferData = loadProc("glBufferData"); - api->GetActiveSubroutineUniformName = loadProc("glGetActiveSubroutineUniformName"); - api->GetStringi = loadProc("glGetStringi"); - api->BindImageTexture = loadProc("glBindImageTexture"); - api->ProgramUniformMatrix3x2dv = loadProc("glProgramUniformMatrix3x2dv"); - api->VertexAttribL4dv = loadProc("glVertexAttribL4dv"); - api->TexStorage3DMultisample = loadProc("glTexStorage3DMultisample"); - api->DepthRangeArrayv = loadProc("glDepthRangeArrayv"); - api->GetUniformiv = loadProc("glGetUniformiv"); - api->DeleteTextures = loadProc("glDeleteTextures"); - api->CreateShader = loadProc("glCreateShader"); - api->VertexAttrib4s = loadProc("glVertexAttrib4s"); - api->PrimitiveBoundingBox = mg_glPrimitiveBoundingBox_noimpl; - api->DrawBuffers = loadProc("glDrawBuffers"); - api->VertexAttrib2dv = loadProc("glVertexAttrib2dv"); - api->TexParameterIuiv = loadProc("glTexParameterIuiv"); - api->QueryCounter = loadProc("glQueryCounter"); - api->VertexAttribL1dv = loadProc("glVertexAttribL1dv"); - api->ProgramUniform1d = loadProc("glProgramUniform1d"); - api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); - api->PopDebugGroup = loadProc("glPopDebugGroup"); - api->MultiDrawArrays = loadProc("glMultiDrawArrays"); - api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); - api->Flush = loadProc("glFlush"); - api->UnmapBuffer = loadProc("glUnmapBuffer"); - api->FramebufferTexture3D = loadProc("glFramebufferTexture3D"); - api->Uniform1fv = loadProc("glUniform1fv"); - api->IsFramebuffer = loadProc("glIsFramebuffer"); - api->ValidateProgram = loadProc("glValidateProgram"); - api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); - api->ReadnPixels = mg_glReadnPixels_noimpl; - api->VertexAttribP2ui = loadProc("glVertexAttribP2ui"); - api->ProgramUniform2i = loadProc("glProgramUniform2i"); - api->PatchParameteri = loadProc("glPatchParameteri"); - api->VertexAttrib4Nub = loadProc("glVertexAttrib4Nub"); - api->GenQueries = loadProc("glGenQueries"); - api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); - api->BindSamplers = loadProc("glBindSamplers"); - api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); - api->Enablei = loadProc("glEnablei"); - api->GetSynciv = loadProc("glGetSynciv"); - api->VertexAttrib3s = loadProc("glVertexAttrib3s"); - api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); - api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); - api->DepthRangef = loadProc("glDepthRangef"); - api->VertexAttrib4Nuiv = loadProc("glVertexAttrib4Nuiv"); - api->Finish = loadProc("glFinish"); - api->BlendFunc = loadProc("glBlendFunc"); - api->DrawTransformFeedbackStreamInstanced = loadProc("glDrawTransformFeedbackStreamInstanced"); - api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); - api->UniformMatrix4x2dv = loadProc("glUniformMatrix4x2dv"); - api->Uniform2d = loadProc("glUniform2d"); - api->GetnUniformfv = mg_glGetnUniformfv_noimpl; - api->GetFloati_v = loadProc("glGetFloati_v"); - api->GetInteger64i_v = loadProc("glGetInteger64i_v"); - api->ProgramUniform3f = loadProc("glProgramUniform3f"); - api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); - api->VertexAttribI4bv = loadProc("glVertexAttribI4bv"); - api->DeleteProgram = loadProc("glDeleteProgram"); - api->CopyTexImage2D = loadProc("glCopyTexImage2D"); - api->GetUniformuiv = loadProc("glGetUniformuiv"); - api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); - api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); - api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); - api->Uniform2i = loadProc("glUniform2i"); - api->ProgramUniform3dv = loadProc("glProgramUniform3dv"); - api->ScissorIndexedv = loadProc("glScissorIndexedv"); - api->ProgramUniform2d = loadProc("glProgramUniform2d"); - api->VertexAttrib4f = loadProc("glVertexAttrib4f"); - api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); - api->GetUniformdv = loadProc("glGetUniformdv"); - api->DrawRangeElements = loadProc("glDrawRangeElements"); - api->UniformMatrix3dv = loadProc("glUniformMatrix3dv"); - api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); - api->VertexAttribI1uiv = loadProc("glVertexAttribI1uiv"); - api->BeginQueryIndexed = loadProc("glBeginQueryIndexed"); - api->PointParameterfv = loadProc("glPointParameterfv"); - api->SampleCoverage = loadProc("glSampleCoverage"); - api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); - api->ReadPixels = loadProc("glReadPixels"); - api->LinkProgram = loadProc("glLinkProgram"); - api->WaitSync = loadProc("glWaitSync"); - api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); - api->GetQueryObjectiv = loadProc("glGetQueryObjectiv"); - api->ProgramUniform3i = loadProc("glProgramUniform3i"); - api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); - api->BlendBarrier = mg_glBlendBarrier_noimpl; - api->VertexAttribI4ubv = loadProc("glVertexAttribI4ubv"); - api->GetQueryObjecti64v = loadProc("glGetQueryObjecti64v"); - api->UniformMatrix4dv = loadProc("glUniformMatrix4dv"); - api->Uniform1iv = loadProc("glUniform1iv"); - api->Enable = loadProc("glEnable"); - api->GenBuffers = loadProc("glGenBuffers"); - api->TexStorage3D = loadProc("glTexStorage3D"); - api->InvalidateTexSubImage = loadProc("glInvalidateTexSubImage"); - api->ProgramUniform1i = loadProc("glProgramUniform1i"); - api->BlendEquation = loadProc("glBlendEquation"); - api->DepthRange = loadProc("glDepthRange"); - api->Uniform2dv = loadProc("glUniform2dv"); - api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); - api->Uniform1dv = loadProc("glUniform1dv"); - api->EndQueryIndexed = loadProc("glEndQueryIndexed"); - api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); - api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); - api->DepthFunc = loadProc("glDepthFunc"); - api->InvalidateBufferData = loadProc("glInvalidateBufferData"); - api->BindImageTextures = loadProc("glBindImageTextures"); - api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); - api->VertexAttribI2iv = loadProc("glVertexAttribI2iv"); - api->VertexAttrib4sv = loadProc("glVertexAttrib4sv"); - api->VertexAttribFormat = loadProc("glVertexAttribFormat"); - api->MapBufferRange = loadProc("glMapBufferRange"); - api->DetachShader = loadProc("glDetachShader"); - api->GetBooleani_v = loadProc("glGetBooleani_v"); - api->DepthRangeIndexed = loadProc("glDepthRangeIndexed"); - api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); - api->VertexAttribL3dv = loadProc("glVertexAttribL3dv"); - api->PrimitiveRestartIndex = loadProc("glPrimitiveRestartIndex"); - api->Uniform4d = loadProc("glUniform4d"); - api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); - api->DeleteBuffers = loadProc("glDeleteBuffers"); - api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); - api->Uniform4f = loadProc("glUniform4f"); - api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); - api->VertexAttribP4ui = loadProc("glVertexAttribP4ui"); - api->IsRenderbuffer = loadProc("glIsRenderbuffer"); - api->VertexAttrib4Nbv = loadProc("glVertexAttrib4Nbv"); - api->VertexAttrib4Nsv = loadProc("glVertexAttrib4Nsv"); - api->CullFace = loadProc("glCullFace"); - api->MultiDrawElementsBaseVertex = loadProc("glMultiDrawElementsBaseVertex"); - api->VertexAttribI3ui = loadProc("glVertexAttribI3ui"); - api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); - api->UseProgramStages = loadProc("glUseProgramStages"); - api->GetActiveAttrib = loadProc("glGetActiveAttrib"); - api->DrawArraysInstancedBaseInstance = loadProc("glDrawArraysInstancedBaseInstance"); - api->IsProgramPipeline = loadProc("glIsProgramPipeline"); - api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); - api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); - api->ReadBuffer = loadProc("glReadBuffer"); - api->DeleteShader = loadProc("glDeleteShader"); - api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); - api->ClientWaitSync = loadProc("glClientWaitSync"); - api->CompressedTexImage1D = loadProc("glCompressedTexImage1D"); - api->VertexAttrib2d = loadProc("glVertexAttrib2d"); - api->VertexAttrib3dv = loadProc("glVertexAttrib3dv"); - api->VertexAttribI4i = loadProc("glVertexAttribI4i"); - api->VertexAttribL2dv = loadProc("glVertexAttribL2dv"); - api->GetDoublei_v = loadProc("glGetDoublei_v"); - api->TexParameterfv = loadProc("glTexParameterfv"); - api->GetAttribLocation = loadProc("glGetAttribLocation"); - api->VertexAttribP1ui = loadProc("glVertexAttribP1ui"); - api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); - api->VertexAttribI1ui = loadProc("glVertexAttribI1ui"); - api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); - api->GetActiveSubroutineName = loadProc("glGetActiveSubroutineName"); - api->IsQuery = loadProc("glIsQuery"); - api->VertexAttrib1sv = loadProc("glVertexAttrib1sv"); - api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); - api->UseProgram = loadProc("glUseProgram"); - api->Clear = loadProc("glClear"); - api->VertexAttrib4ubv = loadProc("glVertexAttrib4ubv"); - api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); - api->PixelStorei = loadProc("glPixelStorei"); - api->Uniform1i = loadProc("glUniform1i"); - api->Uniform1uiv = loadProc("glUniform1uiv"); - api->TexImage3DMultisample = loadProc("glTexImage3DMultisample"); - api->BindBuffer = loadProc("glBindBuffer"); - api->ActiveTexture = loadProc("glActiveTexture"); - api->DeleteSync = loadProc("glDeleteSync"); - api->VertexAttrib4Niv = loadProc("glVertexAttrib4Niv"); - api->VertexAttrib4uiv = loadProc("glVertexAttrib4uiv"); - api->Uniform3fv = loadProc("glUniform3fv"); - api->GenVertexArrays = loadProc("glGenVertexArrays"); - api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); - api->BindAttribLocation = loadProc("glBindAttribLocation"); - api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); - api->BlendColor = loadProc("glBlendColor"); - api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); - api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); - api->IsShader = loadProc("glIsShader"); - api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); - api->VertexAttribLFormat = loadProc("glVertexAttribLFormat"); - api->BindBuffersRange = loadProc("glBindBuffersRange"); - api->ColorMask = loadProc("glColorMask"); - api->UniformMatrix2x4dv = loadProc("glUniformMatrix2x4dv"); - api->GetDoublev = loadProc("glGetDoublev"); - api->UniformMatrix3x2dv = loadProc("glUniformMatrix3x2dv"); - api->VertexAttribL2d = loadProc("glVertexAttribL2d"); - api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); - api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); - api->PointParameteriv = loadProc("glPointParameteriv"); - api->UniformSubroutinesuiv = loadProc("glUniformSubroutinesuiv"); - api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); - api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); - api->GetTexImage = loadProc("glGetTexImage"); - api->ProgramUniformMatrix2x4dv = loadProc("glProgramUniformMatrix2x4dv"); - api->VertexAttribI1iv = loadProc("glVertexAttribI1iv"); - api->IsSampler = loadProc("glIsSampler"); - api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); - api->TexStorage1D = loadProc("glTexStorage1D"); - api->ViewportArrayv = loadProc("glViewportArrayv"); - api->TexImage3D = loadProc("glTexImage3D"); - api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); - api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); - api->GetVertexAttribdv = loadProc("glGetVertexAttribdv"); - api->InvalidateBufferSubData = loadProc("glInvalidateBufferSubData"); - api->ProgramUniform4f = loadProc("glProgramUniform4f"); - api->VertexAttrib2s = loadProc("glVertexAttrib2s"); - api->TexSubImage3D = loadProc("glTexSubImage3D"); - api->GetFragDataLocation = loadProc("glGetFragDataLocation"); - api->VertexAttribI1i = loadProc("glVertexAttribI1i"); - api->GetActiveAtomicCounterBufferiv = loadProc("glGetActiveAtomicCounterBufferiv"); - api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); - api->BindBuffersBase = loadProc("glBindBuffersBase"); - api->GetUniformSubroutineuiv = loadProc("glGetUniformSubroutineuiv"); - api->EndTransformFeedback = loadProc("glEndTransformFeedback"); - api->ShaderSource = loadProc("glShaderSource"); - api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); - api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); - api->Uniform3d = loadProc("glUniform3d"); - api->ClearBufferfv = loadProc("glClearBufferfv"); - api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); - api->MemoryBarrierByRegion = mg_glMemoryBarrierByRegion_noimpl; - api->GenProgramPipelines = loadProc("glGenProgramPipelines"); - api->BindFragDataLocation = loadProc("glBindFragDataLocation"); - api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); - api->TextureView = loadProc("glTextureView"); - api->IsEnabled = loadProc("glIsEnabled"); - api->PatchParameterfv = loadProc("glPatchParameterfv"); - api->Hint = loadProc("glHint"); - api->PixelStoref = loadProc("glPixelStoref"); - api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); - api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); - api->ClearBufferuiv = loadProc("glClearBufferuiv"); - api->ObjectLabel = loadProc("glObjectLabel"); - api->GetPointerv = loadProc("glGetPointerv"); - api->DeleteSamplers = loadProc("glDeleteSamplers"); - api->ProgramUniform2dv = loadProc("glProgramUniform2dv"); - api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); - api->ClampColor = loadProc("glClampColor"); - api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); - api->GetnUniformiv = mg_glGetnUniformiv_noimpl; - api->Uniform3iv = loadProc("glUniform3iv"); - api->VertexAttribI3uiv = loadProc("glVertexAttribI3uiv"); - api->BufferSubData = loadProc("glBufferSubData"); - api->SamplerParameterfv = loadProc("glSamplerParameterfv"); - api->VertexAttribI4sv = loadProc("glVertexAttribI4sv"); - api->TexBuffer = loadProc("glTexBuffer"); - api->CreateProgram = loadProc("glCreateProgram"); - api->BindBufferRange = loadProc("glBindBufferRange"); - api->IsTexture = loadProc("glIsTexture"); - api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); - api->DrawElements = loadProc("glDrawElements"); - api->ProgramUniform1f = loadProc("glProgramUniform1f"); - api->Uniform3dv = loadProc("glUniform3dv"); - api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); - api->GenerateMipmap = loadProc("glGenerateMipmap"); - api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); - api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); - api->ClearDepth = loadProc("glClearDepth"); - api->DrawTransformFeedback = loadProc("glDrawTransformFeedback"); - api->TexSubImage2D = loadProc("glTexSubImage2D"); - api->VertexAttribP4uiv = loadProc("glVertexAttribP4uiv"); - api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); - api->PointSize = loadProc("glPointSize"); - api->GetCompressedTexImage = loadProc("glGetCompressedTexImage"); - api->Uniform2uiv = loadProc("glUniform2uiv"); - api->FenceSync = loadProc("glFenceSync"); - api->MapBuffer = loadProc("glMapBuffer"); - api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); - api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); - api->TexParameteri = loadProc("glTexParameteri"); - api->GetTexParameterfv = loadProc("glGetTexParameterfv"); - api->VertexAttribL1d = loadProc("glVertexAttribL1d"); - api->VertexAttrib4Nusv = loadProc("glVertexAttrib4Nusv"); - api->ProgramUniform2f = loadProc("glProgramUniform2f"); - api->VertexAttrib1d = loadProc("glVertexAttrib1d"); - api->GetError = loadProc("glGetError"); - api->VertexAttribP2uiv = loadProc("glVertexAttribP2uiv"); - api->UniformMatrix4x3dv = loadProc("glUniformMatrix4x3dv"); - api->GetShaderSource = loadProc("glGetShaderSource"); - api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); - api->FramebufferTexture = loadProc("glFramebufferTexture"); - api->ProgramUniformMatrix4x3dv = loadProc("glProgramUniformMatrix4x3dv"); - api->Uniform4dv = loadProc("glUniform4dv"); - api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); - api->ProgramUniformMatrix3x4dv = loadProc("glProgramUniformMatrix3x4dv"); - api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); - api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); - api->DrawElementsInstancedBaseInstance = loadProc("glDrawElementsInstancedBaseInstance"); - api->BindBufferBase = loadProc("glBindBufferBase"); - api->UniformMatrix2dv = loadProc("glUniformMatrix2dv"); - api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); - api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); - api->GetUniformIndices = loadProc("glGetUniformIndices"); - api->TexStorage2D = loadProc("glTexStorage2D"); - api->VertexAttrib4usv = loadProc("glVertexAttrib4usv"); - api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); - api->CopyImageSubData = loadProc("glCopyImageSubData"); - api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); - api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); - api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); - api->BindVertexBuffers = loadProc("glBindVertexBuffers"); - api->ProvokingVertex = loadProc("glProvokingVertex"); - api->Uniform3uiv = loadProc("glUniform3uiv"); - api->IsVertexArray = loadProc("glIsVertexArray"); - api->ViewportIndexedfv = loadProc("glViewportIndexedfv"); - api->DispatchCompute = loadProc("glDispatchCompute"); - api->DrawArrays = loadProc("glDrawArrays"); - api->GetQueryIndexediv = loadProc("glGetQueryIndexediv"); - api->Uniform3ui = loadProc("glUniform3ui"); - api->MultiDrawElements = loadProc("glMultiDrawElements"); - api->ClearBufferfi = loadProc("glClearBufferfi"); - api->ProgramUniformMatrix2dv = loadProc("glProgramUniformMatrix2dv"); - api->VertexAttribP3ui = loadProc("glVertexAttribP3ui"); - api->VertexAttribI3iv = loadProc("glVertexAttribI3iv"); - api->ProgramParameteri = loadProc("glProgramParameteri"); - api->Uniform4uiv = loadProc("glUniform4uiv"); - api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); - api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); - api->GetGraphicsResetStatus = mg_glGetGraphicsResetStatus_noimpl; - api->ShaderBinary = loadProc("glShaderBinary"); - api->ShaderStorageBlockBinding = loadProc("glShaderStorageBlockBinding"); - api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); - api->GetSubroutineIndex = loadProc("glGetSubroutineIndex"); - api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); - api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); - api->GetProgramResourceName = loadProc("glGetProgramResourceName"); - api->GetInternalformativ = loadProc("glGetInternalformativ"); - api->Uniform4fv = loadProc("glUniform4fv"); - api->VertexAttribLPointer = loadProc("glVertexAttribLPointer"); - api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); - api->VertexAttrib3d = loadProc("glVertexAttrib3d"); - api->SamplerParameterf = loadProc("glSamplerParameterf"); - api->GenFramebuffers = loadProc("glGenFramebuffers"); - api->GetQueryObjectui64v = loadProc("glGetQueryObjectui64v"); - api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); - api->VertexAttribP3uiv = loadProc("glVertexAttribP3uiv"); - api->VertexAttrib4dv = loadProc("glVertexAttrib4dv"); - api->IsTransformFeedback = loadProc("glIsTransformFeedback"); - api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); - api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); - api->BindVertexBuffer = loadProc("glBindVertexBuffer"); - api->ProgramUniform1dv = loadProc("glProgramUniform1dv"); - api->StencilOp = loadProc("glStencilOp"); - api->VertexAttrib1s = loadProc("glVertexAttrib1s"); - api->GetMultisamplefv = loadProc("glGetMultisamplefv"); - api->GetQueryiv = loadProc("glGetQueryiv"); - api->BindProgramPipeline = loadProc("glBindProgramPipeline"); - api->FramebufferParameteri = loadProc("glFramebufferParameteri"); - api->GetIntegeri_v = loadProc("glGetIntegeri_v"); - api->GetIntegerv = loadProc("glGetIntegerv"); - api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); - api->ClearBufferData = loadProc("glClearBufferData"); - api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); - api->GetSubroutineUniformLocation = loadProc("glGetSubroutineUniformLocation"); - api->GetProgramiv = loadProc("glGetProgramiv"); - api->DepthMask = loadProc("glDepthMask"); - api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); - api->GetActiveUniformName = loadProc("glGetActiveUniformName"); - api->VertexAttribP1uiv = loadProc("glVertexAttribP1uiv"); - api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); - api->GetUniformLocation = loadProc("glGetUniformLocation"); - api->SampleMaski = loadProc("glSampleMaski"); - api->GetBufferSubData = loadProc("glGetBufferSubData"); - api->Uniform4iv = loadProc("glUniform4iv"); - api->VertexAttribPointer = loadProc("glVertexAttribPointer"); - api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); - api->GetnUniformuiv = mg_glGetnUniformuiv_noimpl; - api->GetInternalformati64v = loadProc("glGetInternalformati64v"); - api->CompileShader = loadProc("glCompileShader"); - api->DrawBuffer = loadProc("glDrawBuffer"); - api->Uniform3f = loadProc("glUniform3f"); - api->DrawTransformFeedbackInstanced = loadProc("glDrawTransformFeedbackInstanced"); - api->ProgramUniform4dv = loadProc("glProgramUniform4dv"); - api->GetProgramStageiv = loadProc("glGetProgramStageiv"); - api->StencilFunc = loadProc("glStencilFunc"); - api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); - api->ClearStencil = loadProc("glClearStencil"); - api->ScissorArrayv = loadProc("glScissorArrayv"); - api->MemoryBarrier = loadProc("glMemoryBarrier"); - api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); - api->GetFloatv = loadProc("glGetFloatv"); - api->BindFragDataLocationIndexed = loadProc("glBindFragDataLocationIndexed"); - api->EndQuery = loadProc("glEndQuery"); - api->VertexAttrib4Nubv = loadProc("glVertexAttrib4Nubv"); - api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); - api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); - api->Uniform3i = loadProc("glUniform3i"); - api->Uniform2ui = loadProc("glUniform2ui"); - api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); - api->GetDebugMessageLog = loadProc("glGetDebugMessageLog"); -} - -void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc) -{ - api->name = "gles31"; - api->GetProgramBinary = loadProc("glGetProgramBinary"); - api->FrontFace = loadProc("glFrontFace"); - api->Disablei = mg_glDisablei_noimpl; - api->BeginConditionalRender = mg_glBeginConditionalRender_noimpl; - api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); - api->CompressedTexSubImage1D = mg_glCompressedTexSubImage1D_noimpl; - api->VertexAttribI4usv = mg_glVertexAttribI4usv_noimpl; - api->VertexAttrib2sv = mg_glVertexAttrib2sv_noimpl; - api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); - api->MultiDrawArraysIndirect = mg_glMultiDrawArraysIndirect_noimpl; - api->ColorMaski = mg_glColorMaski_noimpl; - api->BindVertexArray = loadProc("glBindVertexArray"); - api->ProgramUniform3d = mg_glProgramUniform3d_noimpl; - api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); - api->Uniform4i = loadProc("glUniform4i"); - api->GetAttachedShaders = loadProc("glGetAttachedShaders"); - api->AttachShader = loadProc("glAttachShader"); - api->VertexAttribI2ui = mg_glVertexAttribI2ui_noimpl; - api->ClearColor = loadProc("glClearColor"); - api->TexParameterIiv = mg_glTexParameterIiv_noimpl; - api->ProgramUniform4d = mg_glProgramUniform4d_noimpl; - api->DrawTransformFeedbackStream = mg_glDrawTransformFeedbackStream_noimpl; - api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); - api->CopyBufferSubData = loadProc("glCopyBufferSubData"); - api->DebugMessageInsert = mg_glDebugMessageInsert_noimpl; - api->ViewportIndexedf = mg_glViewportIndexedf_noimpl; - api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); - api->ObjectPtrLabel = mg_glObjectPtrLabel_noimpl; - api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); - api->UniformMatrix3x4dv = mg_glUniformMatrix3x4dv_noimpl; - api->FramebufferTexture1D = mg_glFramebufferTexture1D_noimpl; - api->Viewport = loadProc("glViewport"); - api->GenTextures = loadProc("glGenTextures"); - api->UniformBlockBinding = loadProc("glUniformBlockBinding"); - api->VertexAttrib3sv = mg_glVertexAttrib3sv_noimpl; - api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); - api->VertexAttrib2f = loadProc("glVertexAttrib2f"); - api->GetActiveUniform = loadProc("glGetActiveUniform"); - api->ScissorIndexed = mg_glScissorIndexed_noimpl; - api->TexParameterf = loadProc("glTexParameterf"); - api->BindSampler = loadProc("glBindSampler"); - api->MultiDrawElementsIndirect = mg_glMultiDrawElementsIndirect_noimpl; - api->ClearTexSubImage = mg_glClearTexSubImage_noimpl; - api->IsEnabledi = mg_glIsEnabledi_noimpl; - api->Scissor = loadProc("glScissor"); - api->ProgramBinary = loadProc("glProgramBinary"); - api->Disable = loadProc("glDisable"); - api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); - api->DrawRangeElementsBaseVertex = mg_glDrawRangeElementsBaseVertex_noimpl; - api->DebugMessageCallback = mg_glDebugMessageCallback_noimpl; - api->BlendEquationi = mg_glBlendEquationi_noimpl; - api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); - api->BlendFunci = mg_glBlendFunci_noimpl; - api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); - api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); - api->GenRenderbuffers = loadProc("glGenRenderbuffers"); - api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); - api->Uniform1ui = loadProc("glUniform1ui"); - api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); - api->VertexAttrib4bv = mg_glVertexAttrib4bv_noimpl; - api->GetProgramResourceLocationIndex = mg_glGetProgramResourceLocationIndex_noimpl; - api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); - api->PolygonOffset = loadProc("glPolygonOffset"); - api->IsProgram = loadProc("glIsProgram"); - api->ClearDepthf = loadProc("glClearDepthf"); - api->EndConditionalRender = mg_glEndConditionalRender_noimpl; - api->GetObjectLabel = mg_glGetObjectLabel_noimpl; - api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); - api->VertexAttribI3i = mg_glVertexAttribI3i_noimpl; - api->GenSamplers = loadProc("glGenSamplers"); - api->VertexAttribI2uiv = mg_glVertexAttribI2uiv_noimpl; - api->StencilOpSeparate = loadProc("glStencilOpSeparate"); - api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); - api->GetObjectPtrLabel = mg_glGetObjectPtrLabel_noimpl; - api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); - api->GetInteger64v = loadProc("glGetInteger64v"); - api->GetString = loadProc("glGetString"); - api->IsSync = loadProc("glIsSync"); - api->CopyTexImage1D = mg_glCopyTexImage1D_noimpl; - api->SamplerParameterIiv = mg_glSamplerParameterIiv_noimpl; - api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); - api->BeginQuery = loadProc("glBeginQuery"); - api->GetBufferPointerv = loadProc("glGetBufferPointerv"); - api->BlitFramebuffer = loadProc("glBlitFramebuffer"); - api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); - api->PointParameteri = mg_glPointParameteri_noimpl; - api->PolygonMode = mg_glPolygonMode_noimpl; - api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); - api->TexImage2DMultisample = mg_glTexImage2DMultisample_noimpl; - api->VertexAttribL3d = mg_glVertexAttribL3d_noimpl; - api->ProgramUniform4i = loadProc("glProgramUniform4i"); - api->GetUniformfv = loadProc("glGetUniformfv"); - api->DebugMessageControl = mg_glDebugMessageControl_noimpl; - api->TexParameteriv = loadProc("glTexParameteriv"); - api->IsBuffer = loadProc("glIsBuffer"); - api->ProgramUniformMatrix3dv = mg_glProgramUniformMatrix3dv_noimpl; - api->BindFramebuffer = loadProc("glBindFramebuffer"); - api->BufferStorage = mg_glBufferStorage_noimpl; - api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); - api->BindTextures = mg_glBindTextures_noimpl; - api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); - api->ProgramUniformMatrix4x2dv = mg_glProgramUniformMatrix4x2dv_noimpl; - api->PushDebugGroup = mg_glPushDebugGroup_noimpl; - api->SamplerParameteriv = loadProc("glSamplerParameteriv"); - api->VertexAttribI2i = mg_glVertexAttribI2i_noimpl; - api->BindTransformFeedback = loadProc("glBindTransformFeedback"); - api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); - api->Uniform2fv = loadProc("glUniform2fv"); - api->VertexAttrib1dv = mg_glVertexAttrib1dv_noimpl; - api->SamplerParameteri = loadProc("glSamplerParameteri"); - api->TexBufferRange = mg_glTexBufferRange_noimpl; - api->GetShaderiv = loadProc("glGetShaderiv"); - api->StencilMask = loadProc("glStencilMask"); - api->VertexAttrib3f = loadProc("glVertexAttrib3f"); - api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); - api->DeleteQueries = loadProc("glDeleteQueries"); - api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); - api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); - api->Uniform1f = loadProc("glUniform1f"); - api->TexSubImage1D = mg_glTexSubImage1D_noimpl; - api->ClearBufferiv = loadProc("glClearBufferiv"); - api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); - api->InvalidateTexImage = mg_glInvalidateTexImage_noimpl; - api->ClearBufferSubData = mg_glClearBufferSubData_noimpl; - api->ClearTexImage = mg_glClearTexImage_noimpl; - api->VertexAttrib4d = mg_glVertexAttrib4d_noimpl; - api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); - api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); - api->Uniform2f = loadProc("glUniform2f"); - api->VertexAttribL4d = mg_glVertexAttribL4d_noimpl; - api->TexImage2D = loadProc("glTexImage2D"); - api->LogicOp = mg_glLogicOp_noimpl; - api->BindTexture = loadProc("glBindTexture"); - api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); - api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); - api->GetFragDataIndex = mg_glGetFragDataIndex_noimpl; - api->UniformMatrix2x3dv = mg_glUniformMatrix2x3dv_noimpl; - api->GetVertexAttribLdv = mg_glGetVertexAttribLdv_noimpl; - api->BindRenderbuffer = loadProc("glBindRenderbuffer"); - api->Uniform1d = mg_glUniform1d_noimpl; - api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); - api->MinSampleShading = mg_glMinSampleShading_noimpl; - api->CopyTexSubImage1D = mg_glCopyTexSubImage1D_noimpl; - api->TexImage1D = mg_glTexImage1D_noimpl; - api->VertexAttrib1f = loadProc("glVertexAttrib1f"); - api->LineWidth = loadProc("glLineWidth"); - api->PointParameterf = mg_glPointParameterf_noimpl; - api->DrawElementsInstancedBaseVertexBaseInstance = mg_glDrawElementsInstancedBaseVertexBaseInstance_noimpl; - api->GetActiveSubroutineUniformiv = mg_glGetActiveSubroutineUniformiv_noimpl; - api->Uniform4ui = loadProc("glUniform4ui"); - api->VertexAttribBinding = loadProc("glVertexAttribBinding"); - api->GetTexParameteriv = loadProc("glGetTexParameteriv"); - api->RenderbufferStorage = loadProc("glRenderbufferStorage"); - api->VertexAttrib4iv = mg_glVertexAttrib4iv_noimpl; - api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); - api->GetBooleanv = loadProc("glGetBooleanv"); - api->ProgramUniformMatrix2x3dv = mg_glProgramUniformMatrix2x3dv_noimpl; - api->ProgramUniformMatrix4dv = mg_glProgramUniformMatrix4dv_noimpl; - api->Uniform2iv = loadProc("glUniform2iv"); - api->BufferData = loadProc("glBufferData"); - api->GetActiveSubroutineUniformName = mg_glGetActiveSubroutineUniformName_noimpl; - api->GetStringi = loadProc("glGetStringi"); - api->BindImageTexture = loadProc("glBindImageTexture"); - api->ProgramUniformMatrix3x2dv = mg_glProgramUniformMatrix3x2dv_noimpl; - api->VertexAttribL4dv = mg_glVertexAttribL4dv_noimpl; - api->TexStorage3DMultisample = mg_glTexStorage3DMultisample_noimpl; - api->DepthRangeArrayv = mg_glDepthRangeArrayv_noimpl; - api->GetUniformiv = loadProc("glGetUniformiv"); - api->DeleteTextures = loadProc("glDeleteTextures"); - api->CreateShader = loadProc("glCreateShader"); - api->VertexAttrib4s = mg_glVertexAttrib4s_noimpl; - api->PrimitiveBoundingBox = mg_glPrimitiveBoundingBox_noimpl; - api->DrawBuffers = loadProc("glDrawBuffers"); - api->VertexAttrib2dv = mg_glVertexAttrib2dv_noimpl; - api->TexParameterIuiv = mg_glTexParameterIuiv_noimpl; - api->QueryCounter = mg_glQueryCounter_noimpl; - api->VertexAttribL1dv = mg_glVertexAttribL1dv_noimpl; - api->ProgramUniform1d = mg_glProgramUniform1d_noimpl; - api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); - api->PopDebugGroup = mg_glPopDebugGroup_noimpl; - api->MultiDrawArrays = mg_glMultiDrawArrays_noimpl; - api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); - api->Flush = loadProc("glFlush"); - api->UnmapBuffer = loadProc("glUnmapBuffer"); - api->FramebufferTexture3D = mg_glFramebufferTexture3D_noimpl; - api->Uniform1fv = loadProc("glUniform1fv"); - api->IsFramebuffer = loadProc("glIsFramebuffer"); - api->ValidateProgram = loadProc("glValidateProgram"); - api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); - api->ReadnPixels = mg_glReadnPixels_noimpl; - api->VertexAttribP2ui = mg_glVertexAttribP2ui_noimpl; - api->ProgramUniform2i = loadProc("glProgramUniform2i"); - api->PatchParameteri = mg_glPatchParameteri_noimpl; - api->VertexAttrib4Nub = mg_glVertexAttrib4Nub_noimpl; - api->GenQueries = loadProc("glGenQueries"); - api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); - api->BindSamplers = mg_glBindSamplers_noimpl; - api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); - api->Enablei = mg_glEnablei_noimpl; - api->GetSynciv = loadProc("glGetSynciv"); - api->VertexAttrib3s = mg_glVertexAttrib3s_noimpl; - api->GetTexParameterIiv = mg_glGetTexParameterIiv_noimpl; - api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); - api->DepthRangef = loadProc("glDepthRangef"); - api->VertexAttrib4Nuiv = mg_glVertexAttrib4Nuiv_noimpl; - api->Finish = loadProc("glFinish"); - api->BlendFunc = loadProc("glBlendFunc"); - api->DrawTransformFeedbackStreamInstanced = mg_glDrawTransformFeedbackStreamInstanced_noimpl; - api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); - api->UniformMatrix4x2dv = mg_glUniformMatrix4x2dv_noimpl; - api->Uniform2d = mg_glUniform2d_noimpl; - api->GetnUniformfv = mg_glGetnUniformfv_noimpl; - api->GetFloati_v = mg_glGetFloati_v_noimpl; - api->GetInteger64i_v = loadProc("glGetInteger64i_v"); - api->ProgramUniform3f = loadProc("glProgramUniform3f"); - api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); - api->VertexAttribI4bv = mg_glVertexAttribI4bv_noimpl; - api->DeleteProgram = loadProc("glDeleteProgram"); - api->CopyTexImage2D = loadProc("glCopyTexImage2D"); - api->GetUniformuiv = loadProc("glGetUniformuiv"); - api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); - api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); - api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); - api->Uniform2i = loadProc("glUniform2i"); - api->ProgramUniform3dv = mg_glProgramUniform3dv_noimpl; - api->ScissorIndexedv = mg_glScissorIndexedv_noimpl; - api->ProgramUniform2d = mg_glProgramUniform2d_noimpl; - api->VertexAttrib4f = loadProc("glVertexAttrib4f"); - api->BlendEquationSeparatei = mg_glBlendEquationSeparatei_noimpl; - api->GetUniformdv = mg_glGetUniformdv_noimpl; - api->DrawRangeElements = loadProc("glDrawRangeElements"); - api->UniformMatrix3dv = mg_glUniformMatrix3dv_noimpl; - api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); - api->VertexAttribI1uiv = mg_glVertexAttribI1uiv_noimpl; - api->BeginQueryIndexed = mg_glBeginQueryIndexed_noimpl; - api->PointParameterfv = mg_glPointParameterfv_noimpl; - api->SampleCoverage = loadProc("glSampleCoverage"); - api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); - api->ReadPixels = loadProc("glReadPixels"); - api->LinkProgram = loadProc("glLinkProgram"); - api->WaitSync = loadProc("glWaitSync"); - api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); - api->GetQueryObjectiv = mg_glGetQueryObjectiv_noimpl; - api->ProgramUniform3i = loadProc("glProgramUniform3i"); - api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); - api->BlendBarrier = mg_glBlendBarrier_noimpl; - api->VertexAttribI4ubv = mg_glVertexAttribI4ubv_noimpl; - api->GetQueryObjecti64v = mg_glGetQueryObjecti64v_noimpl; - api->UniformMatrix4dv = mg_glUniformMatrix4dv_noimpl; - api->Uniform1iv = loadProc("glUniform1iv"); - api->Enable = loadProc("glEnable"); - api->GenBuffers = loadProc("glGenBuffers"); - api->TexStorage3D = loadProc("glTexStorage3D"); - api->InvalidateTexSubImage = mg_glInvalidateTexSubImage_noimpl; - api->ProgramUniform1i = loadProc("glProgramUniform1i"); - api->BlendEquation = loadProc("glBlendEquation"); - api->DepthRange = mg_glDepthRange_noimpl; - api->Uniform2dv = mg_glUniform2dv_noimpl; - api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); - api->Uniform1dv = mg_glUniform1dv_noimpl; - api->EndQueryIndexed = mg_glEndQueryIndexed_noimpl; - api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); - api->BlendFuncSeparatei = mg_glBlendFuncSeparatei_noimpl; - api->DepthFunc = loadProc("glDepthFunc"); - api->InvalidateBufferData = mg_glInvalidateBufferData_noimpl; - api->BindImageTextures = mg_glBindImageTextures_noimpl; - api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); - api->VertexAttribI2iv = mg_glVertexAttribI2iv_noimpl; - api->VertexAttrib4sv = mg_glVertexAttrib4sv_noimpl; - api->VertexAttribFormat = loadProc("glVertexAttribFormat"); - api->MapBufferRange = loadProc("glMapBufferRange"); - api->DetachShader = loadProc("glDetachShader"); - api->GetBooleani_v = loadProc("glGetBooleani_v"); - api->DepthRangeIndexed = mg_glDepthRangeIndexed_noimpl; - api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); - api->VertexAttribL3dv = mg_glVertexAttribL3dv_noimpl; - api->PrimitiveRestartIndex = mg_glPrimitiveRestartIndex_noimpl; - api->Uniform4d = mg_glUniform4d_noimpl; - api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); - api->DeleteBuffers = loadProc("glDeleteBuffers"); - api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); - api->Uniform4f = loadProc("glUniform4f"); - api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); - api->VertexAttribP4ui = mg_glVertexAttribP4ui_noimpl; - api->IsRenderbuffer = loadProc("glIsRenderbuffer"); - api->VertexAttrib4Nbv = mg_glVertexAttrib4Nbv_noimpl; - api->VertexAttrib4Nsv = mg_glVertexAttrib4Nsv_noimpl; - api->CullFace = loadProc("glCullFace"); - api->MultiDrawElementsBaseVertex = mg_glMultiDrawElementsBaseVertex_noimpl; - api->VertexAttribI3ui = mg_glVertexAttribI3ui_noimpl; - api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); - api->UseProgramStages = loadProc("glUseProgramStages"); - api->GetActiveAttrib = loadProc("glGetActiveAttrib"); - api->DrawArraysInstancedBaseInstance = mg_glDrawArraysInstancedBaseInstance_noimpl; - api->IsProgramPipeline = loadProc("glIsProgramPipeline"); - api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); - api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); - api->ReadBuffer = loadProc("glReadBuffer"); - api->DeleteShader = loadProc("glDeleteShader"); - api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); - api->ClientWaitSync = loadProc("glClientWaitSync"); - api->CompressedTexImage1D = mg_glCompressedTexImage1D_noimpl; - api->VertexAttrib2d = mg_glVertexAttrib2d_noimpl; - api->VertexAttrib3dv = mg_glVertexAttrib3dv_noimpl; - api->VertexAttribI4i = loadProc("glVertexAttribI4i"); - api->VertexAttribL2dv = mg_glVertexAttribL2dv_noimpl; - api->GetDoublei_v = mg_glGetDoublei_v_noimpl; - api->TexParameterfv = loadProc("glTexParameterfv"); - api->GetAttribLocation = loadProc("glGetAttribLocation"); - api->VertexAttribP1ui = mg_glVertexAttribP1ui_noimpl; - api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); - api->VertexAttribI1ui = mg_glVertexAttribI1ui_noimpl; - api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); - api->GetActiveSubroutineName = mg_glGetActiveSubroutineName_noimpl; - api->IsQuery = loadProc("glIsQuery"); - api->VertexAttrib1sv = mg_glVertexAttrib1sv_noimpl; - api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); - api->UseProgram = loadProc("glUseProgram"); - api->Clear = loadProc("glClear"); - api->VertexAttrib4ubv = mg_glVertexAttrib4ubv_noimpl; - api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); - api->PixelStorei = loadProc("glPixelStorei"); - api->Uniform1i = loadProc("glUniform1i"); - api->Uniform1uiv = loadProc("glUniform1uiv"); - api->TexImage3DMultisample = mg_glTexImage3DMultisample_noimpl; - api->BindBuffer = loadProc("glBindBuffer"); - api->ActiveTexture = loadProc("glActiveTexture"); - api->DeleteSync = loadProc("glDeleteSync"); - api->VertexAttrib4Niv = mg_glVertexAttrib4Niv_noimpl; - api->VertexAttrib4uiv = mg_glVertexAttrib4uiv_noimpl; - api->Uniform3fv = loadProc("glUniform3fv"); - api->GenVertexArrays = loadProc("glGenVertexArrays"); - api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); - api->BindAttribLocation = loadProc("glBindAttribLocation"); - api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); - api->BlendColor = loadProc("glBlendColor"); - api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); - api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); - api->IsShader = loadProc("glIsShader"); - api->DrawElementsInstancedBaseVertex = mg_glDrawElementsInstancedBaseVertex_noimpl; - api->VertexAttribLFormat = mg_glVertexAttribLFormat_noimpl; - api->BindBuffersRange = mg_glBindBuffersRange_noimpl; - api->ColorMask = loadProc("glColorMask"); - api->UniformMatrix2x4dv = mg_glUniformMatrix2x4dv_noimpl; - api->GetDoublev = mg_glGetDoublev_noimpl; - api->UniformMatrix3x2dv = mg_glUniformMatrix3x2dv_noimpl; - api->VertexAttribL2d = mg_glVertexAttribL2d_noimpl; - api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); - api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); - api->PointParameteriv = mg_glPointParameteriv_noimpl; - api->UniformSubroutinesuiv = mg_glUniformSubroutinesuiv_noimpl; - api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); - api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); - api->GetTexImage = mg_glGetTexImage_noimpl; - api->ProgramUniformMatrix2x4dv = mg_glProgramUniformMatrix2x4dv_noimpl; - api->VertexAttribI1iv = mg_glVertexAttribI1iv_noimpl; - api->IsSampler = loadProc("glIsSampler"); - api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); - api->TexStorage1D = mg_glTexStorage1D_noimpl; - api->ViewportArrayv = mg_glViewportArrayv_noimpl; - api->TexImage3D = loadProc("glTexImage3D"); - api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); - api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); - api->GetVertexAttribdv = mg_glGetVertexAttribdv_noimpl; - api->InvalidateBufferSubData = mg_glInvalidateBufferSubData_noimpl; - api->ProgramUniform4f = loadProc("glProgramUniform4f"); - api->VertexAttrib2s = mg_glVertexAttrib2s_noimpl; - api->TexSubImage3D = loadProc("glTexSubImage3D"); - api->GetFragDataLocation = loadProc("glGetFragDataLocation"); - api->VertexAttribI1i = mg_glVertexAttribI1i_noimpl; - api->GetActiveAtomicCounterBufferiv = mg_glGetActiveAtomicCounterBufferiv_noimpl; - api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); - api->BindBuffersBase = mg_glBindBuffersBase_noimpl; - api->GetUniformSubroutineuiv = mg_glGetUniformSubroutineuiv_noimpl; - api->EndTransformFeedback = loadProc("glEndTransformFeedback"); - api->ShaderSource = loadProc("glShaderSource"); - api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); - api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); - api->Uniform3d = mg_glUniform3d_noimpl; - api->ClearBufferfv = loadProc("glClearBufferfv"); - api->GetSamplerParameterIiv = mg_glGetSamplerParameterIiv_noimpl; - api->MemoryBarrierByRegion = loadProc("glMemoryBarrierByRegion"); - api->GenProgramPipelines = loadProc("glGenProgramPipelines"); - api->BindFragDataLocation = mg_glBindFragDataLocation_noimpl; - api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); - api->TextureView = mg_glTextureView_noimpl; - api->IsEnabled = loadProc("glIsEnabled"); - api->PatchParameterfv = mg_glPatchParameterfv_noimpl; - api->Hint = loadProc("glHint"); - api->PixelStoref = mg_glPixelStoref_noimpl; - api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); - api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); - api->ClearBufferuiv = loadProc("glClearBufferuiv"); - api->ObjectLabel = mg_glObjectLabel_noimpl; - api->GetPointerv = mg_glGetPointerv_noimpl; - api->DeleteSamplers = loadProc("glDeleteSamplers"); - api->ProgramUniform2dv = mg_glProgramUniform2dv_noimpl; - api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); - api->ClampColor = mg_glClampColor_noimpl; - api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); - api->GetnUniformiv = mg_glGetnUniformiv_noimpl; - api->Uniform3iv = loadProc("glUniform3iv"); - api->VertexAttribI3uiv = mg_glVertexAttribI3uiv_noimpl; - api->BufferSubData = loadProc("glBufferSubData"); - api->SamplerParameterfv = loadProc("glSamplerParameterfv"); - api->VertexAttribI4sv = mg_glVertexAttribI4sv_noimpl; - api->TexBuffer = mg_glTexBuffer_noimpl; - api->CreateProgram = loadProc("glCreateProgram"); - api->BindBufferRange = loadProc("glBindBufferRange"); - api->IsTexture = loadProc("glIsTexture"); - api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); - api->DrawElements = loadProc("glDrawElements"); - api->ProgramUniform1f = loadProc("glProgramUniform1f"); - api->Uniform3dv = mg_glUniform3dv_noimpl; - api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); - api->GenerateMipmap = loadProc("glGenerateMipmap"); - api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); - api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); - api->ClearDepth = mg_glClearDepth_noimpl; - api->DrawTransformFeedback = mg_glDrawTransformFeedback_noimpl; - api->TexSubImage2D = loadProc("glTexSubImage2D"); - api->VertexAttribP4uiv = mg_glVertexAttribP4uiv_noimpl; - api->GetTexParameterIuiv = mg_glGetTexParameterIuiv_noimpl; - api->PointSize = mg_glPointSize_noimpl; - api->GetCompressedTexImage = mg_glGetCompressedTexImage_noimpl; - api->Uniform2uiv = loadProc("glUniform2uiv"); - api->FenceSync = loadProc("glFenceSync"); - api->MapBuffer = mg_glMapBuffer_noimpl; - api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); - api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); - api->TexParameteri = loadProc("glTexParameteri"); - api->GetTexParameterfv = loadProc("glGetTexParameterfv"); - api->VertexAttribL1d = mg_glVertexAttribL1d_noimpl; - api->VertexAttrib4Nusv = mg_glVertexAttrib4Nusv_noimpl; - api->ProgramUniform2f = loadProc("glProgramUniform2f"); - api->VertexAttrib1d = mg_glVertexAttrib1d_noimpl; - api->GetError = loadProc("glGetError"); - api->VertexAttribP2uiv = mg_glVertexAttribP2uiv_noimpl; - api->UniformMatrix4x3dv = mg_glUniformMatrix4x3dv_noimpl; - api->GetShaderSource = loadProc("glGetShaderSource"); - api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); - api->FramebufferTexture = mg_glFramebufferTexture_noimpl; - api->ProgramUniformMatrix4x3dv = mg_glProgramUniformMatrix4x3dv_noimpl; - api->Uniform4dv = mg_glUniform4dv_noimpl; - api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); - api->ProgramUniformMatrix3x4dv = mg_glProgramUniformMatrix3x4dv_noimpl; - api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); - api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); - api->DrawElementsInstancedBaseInstance = mg_glDrawElementsInstancedBaseInstance_noimpl; - api->BindBufferBase = loadProc("glBindBufferBase"); - api->UniformMatrix2dv = mg_glUniformMatrix2dv_noimpl; - api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); - api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); - api->GetUniformIndices = loadProc("glGetUniformIndices"); - api->TexStorage2D = loadProc("glTexStorage2D"); - api->VertexAttrib4usv = mg_glVertexAttrib4usv_noimpl; - api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); - api->CopyImageSubData = mg_glCopyImageSubData_noimpl; - api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); - api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); - api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); - api->BindVertexBuffers = mg_glBindVertexBuffers_noimpl; - api->ProvokingVertex = mg_glProvokingVertex_noimpl; - api->Uniform3uiv = loadProc("glUniform3uiv"); - api->IsVertexArray = loadProc("glIsVertexArray"); - api->ViewportIndexedfv = mg_glViewportIndexedfv_noimpl; - api->DispatchCompute = loadProc("glDispatchCompute"); - api->DrawArrays = loadProc("glDrawArrays"); - api->GetQueryIndexediv = mg_glGetQueryIndexediv_noimpl; - api->Uniform3ui = loadProc("glUniform3ui"); - api->MultiDrawElements = mg_glMultiDrawElements_noimpl; - api->ClearBufferfi = loadProc("glClearBufferfi"); - api->ProgramUniformMatrix2dv = mg_glProgramUniformMatrix2dv_noimpl; - api->VertexAttribP3ui = mg_glVertexAttribP3ui_noimpl; - api->VertexAttribI3iv = mg_glVertexAttribI3iv_noimpl; - api->ProgramParameteri = loadProc("glProgramParameteri"); - api->Uniform4uiv = loadProc("glUniform4uiv"); - api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); - api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); - api->GetGraphicsResetStatus = mg_glGetGraphicsResetStatus_noimpl; - api->ShaderBinary = loadProc("glShaderBinary"); - api->ShaderStorageBlockBinding = mg_glShaderStorageBlockBinding_noimpl; - api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); - api->GetSubroutineIndex = mg_glGetSubroutineIndex_noimpl; - api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); - api->DrawElementsBaseVertex = mg_glDrawElementsBaseVertex_noimpl; - api->GetProgramResourceName = loadProc("glGetProgramResourceName"); - api->GetInternalformativ = loadProc("glGetInternalformativ"); - api->Uniform4fv = loadProc("glUniform4fv"); - api->VertexAttribLPointer = mg_glVertexAttribLPointer_noimpl; - api->GetSamplerParameterIuiv = mg_glGetSamplerParameterIuiv_noimpl; - api->VertexAttrib3d = mg_glVertexAttrib3d_noimpl; - api->SamplerParameterf = loadProc("glSamplerParameterf"); - api->GenFramebuffers = loadProc("glGenFramebuffers"); - api->GetQueryObjectui64v = mg_glGetQueryObjectui64v_noimpl; - api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); - api->VertexAttribP3uiv = mg_glVertexAttribP3uiv_noimpl; - api->VertexAttrib4dv = mg_glVertexAttrib4dv_noimpl; - api->IsTransformFeedback = loadProc("glIsTransformFeedback"); - api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); - api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); - api->BindVertexBuffer = loadProc("glBindVertexBuffer"); - api->ProgramUniform1dv = mg_glProgramUniform1dv_noimpl; - api->StencilOp = loadProc("glStencilOp"); - api->VertexAttrib1s = mg_glVertexAttrib1s_noimpl; - api->GetMultisamplefv = loadProc("glGetMultisamplefv"); - api->GetQueryiv = loadProc("glGetQueryiv"); - api->BindProgramPipeline = loadProc("glBindProgramPipeline"); - api->FramebufferParameteri = loadProc("glFramebufferParameteri"); - api->GetIntegeri_v = loadProc("glGetIntegeri_v"); - api->GetIntegerv = loadProc("glGetIntegerv"); - api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); - api->ClearBufferData = mg_glClearBufferData_noimpl; - api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); - api->GetSubroutineUniformLocation = mg_glGetSubroutineUniformLocation_noimpl; - api->GetProgramiv = loadProc("glGetProgramiv"); - api->DepthMask = loadProc("glDepthMask"); - api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); - api->GetActiveUniformName = mg_glGetActiveUniformName_noimpl; - api->VertexAttribP1uiv = mg_glVertexAttribP1uiv_noimpl; - api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); - api->GetUniformLocation = loadProc("glGetUniformLocation"); - api->SampleMaski = loadProc("glSampleMaski"); - api->GetBufferSubData = mg_glGetBufferSubData_noimpl; - api->Uniform4iv = loadProc("glUniform4iv"); - api->VertexAttribPointer = loadProc("glVertexAttribPointer"); - api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); - api->GetnUniformuiv = mg_glGetnUniformuiv_noimpl; - api->GetInternalformati64v = mg_glGetInternalformati64v_noimpl; - api->CompileShader = loadProc("glCompileShader"); - api->DrawBuffer = mg_glDrawBuffer_noimpl; - api->Uniform3f = loadProc("glUniform3f"); - api->DrawTransformFeedbackInstanced = mg_glDrawTransformFeedbackInstanced_noimpl; - api->ProgramUniform4dv = mg_glProgramUniform4dv_noimpl; - api->GetProgramStageiv = mg_glGetProgramStageiv_noimpl; - api->StencilFunc = loadProc("glStencilFunc"); - api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); - api->ClearStencil = loadProc("glClearStencil"); - api->ScissorArrayv = mg_glScissorArrayv_noimpl; - api->MemoryBarrier = loadProc("glMemoryBarrier"); - api->SamplerParameterIuiv = mg_glSamplerParameterIuiv_noimpl; - api->GetFloatv = loadProc("glGetFloatv"); - api->BindFragDataLocationIndexed = mg_glBindFragDataLocationIndexed_noimpl; - api->EndQuery = loadProc("glEndQuery"); - api->VertexAttrib4Nubv = mg_glVertexAttrib4Nubv_noimpl; - api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); - api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); - api->Uniform3i = loadProc("glUniform3i"); - api->Uniform2ui = loadProc("glUniform2ui"); - api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); - api->GetDebugMessageLog = mg_glGetDebugMessageLog_noimpl; -} - -void mg_gl_load_gles32(mg_gl_api* api, mg_gl_load_proc loadProc) -{ - api->name = "gles32"; - api->GetProgramBinary = loadProc("glGetProgramBinary"); - api->FrontFace = loadProc("glFrontFace"); - api->Disablei = loadProc("glDisablei"); - api->BeginConditionalRender = mg_glBeginConditionalRender_noimpl; - api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); - api->CompressedTexSubImage1D = mg_glCompressedTexSubImage1D_noimpl; - api->VertexAttribI4usv = mg_glVertexAttribI4usv_noimpl; - api->VertexAttrib2sv = mg_glVertexAttrib2sv_noimpl; - api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); - api->MultiDrawArraysIndirect = mg_glMultiDrawArraysIndirect_noimpl; - api->ColorMaski = loadProc("glColorMaski"); - api->BindVertexArray = loadProc("glBindVertexArray"); - api->ProgramUniform3d = mg_glProgramUniform3d_noimpl; - api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); - api->Uniform4i = loadProc("glUniform4i"); - api->GetAttachedShaders = loadProc("glGetAttachedShaders"); - api->AttachShader = loadProc("glAttachShader"); - api->VertexAttribI2ui = mg_glVertexAttribI2ui_noimpl; - api->ClearColor = loadProc("glClearColor"); - api->TexParameterIiv = loadProc("glTexParameterIiv"); - api->ProgramUniform4d = mg_glProgramUniform4d_noimpl; - api->DrawTransformFeedbackStream = mg_glDrawTransformFeedbackStream_noimpl; - api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); - api->CopyBufferSubData = loadProc("glCopyBufferSubData"); - api->DebugMessageInsert = loadProc("glDebugMessageInsert"); - api->ViewportIndexedf = mg_glViewportIndexedf_noimpl; - api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); - api->ObjectPtrLabel = loadProc("glObjectPtrLabel"); - api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); - api->UniformMatrix3x4dv = mg_glUniformMatrix3x4dv_noimpl; - api->FramebufferTexture1D = mg_glFramebufferTexture1D_noimpl; - api->Viewport = loadProc("glViewport"); - api->GenTextures = loadProc("glGenTextures"); - api->UniformBlockBinding = loadProc("glUniformBlockBinding"); - api->VertexAttrib3sv = mg_glVertexAttrib3sv_noimpl; - api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); - api->VertexAttrib2f = loadProc("glVertexAttrib2f"); - api->GetActiveUniform = loadProc("glGetActiveUniform"); - api->ScissorIndexed = mg_glScissorIndexed_noimpl; - api->TexParameterf = loadProc("glTexParameterf"); - api->BindSampler = loadProc("glBindSampler"); - api->MultiDrawElementsIndirect = mg_glMultiDrawElementsIndirect_noimpl; - api->ClearTexSubImage = mg_glClearTexSubImage_noimpl; - api->IsEnabledi = loadProc("glIsEnabledi"); - api->Scissor = loadProc("glScissor"); - api->ProgramBinary = loadProc("glProgramBinary"); - api->Disable = loadProc("glDisable"); - api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); - api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); - api->DebugMessageCallback = loadProc("glDebugMessageCallback"); - api->BlendEquationi = loadProc("glBlendEquationi"); - api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); - api->BlendFunci = loadProc("glBlendFunci"); - api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); - api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); - api->GenRenderbuffers = loadProc("glGenRenderbuffers"); - api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); - api->Uniform1ui = loadProc("glUniform1ui"); - api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); - api->VertexAttrib4bv = mg_glVertexAttrib4bv_noimpl; - api->GetProgramResourceLocationIndex = mg_glGetProgramResourceLocationIndex_noimpl; - api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); - api->PolygonOffset = loadProc("glPolygonOffset"); - api->IsProgram = loadProc("glIsProgram"); - api->ClearDepthf = loadProc("glClearDepthf"); - api->EndConditionalRender = mg_glEndConditionalRender_noimpl; - api->GetObjectLabel = loadProc("glGetObjectLabel"); - api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); - api->VertexAttribI3i = mg_glVertexAttribI3i_noimpl; - api->GenSamplers = loadProc("glGenSamplers"); - api->VertexAttribI2uiv = mg_glVertexAttribI2uiv_noimpl; - api->StencilOpSeparate = loadProc("glStencilOpSeparate"); - api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); - api->GetObjectPtrLabel = loadProc("glGetObjectPtrLabel"); - api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); - api->GetInteger64v = loadProc("glGetInteger64v"); - api->GetString = loadProc("glGetString"); - api->IsSync = loadProc("glIsSync"); - api->CopyTexImage1D = mg_glCopyTexImage1D_noimpl; - api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); - api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); - api->BeginQuery = loadProc("glBeginQuery"); - api->GetBufferPointerv = loadProc("glGetBufferPointerv"); - api->BlitFramebuffer = loadProc("glBlitFramebuffer"); - api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); - api->PointParameteri = mg_glPointParameteri_noimpl; - api->PolygonMode = mg_glPolygonMode_noimpl; - api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); - api->TexImage2DMultisample = mg_glTexImage2DMultisample_noimpl; - api->VertexAttribL3d = mg_glVertexAttribL3d_noimpl; - api->ProgramUniform4i = loadProc("glProgramUniform4i"); - api->GetUniformfv = loadProc("glGetUniformfv"); - api->DebugMessageControl = loadProc("glDebugMessageControl"); - api->TexParameteriv = loadProc("glTexParameteriv"); - api->IsBuffer = loadProc("glIsBuffer"); - api->ProgramUniformMatrix3dv = mg_glProgramUniformMatrix3dv_noimpl; - api->BindFramebuffer = loadProc("glBindFramebuffer"); - api->BufferStorage = mg_glBufferStorage_noimpl; - api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); - api->BindTextures = mg_glBindTextures_noimpl; - api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); - api->ProgramUniformMatrix4x2dv = mg_glProgramUniformMatrix4x2dv_noimpl; - api->PushDebugGroup = loadProc("glPushDebugGroup"); - api->SamplerParameteriv = loadProc("glSamplerParameteriv"); - api->VertexAttribI2i = mg_glVertexAttribI2i_noimpl; - api->BindTransformFeedback = loadProc("glBindTransformFeedback"); - api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); - api->Uniform2fv = loadProc("glUniform2fv"); - api->VertexAttrib1dv = mg_glVertexAttrib1dv_noimpl; - api->SamplerParameteri = loadProc("glSamplerParameteri"); - api->TexBufferRange = loadProc("glTexBufferRange"); - api->GetShaderiv = loadProc("glGetShaderiv"); - api->StencilMask = loadProc("glStencilMask"); - api->VertexAttrib3f = loadProc("glVertexAttrib3f"); - api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); - api->DeleteQueries = loadProc("glDeleteQueries"); - api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); - api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); - api->Uniform1f = loadProc("glUniform1f"); - api->TexSubImage1D = mg_glTexSubImage1D_noimpl; - api->ClearBufferiv = loadProc("glClearBufferiv"); - api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); - api->InvalidateTexImage = mg_glInvalidateTexImage_noimpl; - api->ClearBufferSubData = mg_glClearBufferSubData_noimpl; - api->ClearTexImage = mg_glClearTexImage_noimpl; - api->VertexAttrib4d = mg_glVertexAttrib4d_noimpl; - api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); - api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); - api->Uniform2f = loadProc("glUniform2f"); - api->VertexAttribL4d = mg_glVertexAttribL4d_noimpl; - api->TexImage2D = loadProc("glTexImage2D"); - api->LogicOp = mg_glLogicOp_noimpl; - api->BindTexture = loadProc("glBindTexture"); - api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); - api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); - api->GetFragDataIndex = mg_glGetFragDataIndex_noimpl; - api->UniformMatrix2x3dv = mg_glUniformMatrix2x3dv_noimpl; - api->GetVertexAttribLdv = mg_glGetVertexAttribLdv_noimpl; - api->BindRenderbuffer = loadProc("glBindRenderbuffer"); - api->Uniform1d = mg_glUniform1d_noimpl; - api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); - api->MinSampleShading = loadProc("glMinSampleShading"); - api->CopyTexSubImage1D = mg_glCopyTexSubImage1D_noimpl; - api->TexImage1D = mg_glTexImage1D_noimpl; - api->VertexAttrib1f = loadProc("glVertexAttrib1f"); - api->LineWidth = loadProc("glLineWidth"); - api->PointParameterf = mg_glPointParameterf_noimpl; - api->DrawElementsInstancedBaseVertexBaseInstance = mg_glDrawElementsInstancedBaseVertexBaseInstance_noimpl; - api->GetActiveSubroutineUniformiv = mg_glGetActiveSubroutineUniformiv_noimpl; - api->Uniform4ui = loadProc("glUniform4ui"); - api->VertexAttribBinding = loadProc("glVertexAttribBinding"); - api->GetTexParameteriv = loadProc("glGetTexParameteriv"); - api->RenderbufferStorage = loadProc("glRenderbufferStorage"); - api->VertexAttrib4iv = mg_glVertexAttrib4iv_noimpl; - api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); - api->GetBooleanv = loadProc("glGetBooleanv"); - api->ProgramUniformMatrix2x3dv = mg_glProgramUniformMatrix2x3dv_noimpl; - api->ProgramUniformMatrix4dv = mg_glProgramUniformMatrix4dv_noimpl; - api->Uniform2iv = loadProc("glUniform2iv"); - api->BufferData = loadProc("glBufferData"); - api->GetActiveSubroutineUniformName = mg_glGetActiveSubroutineUniformName_noimpl; - api->GetStringi = loadProc("glGetStringi"); - api->BindImageTexture = loadProc("glBindImageTexture"); - api->ProgramUniformMatrix3x2dv = mg_glProgramUniformMatrix3x2dv_noimpl; - api->VertexAttribL4dv = mg_glVertexAttribL4dv_noimpl; - api->TexStorage3DMultisample = loadProc("glTexStorage3DMultisample"); - api->DepthRangeArrayv = mg_glDepthRangeArrayv_noimpl; - api->GetUniformiv = loadProc("glGetUniformiv"); - api->DeleteTextures = loadProc("glDeleteTextures"); - api->CreateShader = loadProc("glCreateShader"); - api->VertexAttrib4s = mg_glVertexAttrib4s_noimpl; - api->PrimitiveBoundingBox = loadProc("glPrimitiveBoundingBox"); - api->DrawBuffers = loadProc("glDrawBuffers"); - api->VertexAttrib2dv = mg_glVertexAttrib2dv_noimpl; - api->TexParameterIuiv = loadProc("glTexParameterIuiv"); - api->QueryCounter = mg_glQueryCounter_noimpl; - api->VertexAttribL1dv = mg_glVertexAttribL1dv_noimpl; - api->ProgramUniform1d = mg_glProgramUniform1d_noimpl; - api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); - api->PopDebugGroup = loadProc("glPopDebugGroup"); - api->MultiDrawArrays = mg_glMultiDrawArrays_noimpl; - api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); - api->Flush = loadProc("glFlush"); - api->UnmapBuffer = loadProc("glUnmapBuffer"); - api->FramebufferTexture3D = mg_glFramebufferTexture3D_noimpl; - api->Uniform1fv = loadProc("glUniform1fv"); - api->IsFramebuffer = loadProc("glIsFramebuffer"); - api->ValidateProgram = loadProc("glValidateProgram"); - api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); - api->ReadnPixels = loadProc("glReadnPixels"); - api->VertexAttribP2ui = mg_glVertexAttribP2ui_noimpl; - api->ProgramUniform2i = loadProc("glProgramUniform2i"); - api->PatchParameteri = loadProc("glPatchParameteri"); - api->VertexAttrib4Nub = mg_glVertexAttrib4Nub_noimpl; - api->GenQueries = loadProc("glGenQueries"); - api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); - api->BindSamplers = mg_glBindSamplers_noimpl; - api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); - api->Enablei = loadProc("glEnablei"); - api->GetSynciv = loadProc("glGetSynciv"); - api->VertexAttrib3s = mg_glVertexAttrib3s_noimpl; - api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); - api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); - api->DepthRangef = loadProc("glDepthRangef"); - api->VertexAttrib4Nuiv = mg_glVertexAttrib4Nuiv_noimpl; - api->Finish = loadProc("glFinish"); - api->BlendFunc = loadProc("glBlendFunc"); - api->DrawTransformFeedbackStreamInstanced = mg_glDrawTransformFeedbackStreamInstanced_noimpl; - api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); - api->UniformMatrix4x2dv = mg_glUniformMatrix4x2dv_noimpl; - api->Uniform2d = mg_glUniform2d_noimpl; - api->GetnUniformfv = loadProc("glGetnUniformfv"); - api->GetFloati_v = mg_glGetFloati_v_noimpl; - api->GetInteger64i_v = loadProc("glGetInteger64i_v"); - api->ProgramUniform3f = loadProc("glProgramUniform3f"); - api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); - api->VertexAttribI4bv = mg_glVertexAttribI4bv_noimpl; - api->DeleteProgram = loadProc("glDeleteProgram"); - api->CopyTexImage2D = loadProc("glCopyTexImage2D"); - api->GetUniformuiv = loadProc("glGetUniformuiv"); - api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); - api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); - api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); - api->Uniform2i = loadProc("glUniform2i"); - api->ProgramUniform3dv = mg_glProgramUniform3dv_noimpl; - api->ScissorIndexedv = mg_glScissorIndexedv_noimpl; - api->ProgramUniform2d = mg_glProgramUniform2d_noimpl; - api->VertexAttrib4f = loadProc("glVertexAttrib4f"); - api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); - api->GetUniformdv = mg_glGetUniformdv_noimpl; - api->DrawRangeElements = loadProc("glDrawRangeElements"); - api->UniformMatrix3dv = mg_glUniformMatrix3dv_noimpl; - api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); - api->VertexAttribI1uiv = mg_glVertexAttribI1uiv_noimpl; - api->BeginQueryIndexed = mg_glBeginQueryIndexed_noimpl; - api->PointParameterfv = mg_glPointParameterfv_noimpl; - api->SampleCoverage = loadProc("glSampleCoverage"); - api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); - api->ReadPixels = loadProc("glReadPixels"); - api->LinkProgram = loadProc("glLinkProgram"); - api->WaitSync = loadProc("glWaitSync"); - api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); - api->GetQueryObjectiv = mg_glGetQueryObjectiv_noimpl; - api->ProgramUniform3i = loadProc("glProgramUniform3i"); - api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); - api->BlendBarrier = loadProc("glBlendBarrier"); - api->VertexAttribI4ubv = mg_glVertexAttribI4ubv_noimpl; - api->GetQueryObjecti64v = mg_glGetQueryObjecti64v_noimpl; - api->UniformMatrix4dv = mg_glUniformMatrix4dv_noimpl; - api->Uniform1iv = loadProc("glUniform1iv"); - api->Enable = loadProc("glEnable"); - api->GenBuffers = loadProc("glGenBuffers"); - api->TexStorage3D = loadProc("glTexStorage3D"); - api->InvalidateTexSubImage = mg_glInvalidateTexSubImage_noimpl; - api->ProgramUniform1i = loadProc("glProgramUniform1i"); - api->BlendEquation = loadProc("glBlendEquation"); - api->DepthRange = mg_glDepthRange_noimpl; - api->Uniform2dv = mg_glUniform2dv_noimpl; - api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); - api->Uniform1dv = mg_glUniform1dv_noimpl; - api->EndQueryIndexed = mg_glEndQueryIndexed_noimpl; - api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); - api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); - api->DepthFunc = loadProc("glDepthFunc"); - api->InvalidateBufferData = mg_glInvalidateBufferData_noimpl; - api->BindImageTextures = mg_glBindImageTextures_noimpl; - api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); - api->VertexAttribI2iv = mg_glVertexAttribI2iv_noimpl; - api->VertexAttrib4sv = mg_glVertexAttrib4sv_noimpl; - api->VertexAttribFormat = loadProc("glVertexAttribFormat"); - api->MapBufferRange = loadProc("glMapBufferRange"); - api->DetachShader = loadProc("glDetachShader"); - api->GetBooleani_v = loadProc("glGetBooleani_v"); - api->DepthRangeIndexed = mg_glDepthRangeIndexed_noimpl; - api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); - api->VertexAttribL3dv = mg_glVertexAttribL3dv_noimpl; - api->PrimitiveRestartIndex = mg_glPrimitiveRestartIndex_noimpl; - api->Uniform4d = mg_glUniform4d_noimpl; - api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); - api->DeleteBuffers = loadProc("glDeleteBuffers"); - api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); - api->Uniform4f = loadProc("glUniform4f"); - api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); - api->VertexAttribP4ui = mg_glVertexAttribP4ui_noimpl; - api->IsRenderbuffer = loadProc("glIsRenderbuffer"); - api->VertexAttrib4Nbv = mg_glVertexAttrib4Nbv_noimpl; - api->VertexAttrib4Nsv = mg_glVertexAttrib4Nsv_noimpl; - api->CullFace = loadProc("glCullFace"); - api->MultiDrawElementsBaseVertex = mg_glMultiDrawElementsBaseVertex_noimpl; - api->VertexAttribI3ui = mg_glVertexAttribI3ui_noimpl; - api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); - api->UseProgramStages = loadProc("glUseProgramStages"); - api->GetActiveAttrib = loadProc("glGetActiveAttrib"); - api->DrawArraysInstancedBaseInstance = mg_glDrawArraysInstancedBaseInstance_noimpl; - api->IsProgramPipeline = loadProc("glIsProgramPipeline"); - api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); - api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); - api->ReadBuffer = loadProc("glReadBuffer"); - api->DeleteShader = loadProc("glDeleteShader"); - api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); - api->ClientWaitSync = loadProc("glClientWaitSync"); - api->CompressedTexImage1D = mg_glCompressedTexImage1D_noimpl; - api->VertexAttrib2d = mg_glVertexAttrib2d_noimpl; - api->VertexAttrib3dv = mg_glVertexAttrib3dv_noimpl; - api->VertexAttribI4i = loadProc("glVertexAttribI4i"); - api->VertexAttribL2dv = mg_glVertexAttribL2dv_noimpl; - api->GetDoublei_v = mg_glGetDoublei_v_noimpl; - api->TexParameterfv = loadProc("glTexParameterfv"); - api->GetAttribLocation = loadProc("glGetAttribLocation"); - api->VertexAttribP1ui = mg_glVertexAttribP1ui_noimpl; - api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); - api->VertexAttribI1ui = mg_glVertexAttribI1ui_noimpl; - api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); - api->GetActiveSubroutineName = mg_glGetActiveSubroutineName_noimpl; - api->IsQuery = loadProc("glIsQuery"); - api->VertexAttrib1sv = mg_glVertexAttrib1sv_noimpl; - api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); - api->UseProgram = loadProc("glUseProgram"); - api->Clear = loadProc("glClear"); - api->VertexAttrib4ubv = mg_glVertexAttrib4ubv_noimpl; - api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); - api->PixelStorei = loadProc("glPixelStorei"); - api->Uniform1i = loadProc("glUniform1i"); - api->Uniform1uiv = loadProc("glUniform1uiv"); - api->TexImage3DMultisample = mg_glTexImage3DMultisample_noimpl; - api->BindBuffer = loadProc("glBindBuffer"); - api->ActiveTexture = loadProc("glActiveTexture"); - api->DeleteSync = loadProc("glDeleteSync"); - api->VertexAttrib4Niv = mg_glVertexAttrib4Niv_noimpl; - api->VertexAttrib4uiv = mg_glVertexAttrib4uiv_noimpl; - api->Uniform3fv = loadProc("glUniform3fv"); - api->GenVertexArrays = loadProc("glGenVertexArrays"); - api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); - api->BindAttribLocation = loadProc("glBindAttribLocation"); - api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); - api->BlendColor = loadProc("glBlendColor"); - api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); - api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); - api->IsShader = loadProc("glIsShader"); - api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); - api->VertexAttribLFormat = mg_glVertexAttribLFormat_noimpl; - api->BindBuffersRange = mg_glBindBuffersRange_noimpl; - api->ColorMask = loadProc("glColorMask"); - api->UniformMatrix2x4dv = mg_glUniformMatrix2x4dv_noimpl; - api->GetDoublev = mg_glGetDoublev_noimpl; - api->UniformMatrix3x2dv = mg_glUniformMatrix3x2dv_noimpl; - api->VertexAttribL2d = mg_glVertexAttribL2d_noimpl; - api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); - api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); - api->PointParameteriv = mg_glPointParameteriv_noimpl; - api->UniformSubroutinesuiv = mg_glUniformSubroutinesuiv_noimpl; - api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); - api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); - api->GetTexImage = mg_glGetTexImage_noimpl; - api->ProgramUniformMatrix2x4dv = mg_glProgramUniformMatrix2x4dv_noimpl; - api->VertexAttribI1iv = mg_glVertexAttribI1iv_noimpl; - api->IsSampler = loadProc("glIsSampler"); - api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); - api->TexStorage1D = mg_glTexStorage1D_noimpl; - api->ViewportArrayv = mg_glViewportArrayv_noimpl; - api->TexImage3D = loadProc("glTexImage3D"); - api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); - api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); - api->GetVertexAttribdv = mg_glGetVertexAttribdv_noimpl; - api->InvalidateBufferSubData = mg_glInvalidateBufferSubData_noimpl; - api->ProgramUniform4f = loadProc("glProgramUniform4f"); - api->VertexAttrib2s = mg_glVertexAttrib2s_noimpl; - api->TexSubImage3D = loadProc("glTexSubImage3D"); - api->GetFragDataLocation = loadProc("glGetFragDataLocation"); - api->VertexAttribI1i = mg_glVertexAttribI1i_noimpl; - api->GetActiveAtomicCounterBufferiv = mg_glGetActiveAtomicCounterBufferiv_noimpl; - api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); - api->BindBuffersBase = mg_glBindBuffersBase_noimpl; - api->GetUniformSubroutineuiv = mg_glGetUniformSubroutineuiv_noimpl; - api->EndTransformFeedback = loadProc("glEndTransformFeedback"); - api->ShaderSource = loadProc("glShaderSource"); - api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); - api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); - api->Uniform3d = mg_glUniform3d_noimpl; - api->ClearBufferfv = loadProc("glClearBufferfv"); - api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); - api->MemoryBarrierByRegion = loadProc("glMemoryBarrierByRegion"); - api->GenProgramPipelines = loadProc("glGenProgramPipelines"); - api->BindFragDataLocation = mg_glBindFragDataLocation_noimpl; - api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); - api->TextureView = mg_glTextureView_noimpl; - api->IsEnabled = loadProc("glIsEnabled"); - api->PatchParameterfv = mg_glPatchParameterfv_noimpl; - api->Hint = loadProc("glHint"); - api->PixelStoref = mg_glPixelStoref_noimpl; - api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); - api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); - api->ClearBufferuiv = loadProc("glClearBufferuiv"); - api->ObjectLabel = loadProc("glObjectLabel"); - api->GetPointerv = loadProc("glGetPointerv"); - api->DeleteSamplers = loadProc("glDeleteSamplers"); - api->ProgramUniform2dv = mg_glProgramUniform2dv_noimpl; - api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); - api->ClampColor = mg_glClampColor_noimpl; - api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); - api->GetnUniformiv = loadProc("glGetnUniformiv"); - api->Uniform3iv = loadProc("glUniform3iv"); - api->VertexAttribI3uiv = mg_glVertexAttribI3uiv_noimpl; - api->BufferSubData = loadProc("glBufferSubData"); - api->SamplerParameterfv = loadProc("glSamplerParameterfv"); - api->VertexAttribI4sv = mg_glVertexAttribI4sv_noimpl; - api->TexBuffer = loadProc("glTexBuffer"); - api->CreateProgram = loadProc("glCreateProgram"); - api->BindBufferRange = loadProc("glBindBufferRange"); - api->IsTexture = loadProc("glIsTexture"); - api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); - api->DrawElements = loadProc("glDrawElements"); - api->ProgramUniform1f = loadProc("glProgramUniform1f"); - api->Uniform3dv = mg_glUniform3dv_noimpl; - api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); - api->GenerateMipmap = loadProc("glGenerateMipmap"); - api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); - api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); - api->ClearDepth = mg_glClearDepth_noimpl; - api->DrawTransformFeedback = mg_glDrawTransformFeedback_noimpl; - api->TexSubImage2D = loadProc("glTexSubImage2D"); - api->VertexAttribP4uiv = mg_glVertexAttribP4uiv_noimpl; - api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); - api->PointSize = mg_glPointSize_noimpl; - api->GetCompressedTexImage = mg_glGetCompressedTexImage_noimpl; - api->Uniform2uiv = loadProc("glUniform2uiv"); - api->FenceSync = loadProc("glFenceSync"); - api->MapBuffer = mg_glMapBuffer_noimpl; - api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); - api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); - api->TexParameteri = loadProc("glTexParameteri"); - api->GetTexParameterfv = loadProc("glGetTexParameterfv"); - api->VertexAttribL1d = mg_glVertexAttribL1d_noimpl; - api->VertexAttrib4Nusv = mg_glVertexAttrib4Nusv_noimpl; - api->ProgramUniform2f = loadProc("glProgramUniform2f"); - api->VertexAttrib1d = mg_glVertexAttrib1d_noimpl; - api->GetError = loadProc("glGetError"); - api->VertexAttribP2uiv = mg_glVertexAttribP2uiv_noimpl; - api->UniformMatrix4x3dv = mg_glUniformMatrix4x3dv_noimpl; - api->GetShaderSource = loadProc("glGetShaderSource"); - api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); - api->FramebufferTexture = loadProc("glFramebufferTexture"); - api->ProgramUniformMatrix4x3dv = mg_glProgramUniformMatrix4x3dv_noimpl; - api->Uniform4dv = mg_glUniform4dv_noimpl; - api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); - api->ProgramUniformMatrix3x4dv = mg_glProgramUniformMatrix3x4dv_noimpl; - api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); - api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); - api->DrawElementsInstancedBaseInstance = mg_glDrawElementsInstancedBaseInstance_noimpl; - api->BindBufferBase = loadProc("glBindBufferBase"); - api->UniformMatrix2dv = mg_glUniformMatrix2dv_noimpl; - api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); - api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); - api->GetUniformIndices = loadProc("glGetUniformIndices"); - api->TexStorage2D = loadProc("glTexStorage2D"); - api->VertexAttrib4usv = mg_glVertexAttrib4usv_noimpl; - api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); - api->CopyImageSubData = loadProc("glCopyImageSubData"); - api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); - api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); - api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); - api->BindVertexBuffers = mg_glBindVertexBuffers_noimpl; - api->ProvokingVertex = mg_glProvokingVertex_noimpl; - api->Uniform3uiv = loadProc("glUniform3uiv"); - api->IsVertexArray = loadProc("glIsVertexArray"); - api->ViewportIndexedfv = mg_glViewportIndexedfv_noimpl; - api->DispatchCompute = loadProc("glDispatchCompute"); - api->DrawArrays = loadProc("glDrawArrays"); - api->GetQueryIndexediv = mg_glGetQueryIndexediv_noimpl; - api->Uniform3ui = loadProc("glUniform3ui"); - api->MultiDrawElements = mg_glMultiDrawElements_noimpl; - api->ClearBufferfi = loadProc("glClearBufferfi"); - api->ProgramUniformMatrix2dv = mg_glProgramUniformMatrix2dv_noimpl; - api->VertexAttribP3ui = mg_glVertexAttribP3ui_noimpl; - api->VertexAttribI3iv = mg_glVertexAttribI3iv_noimpl; - api->ProgramParameteri = loadProc("glProgramParameteri"); - api->Uniform4uiv = loadProc("glUniform4uiv"); - api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); - api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); - api->GetGraphicsResetStatus = loadProc("glGetGraphicsResetStatus"); - api->ShaderBinary = loadProc("glShaderBinary"); - api->ShaderStorageBlockBinding = mg_glShaderStorageBlockBinding_noimpl; - api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); - api->GetSubroutineIndex = mg_glGetSubroutineIndex_noimpl; - api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); - api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); - api->GetProgramResourceName = loadProc("glGetProgramResourceName"); - api->GetInternalformativ = loadProc("glGetInternalformativ"); - api->Uniform4fv = loadProc("glUniform4fv"); - api->VertexAttribLPointer = mg_glVertexAttribLPointer_noimpl; - api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); - api->VertexAttrib3d = mg_glVertexAttrib3d_noimpl; - api->SamplerParameterf = loadProc("glSamplerParameterf"); - api->GenFramebuffers = loadProc("glGenFramebuffers"); - api->GetQueryObjectui64v = mg_glGetQueryObjectui64v_noimpl; - api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); - api->VertexAttribP3uiv = mg_glVertexAttribP3uiv_noimpl; - api->VertexAttrib4dv = mg_glVertexAttrib4dv_noimpl; - api->IsTransformFeedback = loadProc("glIsTransformFeedback"); - api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); - api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); - api->BindVertexBuffer = loadProc("glBindVertexBuffer"); - api->ProgramUniform1dv = mg_glProgramUniform1dv_noimpl; - api->StencilOp = loadProc("glStencilOp"); - api->VertexAttrib1s = mg_glVertexAttrib1s_noimpl; - api->GetMultisamplefv = loadProc("glGetMultisamplefv"); - api->GetQueryiv = loadProc("glGetQueryiv"); - api->BindProgramPipeline = loadProc("glBindProgramPipeline"); - api->FramebufferParameteri = loadProc("glFramebufferParameteri"); - api->GetIntegeri_v = loadProc("glGetIntegeri_v"); - api->GetIntegerv = loadProc("glGetIntegerv"); - api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); - api->ClearBufferData = mg_glClearBufferData_noimpl; - api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); - api->GetSubroutineUniformLocation = mg_glGetSubroutineUniformLocation_noimpl; - api->GetProgramiv = loadProc("glGetProgramiv"); - api->DepthMask = loadProc("glDepthMask"); - api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); - api->GetActiveUniformName = mg_glGetActiveUniformName_noimpl; - api->VertexAttribP1uiv = mg_glVertexAttribP1uiv_noimpl; - api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); - api->GetUniformLocation = loadProc("glGetUniformLocation"); - api->SampleMaski = loadProc("glSampleMaski"); - api->GetBufferSubData = mg_glGetBufferSubData_noimpl; - api->Uniform4iv = loadProc("glUniform4iv"); - api->VertexAttribPointer = loadProc("glVertexAttribPointer"); - api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); - api->GetnUniformuiv = loadProc("glGetnUniformuiv"); - api->GetInternalformati64v = mg_glGetInternalformati64v_noimpl; - api->CompileShader = loadProc("glCompileShader"); - api->DrawBuffer = mg_glDrawBuffer_noimpl; - api->Uniform3f = loadProc("glUniform3f"); - api->DrawTransformFeedbackInstanced = mg_glDrawTransformFeedbackInstanced_noimpl; - api->ProgramUniform4dv = mg_glProgramUniform4dv_noimpl; - api->GetProgramStageiv = mg_glGetProgramStageiv_noimpl; - api->StencilFunc = loadProc("glStencilFunc"); - api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); - api->ClearStencil = loadProc("glClearStencil"); - api->ScissorArrayv = mg_glScissorArrayv_noimpl; - api->MemoryBarrier = loadProc("glMemoryBarrier"); - api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); - api->GetFloatv = loadProc("glGetFloatv"); - api->BindFragDataLocationIndexed = mg_glBindFragDataLocationIndexed_noimpl; - api->EndQuery = loadProc("glEndQuery"); - api->VertexAttrib4Nubv = mg_glVertexAttrib4Nubv_noimpl; - api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); - api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); - api->Uniform3i = loadProc("glUniform3i"); - api->Uniform2ui = loadProc("glUniform2ui"); - api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); - api->GetDebugMessageLog = loadProc("glGetDebugMessageLog"); -} - -void mg_gl_select_api(mg_gl_api* api){ __mgGLAPI = api; } -void mg_gl_deselect_api(){ __mgGLAPI = &__mgGLNoAPI; } -mg_gl_api* mg_gl_get_api(void) { return(__mgGLAPI); } - +/******************************************************** +* +* @file: gl_loader.c +* @note: auto-generated by glapi.py from gl.xml +* @date: 15/082023 +* +*********************************************************/ +#include"gl_loader.h" +#include"platform/platform.h" + +oc_thread_local oc_gl_api* oc_glAPI = 0; +oc_gl_api oc_glNoAPI; + +void oc_glGetFloatv_noimpl(GLenum pname, GLfloat * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetFloatv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexBufferRange_noimpl(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexBufferRange is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsBuffer_noimpl(GLuint buffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +GLboolean oc_glIsTexture_noimpl(GLuint texture) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsTexture is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glDepthRangef_noimpl(GLfloat n, GLfloat f) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDepthRangef is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glEndConditionalRender_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glEndConditionalRender is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendFunci_noimpl(GLuint buf, GLenum src, GLenum dst) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendFunci is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramPipelineiv_noimpl(GLuint pipeline, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramPipelineiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glWaitSync_noimpl(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glWaitSync is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix2fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix4x3dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix4x3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib1dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib1dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSamplerParameteri_noimpl(GLuint sampler, GLenum pname, GLint param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSamplerParameteri is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetVertexAttribIiv_noimpl(GLuint index, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetVertexAttribIiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetSamplerParameterfv_noimpl(GLuint sampler, GLenum pname, GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetSamplerParameterfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib1d_noimpl(GLuint index, GLdouble x) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib1d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexBuffer_noimpl(GLenum target, GLenum internalformat, GLuint buffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glInvalidateBufferData_noimpl(GLuint buffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glInvalidateBufferData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2i_noimpl(GLuint program, GLint location, GLint v0, GLint v1) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform4dv_noimpl(GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUseProgram_noimpl(GLuint program) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUseProgram is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI3iv_noimpl(GLuint index, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI3iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawElementsIndirect_noimpl(GLenum mode, GLenum type, const void * indirect) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawElementsIndirect is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4uiv_noimpl(GLuint index, const GLuint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetQueryObjectiv_noimpl(GLuint id, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetQueryObjectiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFramebufferRenderbuffer_noimpl(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFramebufferRenderbuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendEquationi_noimpl(GLuint buf, GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendEquationi is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetActiveSubroutineName_noimpl(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveSubroutineName is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib2s_noimpl(GLuint index, GLshort x, GLshort y) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib2s is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL1d_noimpl(GLuint index, GLdouble x) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL1d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindTextures_noimpl(GLuint first, GLsizei count, const GLuint * textures) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindTextures is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib3sv_noimpl(GLuint index, const GLshort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib3sv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetFloati_v_noimpl(GLenum target, GLuint index, GLfloat * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetFloati_v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBeginTransformFeedback_noimpl(GLenum primitiveMode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBeginTransformFeedback is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearStencil_noimpl(GLint s) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearStencil is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform3i_noimpl(GLint location, GLint v0, GLint v1, GLint v2) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glValidateProgramPipeline_noimpl(GLuint pipeline) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glValidateProgramPipeline is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix4x2fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix4x2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4ui_noimpl(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetShaderiv_noimpl(GLuint shader, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetShaderiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glReadnPixels_noimpl(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glReadnPixels is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix4x2fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix4x2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetShaderPrecisionFormat_noimpl(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetShaderPrecisionFormat is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix2x3fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix2x3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexSubImage3D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexSubImage3D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLint oc_glGetProgramResourceLocationIndex_noimpl(GLuint program, GLenum programInterface, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramResourceLocationIndex is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLint)0); +} +void oc_glBlendFunc_noimpl(GLenum sfactor, GLenum dfactor) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendFunc is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix3x4fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix3x4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform3d_noimpl(GLint location, GLdouble x, GLdouble y, GLdouble z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib1sv_noimpl(GLuint index, const GLshort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib1sv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindFragDataLocation_noimpl(GLuint program, GLuint color, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindFragDataLocation is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4bv_noimpl(GLuint index, const GLbyte * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4bv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform4iv_noimpl(GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2ui_noimpl(GLuint program, GLint location, GLuint v0, GLuint v1) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawArrays_noimpl(GLenum mode, GLint first, GLsizei count) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawArrays is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramBinary_noimpl(GLuint program, GLenum binaryFormat, const void * binary, GLsizei length) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramBinary is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4f_noimpl(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP2uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP2uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix3fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2i_noimpl(GLint location, GLint v0, GLint v1) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetQueryObjectuiv_noimpl(GLuint id, GLenum pname, GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetQueryObjectuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformBlockBinding_noimpl(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformBlockBinding is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSampleCoverage_noimpl(GLfloat value, GLboolean invert) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSampleCoverage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4Nusv_noimpl(GLuint index, const GLushort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4Nusv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix2x4dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix2x4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform3uiv_noimpl(GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib1s_noimpl(GLuint index, GLshort x) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib1s is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetVertexAttribPointerv_noimpl(GLuint index, GLenum pname, void ** pointer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetVertexAttribPointerv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendBarrier_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendBarrier is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawRangeElements_noimpl(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawRangeElements is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexStorage3D_noimpl(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexStorage3D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetInternalformati64v_noimpl(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint64 * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetInternalformati64v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetQueryObjecti64v_noimpl(GLuint id, GLenum pname, GLint64 * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetQueryObjecti64v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCompressedTexSubImage1D_noimpl(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCompressedTexSubImage1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib3dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexBindingDivisor_noimpl(GLuint bindingindex, GLuint divisor) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexBindingDivisor is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUseProgramStages_noimpl(GLuint pipeline, GLbitfield stages, GLuint program) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUseProgramStages is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribBinding_noimpl(GLuint attribindex, GLuint bindingindex) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribBinding is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDebugMessageInsert_noimpl(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDebugMessageInsert is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetTexParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTexParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glMultiDrawArraysIndirect_noimpl(GLenum mode, const void * indirect, GLsizei drawcount, GLsizei stride) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMultiDrawArraysIndirect is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetTexParameterfv_noimpl(GLenum target, GLenum pname, GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTexParameterfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramPipelineInfoLog_noimpl(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramPipelineInfoLog is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glEndQuery_noimpl(GLenum target) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glEndQuery is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLint oc_glGetProgramResourceLocation_noimpl(GLuint program, GLenum programInterface, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramResourceLocation is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLint)0); +} +void oc_glCompressedTexImage2D_noimpl(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCompressedTexImage2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP2ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP2ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsEnabledi_noimpl(GLenum target, GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsEnabledi is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glGetActiveAtomicCounterBufferiv_noimpl(GLuint program, GLuint bufferIndex, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveAtomicCounterBufferiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsProgram_noimpl(GLuint program) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsProgram is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glUniform1dv_noimpl(GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexParameteriv_noimpl(GLenum target, GLenum pname, const GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2fv_noimpl(GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glReleaseShaderCompiler_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glReleaseShaderCompiler is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCullFace_noimpl(GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCullFace is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4i_noimpl(GLuint index, GLint x, GLint y, GLint z, GLint w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLuint oc_glGetProgramResourceIndex_noimpl(GLuint program, GLenum programInterface, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramResourceIndex is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLuint)0); +} +void oc_glShaderBinary_noimpl(GLsizei count, const GLuint * shaders, GLenum binaryFormat, const void * binary, GLsizei length) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glShaderBinary is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix3x2dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix3x2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glInvalidateFramebuffer_noimpl(GLenum target, GLsizei numAttachments, const GLenum * attachments) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glInvalidateFramebuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glAttachShader_noimpl(GLuint program, GLuint shader) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glAttachShader is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFlushMappedBufferRange_noimpl(GLenum target, GLintptr offset, GLsizeiptr length) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFlushMappedBufferRange is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP3uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP3uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetActiveUniformName_noimpl(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveUniformName is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void * oc_glMapBuffer_noimpl(GLenum target, GLenum access) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMapBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } + return((void *)0); +} +void oc_glDrawBuffers_noimpl(GLsizei n, const GLenum * bufs) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawBuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetSynciv_noimpl(GLsync sync, GLenum pname, GLsizei count, GLsizei * length, GLint * values) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetSynciv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCopyTexSubImage2D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCopyTexSubImage2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glObjectLabel_noimpl(GLenum identifier, GLuint name, GLsizei length, const GLchar * label) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glObjectLabel is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBufferSubData_noimpl(GLenum target, GLintptr offset, GLsizeiptr size, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBufferSubData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2f_noimpl(GLint location, GLfloat v0, GLfloat v1) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDebugMessageCallback_noimpl(GLDEBUGPROC callback, const void * userParam) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDebugMessageCallback is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL4dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsProgramPipeline_noimpl(GLuint pipeline) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsProgramPipeline is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glResumeTransformFeedback_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glResumeTransformFeedback is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4iv_noimpl(GLuint index, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetShaderInfoLog_noimpl(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetShaderInfoLog is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetIntegeri_v_noimpl(GLenum target, GLuint index, GLint * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetIntegeri_v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindVertexBuffer_noimpl(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindVertexBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendEquation_noimpl(GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendEquation is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL2dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI1ui_noimpl(GLuint index, GLuint x) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI1ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4Nsv_noimpl(GLuint index, const GLshort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4Nsv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL4d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL4d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCopyImageSubData_noimpl(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCopyImageSubData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetFramebufferAttachmentParameteriv_noimpl(GLenum target, GLenum attachment, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetFramebufferAttachmentParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL2d_noimpl(GLuint index, GLdouble x, GLdouble y) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL2d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLuint oc_glGetSubroutineIndex_noimpl(GLuint program, GLenum shadertype, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetSubroutineIndex is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLuint)0); +} +void oc_glVertexAttribI3uiv_noimpl(GLuint index, const GLuint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI3uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4iv_noimpl(GLuint index, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindVertexBuffers_noimpl(GLuint first, GLsizei count, const GLuint * buffers, const GLintptr * offsets, const GLsizei * strides) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindVertexBuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix2x3dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix2x3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPrimitiveBoundingBox_noimpl(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPrimitiveBoundingBox is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glScissor_noimpl(GLint x, GLint y, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glScissor is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLenum oc_glClientWaitSync_noimpl(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClientWaitSync is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLenum)0); +} +void oc_glUniform3ui_noimpl(GLint location, GLuint v0, GLuint v1, GLuint v2) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP3ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP3ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glEnable_noimpl(GLenum cap) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glEnable is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glStencilOpSeparate_noimpl(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glStencilOpSeparate is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix2x3dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix2x3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix3dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexImage2DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexImage2DMultisample is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4Nbv_noimpl(GLuint index, const GLbyte * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4Nbv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetTexImage_noimpl(GLenum target, GLint level, GLenum format, GLenum type, void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTexImage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4sv_noimpl(GLuint index, const GLshort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4sv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPixelStorei_noimpl(GLenum pname, GLint param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPixelStorei is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDepthMask_noimpl(GLboolean flag) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDepthMask is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexStorage2D_noimpl(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexStorage2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClear_noimpl(GLbitfield mask) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClear is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix3x4dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix3x4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteTransformFeedbacks_noimpl(GLsizei n, const GLuint * ids) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteTransformFeedbacks is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void * oc_glMapBufferRange_noimpl(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMapBufferRange is not part of currently selected %s API\n", oc_glAPI->name); + } + return((void *)0); +} +void oc_glMemoryBarrier_noimpl(GLbitfield barriers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMemoryBarrier is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glViewportIndexedf_noimpl(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glViewportIndexedf is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib3fv_noimpl(GLuint index, const GLfloat * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glObjectPtrLabel_noimpl(const void * ptr, GLsizei length, const GLchar * label) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glObjectPtrLabel is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexStorage1D_noimpl(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexStorage1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCompressedTexImage3D_noimpl(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCompressedTexImage3D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib1fv_noimpl(GLuint index, const GLfloat * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib1fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribPointer_noimpl(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribPointer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetQueryIndexediv_noimpl(GLenum target, GLuint index, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetQueryIndexediv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCompileShader_noimpl(GLuint shader) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCompileShader is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1i_noimpl(GLuint program, GLint location, GLint v0) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetQueryiv_noimpl(GLenum target, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetQueryiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI1iv_noimpl(GLuint index, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI1iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCopyTexImage2D_noimpl(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCopyTexImage2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetQueryObjectui64v_noimpl(GLuint id, GLenum pname, GLuint64 * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetQueryObjectui64v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPointSize_noimpl(GLfloat size) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPointSize is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDisablei_noimpl(GLenum target, GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDisablei is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL1dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL1dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLuint oc_glCreateShader_noimpl(GLenum type) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCreateShader is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLuint)0); +} +const GLubyte * oc_glGetString_noimpl(GLenum name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetString is not part of currently selected %s API\n", oc_glAPI->name); + } + return((const GLubyte *)0); +} +void oc_glViewportArrayv_noimpl(GLuint first, GLsizei count, const GLfloat * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glViewportArrayv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform3d_noimpl(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4Nubv_noimpl(GLuint index, const GLubyte * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4Nubv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexParameteri_noimpl(GLenum target, GLenum pname, GLint param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexParameteri is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenerateMipmap_noimpl(GLenum target) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenerateMipmap is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCompressedTexSubImage3D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCompressedTexSubImage3D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform3f_noimpl(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetUniformIndices_noimpl(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformIndices is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribLPointer_noimpl(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribLPointer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI2uiv_noimpl(GLuint index, const GLuint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI2uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glQueryCounter_noimpl(GLuint id, GLenum target) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glQueryCounter is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glActiveShaderProgram_noimpl(GLuint pipeline, GLuint program) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glActiveShaderProgram is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform1ui_noimpl(GLint location, GLuint v0) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI1i_noimpl(GLuint index, GLint x) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI1i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetTexParameterIiv_noimpl(GLenum target, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTexParameterIiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetUniformfv_noimpl(GLuint program, GLint location, GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLenum oc_glGetError_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetError is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLenum)0); +} +void oc_glGetActiveUniformBlockName_noimpl(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveUniformBlockName is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTextureView_noimpl(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTextureView is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetnUniformiv_noimpl(GLuint program, GLint location, GLsizei bufSize, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetnUniformiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glViewportIndexedfv_noimpl(GLuint index, const GLfloat * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glViewportIndexedfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glHint_noimpl(GLenum target, GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glHint is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetShaderSource_noimpl(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetShaderSource is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix4x3fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix4x3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform1iv_noimpl(GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4bv_noimpl(GLuint index, const GLbyte * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4bv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix4x2dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix4x2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBufferStorage_noimpl(GLenum target, GLsizeiptr size, const void * data, GLbitfield flags) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBufferStorage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsRenderbuffer_noimpl(GLuint renderbuffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsRenderbuffer is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glGetActiveSubroutineUniformName_noimpl(GLuint program, GLenum shadertype, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveSubroutineUniformName is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glLinkProgram_noimpl(GLuint program) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glLinkProgram is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetActiveUniformsiv_noimpl(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveUniformsiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLuint oc_glGetDebugMessageLog_noimpl(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetDebugMessageLog is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLuint)0); +} +void oc_glCopyTexSubImage3D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCopyTexSubImage3D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPointParameteri_noimpl(GLenum pname, GLint param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPointParameteri is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform3dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCompressedTexImage1D_noimpl(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCompressedTexImage1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix3x4fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix3x4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenSamplers_noimpl(GLsizei count, GLuint * samplers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenSamplers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetCompressedTexImage_noimpl(GLenum target, GLint level, void * img) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetCompressedTexImage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteQueries_noimpl(GLsizei n, const GLuint * ids) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteQueries is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenProgramPipelines_noimpl(GLsizei n, GLuint * pipelines) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenProgramPipelines is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDispatchComputeIndirect_noimpl(GLintptr indirect) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDispatchComputeIndirect is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribIPointer_noimpl(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribIPointer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLuint oc_glCreateProgram_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCreateProgram is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLuint)0); +} +void oc_glClearTexSubImage_noimpl(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearTexSubImage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFrontFace_noimpl(GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFrontFace is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindTransformFeedback_noimpl(GLenum target, GLuint id) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindTransformFeedback is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramStageiv_noimpl(GLuint program, GLenum shadertype, GLenum pname, GLint * values) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramStageiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSamplerParameterIiv_noimpl(GLuint sampler, GLenum pname, const GLint * param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSamplerParameterIiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetInteger64v_noimpl(GLenum pname, GLint64 * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetInteger64v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLuint oc_glCreateShaderProgramv_noimpl(GLenum type, GLsizei count, const GLchar *const* strings) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCreateShaderProgramv is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLuint)0); +} +void oc_glBindBuffersRange_noimpl(GLenum target, GLuint first, GLsizei count, const GLuint * buffers, const GLintptr * offsets, const GLsizeiptr * sizes) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindBuffersRange is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform3fv_noimpl(GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix4fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindBuffersBase_noimpl(GLenum target, GLuint first, GLsizei count, const GLuint * buffers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindBuffersBase is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearBufferfi_noimpl(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearBufferfi is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFramebufferTexture3D_noimpl(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFramebufferTexture3D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDisable_noimpl(GLenum cap) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDisable is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI2iv_noimpl(GLuint index, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI2iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDepthRangeIndexed_noimpl(GLuint index, GLdouble n, GLdouble f) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDepthRangeIndexed is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPatchParameteri_noimpl(GLenum pname, GLint value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPatchParameteri is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLuint oc_glGetUniformBlockIndex_noimpl(GLuint program, const GLchar * uniformBlockName) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformBlockIndex is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLuint)0); +} +void oc_glMultiDrawArrays_noimpl(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMultiDrawArrays is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4ubv_noimpl(GLuint index, const GLubyte * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4ubv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindBuffer_noimpl(GLenum target, GLuint buffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI3i_noimpl(GLuint index, GLint x, GLint y, GLint z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI3i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetDoublev_noimpl(GLenum pname, GLdouble * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetDoublev is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawTransformFeedbackStream_noimpl(GLenum mode, GLuint id, GLuint stream) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawTransformFeedbackStream is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4uiv_noimpl(GLuint index, const GLuint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glRenderbufferStorageMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glRenderbufferStorageMultisample is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL3dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glStencilMaskSeparate_noimpl(GLenum face, GLuint mask) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glStencilMaskSeparate is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1d_noimpl(GLuint program, GLint location, GLdouble v0) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glViewport_noimpl(GLint x, GLint y, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glViewport is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP1ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP1ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenQueries_noimpl(GLsizei n, GLuint * ids) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenQueries is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexParameterIiv_noimpl(GLenum target, GLenum pname, const GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexParameterIiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2d_noimpl(GLuint program, GLint location, GLdouble v0, GLdouble v1) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4Nub_noimpl(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4Nub is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsVertexArray_noimpl(GLuint array) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsVertexArray is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glProgramUniform3f_noimpl(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform3iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramBinary_noimpl(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramBinary is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindRenderbuffer_noimpl(GLenum target, GLuint renderbuffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindRenderbuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindFragDataLocationIndexed_noimpl(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindFragDataLocationIndexed is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetSamplerParameterIiv_noimpl(GLuint sampler, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetSamplerParameterIiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribDivisor_noimpl(GLuint index, GLuint divisor) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribDivisor is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix3x2dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix3x2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFramebufferParameteri_noimpl(GLenum target, GLenum pname, GLint param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFramebufferParameteri is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenTransformFeedbacks_noimpl(GLsizei n, GLuint * ids) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenTransformFeedbacks is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteSync_noimpl(GLsync sync) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteSync is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1ui_noimpl(GLuint program, GLint location, GLuint v0) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexSubImage1D_noimpl(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexSubImage1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearDepthf_noimpl(GLfloat d) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearDepthf is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glReadPixels_noimpl(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glReadPixels is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI2i_noimpl(GLuint index, GLint x, GLint y) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI2i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFinish_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFinish is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glLineWidth_noimpl(GLfloat width) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glLineWidth is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteShader_noimpl(GLuint shader) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteShader is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsSampler_noimpl(GLuint sampler) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsSampler is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glProgramUniformMatrix4dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTransformFeedbackVaryings_noimpl(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTransformFeedbackVaryings is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBeginConditionalRender_noimpl(GLuint id, GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBeginConditionalRender is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindSamplers_noimpl(GLuint first, GLsizei count, const GLuint * samplers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindSamplers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteProgramPipelines_noimpl(GLsizei n, const GLuint * pipelines) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteProgramPipelines is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glColorMask_noimpl(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glColorMask is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexParameterfv_noimpl(GLenum target, GLenum pname, const GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexParameterfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPushDebugGroup_noimpl(GLenum source, GLuint id, GLsizei length, const GLchar * message) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPushDebugGroup is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearBufferfv_noimpl(GLenum buffer, GLint drawbuffer, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearBufferfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsEnabled_noimpl(GLenum cap) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsEnabled is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glVertexAttrib2f_noimpl(GLuint index, GLfloat x, GLfloat y) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib2f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2f_noimpl(GLuint program, GLint location, GLfloat v0, GLfloat v1) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetSamplerParameterIuiv_noimpl(GLuint sampler, GLenum pname, GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetSamplerParameterIuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetInteger64i_v_noimpl(GLenum target, GLuint index, GLint64 * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetInteger64i_v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2dv_noimpl(GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetBufferSubData_noimpl(GLenum target, GLintptr offset, GLsizeiptr size, void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetBufferSubData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glMultiDrawElementsIndirect_noimpl(GLenum mode, GLenum type, const void * indirect, GLsizei drawcount, GLsizei stride) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMultiDrawElementsIndirect is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramParameteri_noimpl(GLuint program, GLenum pname, GLint value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramParameteri is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP4ui_noimpl(GLuint index, GLenum type, GLboolean normalized, GLuint value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP4ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSamplerParameterfv_noimpl(GLuint sampler, GLenum pname, const GLfloat * param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSamplerParameterfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPointParameterf_noimpl(GLenum pname, GLfloat param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPointParameterf is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix2x4fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix2x4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenBuffers_noimpl(GLsizei n, GLuint * buffers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenBuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribFormat_noimpl(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribFormat is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexSubImage2D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexSubImage2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4ubv_noimpl(GLuint index, const GLubyte * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4ubv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLenum oc_glGetGraphicsResetStatus_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetGraphicsResetStatus is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLenum)0); +} +void oc_glGetProgramInterfaceiv_noimpl(GLuint program, GLenum programInterface, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramInterfaceiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribIFormat_noimpl(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribIFormat is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetnUniformfv_noimpl(GLuint program, GLint location, GLsizei bufSize, GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetnUniformfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteProgram_noimpl(GLuint program) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteProgram is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClampColor_noimpl(GLenum target, GLenum clamp) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClampColor is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawElementsInstancedBaseVertexBaseInstance_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawElementsInstancedBaseVertexBaseInstance is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawElements_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawElements is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDebugMessageControl_noimpl(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDebugMessageControl is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetRenderbufferParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetRenderbufferParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDetachShader_noimpl(GLuint program, GLuint shader) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDetachShader is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenFramebuffers_noimpl(GLsizei n, GLuint * framebuffers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenFramebuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProvokingVertex_noimpl(GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProvokingVertex is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSampleMaski_noimpl(GLuint maskNumber, GLbitfield mask) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSampleMaski is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glEndQueryIndexed_noimpl(GLenum target, GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glEndQueryIndexed is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1f_noimpl(GLuint program, GLint location, GLfloat v0) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindFramebuffer_noimpl(GLenum target, GLuint framebuffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindFramebuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBeginQueryIndexed_noimpl(GLenum target, GLuint index, GLuint id) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBeginQueryIndexed is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformSubroutinesuiv_noimpl(GLenum shadertype, GLsizei count, const GLuint * indices) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformSubroutinesuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetUniformiv_noimpl(GLuint program, GLint location, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFramebufferTexture_noimpl(GLenum target, GLenum attachment, GLuint texture, GLint level) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFramebufferTexture is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPointParameterfv_noimpl(GLenum pname, const GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPointParameterfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsTransformFeedback_noimpl(GLuint id) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsTransformFeedback is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +GLenum oc_glCheckFramebufferStatus_noimpl(GLenum target) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCheckFramebufferStatus is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLenum)0); +} +void oc_glShaderSource_noimpl(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glShaderSource is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix2x4dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix2x4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindImageTextures_noimpl(GLuint first, GLsizei count, const GLuint * textures) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindImageTextures is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCopyTexImage1D_noimpl(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCopyTexImage1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix3dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1dv_noimpl(GLuint program, GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlitFramebuffer_noimpl(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlitFramebuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPopDebugGroup_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPopDebugGroup is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexParameterIuiv_noimpl(GLenum target, GLenum pname, const GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexParameterIuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib2d_noimpl(GLuint index, GLdouble x, GLdouble y) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib2d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexImage1D_noimpl(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexImage1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetObjectPtrLabel_noimpl(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetObjectPtrLabel is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glStencilMask_noimpl(GLuint mask) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glStencilMask is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBeginQuery_noimpl(GLenum target, GLuint id) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBeginQuery is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix4fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsSync_noimpl(GLsync sync) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsSync is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glUniform3dv_noimpl(GLint location, GLsizei count, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4sv_noimpl(GLuint index, const GLshort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4sv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glScissorArrayv_noimpl(GLuint first, GLsizei count, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glScissorArrayv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP1uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP1uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2uiv_noimpl(GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteBuffers_noimpl(GLsizei n, const GLuint * buffers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteBuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform3ui_noimpl(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFramebufferTextureLayer_noimpl(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFramebufferTextureLayer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glEndTransformFeedback_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glEndTransformFeedback is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendFuncSeparatei_noimpl(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendFuncSeparatei is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawTransformFeedbackInstanced_noimpl(GLenum mode, GLuint id, GLsizei instancecount) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawTransformFeedbackInstanced is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawRangeElementsBaseVertex_noimpl(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawRangeElementsBaseVertex is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib1f_noimpl(GLuint index, GLfloat x) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib1f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetUniformSubroutineuiv_noimpl(GLenum shadertype, GLint location, GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformSubroutineuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDisableVertexAttribArray_noimpl(GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDisableVertexAttribArray is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix3x2fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix3x2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI4usv_noimpl(GLuint index, const GLushort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI4usv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetObjectLabel_noimpl(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetObjectLabel is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindAttribLocation_noimpl(GLuint program, GLuint index, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindAttribLocation is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform1f_noimpl(GLint location, GLfloat v0) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetUniformdv_noimpl(GLuint program, GLint location, GLdouble * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformdv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLint oc_glGetUniformLocation_noimpl(GLuint program, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformLocation is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLint)0); +} +GLint oc_glGetSubroutineUniformLocation_noimpl(GLuint program, GLenum shadertype, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetSubroutineUniformLocation is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLint)0); +} +void oc_glGetTexParameterIuiv_noimpl(GLenum target, GLenum pname, GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTexParameterIuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSamplerParameterf_noimpl(GLuint sampler, GLenum pname, GLfloat param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSamplerParameterf is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribL3d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribL3d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexImage3DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexImage3DMultisample is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexImage3D_noimpl(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexImage3D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glRenderbufferStorage_noimpl(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glRenderbufferStorage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glEnableVertexAttribArray_noimpl(GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glEnableVertexAttribArray is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribP4uiv_noimpl(GLuint index, GLenum type, GLboolean normalized, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribP4uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform4d_noimpl(GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4s_noimpl(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4s is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawElementsInstancedBaseVertex_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawElementsInstancedBaseVertex is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib3s_noimpl(GLuint index, GLshort x, GLshort y, GLshort z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib3s is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform2iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform2iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glStencilFuncSeparate_noimpl(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glStencilFuncSeparate is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteFramebuffers_noimpl(GLsizei n, const GLuint * framebuffers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteFramebuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDepthRange_noimpl(GLdouble n, GLdouble f) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDepthRange is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix3x2fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix3x2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix2dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glShaderStorageBlockBinding_noimpl(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glShaderStorageBlockBinding is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearDepth_noimpl(GLdouble depth) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearDepth is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib2dv_noimpl(GLuint index, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSamplerParameterIuiv_noimpl(GLuint sampler, GLenum pname, const GLuint * param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSamplerParameterIuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetVertexAttribLdv_noimpl(GLuint index, GLenum pname, GLdouble * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetVertexAttribLdv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix3x4dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix3x4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDepthRangeArrayv_noimpl(GLuint first, GLsizei count, const GLdouble * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDepthRangeArrayv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetActiveUniform_noimpl(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveUniform is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPatchParameterfv_noimpl(GLenum pname, const GLfloat * values) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPatchParameterfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glInvalidateTexImage_noimpl(GLuint texture, GLint level) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glInvalidateTexImage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib3f_noimpl(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib3f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4iv_noimpl(GLuint program, GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4d_noimpl(GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsFramebuffer_noimpl(GLuint framebuffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsFramebuffer is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glPixelStoref_noimpl(GLenum pname, GLfloat param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPixelStoref is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix4x2dv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix4x2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLsync oc_glFenceSync_noimpl(GLenum condition, GLbitfield flags) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFenceSync is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLsync)0); +} +void oc_glGetBufferParameteri64v_noimpl(GLenum target, GLenum pname, GLint64 * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetBufferParameteri64v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glStencilOp_noimpl(GLenum fail, GLenum zfail, GLenum zpass) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glStencilOp is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearBufferData_noimpl(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearBufferData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetnUniformuiv_noimpl(GLuint program, GLint location, GLsizei bufSize, GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetnUniformuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramResourceiv_noimpl(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei count, GLsizei * length, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramResourceiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetVertexAttribdv_noimpl(GLuint index, GLenum pname, GLdouble * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetVertexAttribdv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetTransformFeedbackVarying_noimpl(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTransformFeedbackVarying is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib2fv_noimpl(GLuint index, const GLfloat * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetBooleani_v_noimpl(GLenum target, GLuint index, GLboolean * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetBooleani_v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glColorMaski_noimpl(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glColorMaski is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glInvalidateBufferSubData_noimpl(GLuint buffer, GLintptr offset, GLsizeiptr length) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glInvalidateBufferSubData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix4dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix4dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsQuery_noimpl(GLuint id) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsQuery is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glUniform4ui_noimpl(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform4i_noimpl(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetSamplerParameteriv_noimpl(GLuint sampler, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetSamplerParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glMultiDrawElementsBaseVertex_noimpl(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMultiDrawElementsBaseVertex is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI1uiv_noimpl(GLuint index, const GLuint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI1uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetIntegerv_noimpl(GLenum pname, GLint * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetIntegerv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix2x3fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix2x3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexImage2D_noimpl(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexImage2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetAttachedShaders_noimpl(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetAttachedShaders is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2d_noimpl(GLint location, GLdouble x, GLdouble y) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glMemoryBarrierByRegion_noimpl(GLbitfield barriers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMemoryBarrierByRegion is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix2fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix2fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPrimitiveRestartIndex_noimpl(GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPrimitiveRestartIndex is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetVertexAttribiv_noimpl(GLuint index, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetVertexAttribiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLint oc_glGetAttribLocation_noimpl(GLuint program, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetAttribLocation is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLint)0); +} +void oc_glTexStorage2DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexStorage2DMultisample is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCompressedTexSubImage2D_noimpl(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCompressedTexSubImage2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetVertexAttribfv_noimpl(GLuint index, GLenum pname, GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetVertexAttribfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetBufferParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetBufferParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexParameterf_noimpl(GLenum target, GLenum pname, GLfloat param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexParameterf is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFramebufferTexture2D_noimpl(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFramebufferTexture2D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetActiveAttrib_noimpl(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveAttrib is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glInvalidateTexSubImage_noimpl(GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glInvalidateTexSubImage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteVertexArrays_noimpl(GLsizei n, const GLuint * arrays) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteVertexArrays is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI2ui_noimpl(GLuint index, GLuint x, GLuint y) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI2ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPointParameteriv_noimpl(GLenum pname, const GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPointParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetPointerv_noimpl(GLenum pname, void ** params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetPointerv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glEnablei_noimpl(GLenum target, GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glEnablei is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindBufferRange_noimpl(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindBufferRange is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawArraysInstanced_noimpl(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawArraysInstanced is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteTextures_noimpl(GLsizei n, const GLuint * textures) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteTextures is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4Niv_noimpl(GLuint index, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4Niv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glMultiDrawElements_noimpl(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMultiDrawElements is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramiv_noimpl(GLuint program, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDepthFunc_noimpl(GLenum func) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDepthFunc is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenTextures_noimpl(GLsizei n, GLuint * textures) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenTextures is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetInternalformativ_noimpl(GLenum target, GLenum internalformat, GLenum pname, GLsizei count, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetInternalformativ is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform3i_noimpl(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glScissorIndexed_noimpl(GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glScissorIndexed is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib2sv_noimpl(GLuint index, const GLshort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib2sv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glTexStorage3DMultisample_noimpl(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glTexStorage3DMultisample is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2iv_noimpl(GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawArraysInstancedBaseInstance_noimpl(GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawArraysInstancedBaseInstance is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttribI3ui_noimpl(GLuint index, GLuint x, GLuint y, GLuint z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribI3ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteSamplers_noimpl(GLsizei count, const GLuint * samplers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteSamplers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenVertexArrays_noimpl(GLsizei n, GLuint * arrays) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenVertexArrays is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetFramebufferParameteriv_noimpl(GLenum target, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetFramebufferParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPolygonMode_noimpl(GLenum face, GLenum mode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPolygonMode is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix2x4fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix2x4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramResourceName_noimpl(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramResourceName is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glSamplerParameteriv_noimpl(GLuint sampler, GLenum pname, const GLint * param) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glSamplerParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetActiveSubroutineUniformiv_noimpl(GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint * values) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveSubroutineUniformiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +const GLubyte * oc_glGetStringi_noimpl(GLenum name, GLuint index) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetStringi is not part of currently selected %s API\n", oc_glAPI->name); + } + return((const GLubyte *)0); +} +void oc_glVertexAttribLFormat_noimpl(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttribLFormat is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib3d_noimpl(GLuint index, GLdouble x, GLdouble y, GLdouble z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib3d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindVertexArray_noimpl(GLuint array) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindVertexArray is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glUnmapBuffer_noimpl(GLenum target) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUnmapBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glDrawElementsInstancedBaseInstance_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLuint baseinstance) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawElementsInstancedBaseInstance is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform4uiv_noimpl(GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFramebufferTexture1D_noimpl(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFramebufferTexture1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawTransformFeedbackStreamInstanced_noimpl(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawTransformFeedbackStreamInstanced is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glStencilFunc_noimpl(GLenum func, GLint ref, GLuint mask) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glStencilFunc is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glValidateProgram_noimpl(GLuint program) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glValidateProgram is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glFlush_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glFlush is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform3uiv_noimpl(GLuint program, GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDeleteRenderbuffers_noimpl(GLsizei n, const GLuint * renderbuffers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDeleteRenderbuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4fv_noimpl(GLuint index, const GLfloat * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix2dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix2dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLint oc_glGetFragDataIndex_noimpl(GLuint program, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetFragDataIndex is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLint)0); +} +void oc_glUniform3iv_noimpl(GLint location, GLsizei count, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform3iv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glMinSampleShading_noimpl(GLfloat value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glMinSampleShading is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetBooleanv_noimpl(GLenum pname, GLboolean * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetBooleanv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetMultisamplefv_noimpl(GLenum pname, GLuint index, GLfloat * val) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetMultisamplefv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetVertexAttribIuiv_noimpl(GLuint index, GLenum pname, GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetVertexAttribIuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetProgramInfoLog_noimpl(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetProgramInfoLog is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform4fv_noimpl(GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawBuffer_noimpl(GLenum buf) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform1i_noimpl(GLint location, GLint v0) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4ui_noimpl(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniformMatrix3fv_noimpl(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniformMatrix3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendEquationSeparate_noimpl(GLenum modeRGB, GLenum modeAlpha) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendEquationSeparate is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindProgramPipeline_noimpl(GLuint pipeline) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindProgramPipeline is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetDoublei_v_noimpl(GLenum target, GLuint index, GLdouble * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetDoublei_v is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBufferData_noimpl(GLenum target, GLsizeiptr size, const void * data, GLenum usage) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBufferData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearColor_noimpl(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearColor is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4i_noimpl(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4i is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetTexLevelParameteriv_noimpl(GLenum target, GLint level, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTexLevelParameteriv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetActiveUniformBlockiv_noimpl(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetActiveUniformBlockiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform1fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform1fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPauseTransformFeedback_noimpl(void) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPauseTransformFeedback is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetBufferPointerv_noimpl(GLenum target, GLenum pname, void ** params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetBufferPointerv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glInvalidateSubFramebuffer_noimpl(GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glInvalidateSubFramebuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glScissorIndexedv_noimpl(GLuint index, const GLint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glScissorIndexedv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform2ui_noimpl(GLint location, GLuint v0, GLuint v1) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform2ui is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindTexture_noimpl(GLenum target, GLuint texture) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindTexture is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawElementsInstanced_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawElementsInstanced is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform4f_noimpl(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform4f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindBufferBase_noimpl(GLenum target, GLuint index, GLuint buffer) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindBufferBase is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLboolean oc_glIsShader_noimpl(GLuint shader) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glIsShader is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLboolean)0); +} +void oc_glClearBufferSubData_noimpl(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearBufferSubData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4Nuiv_noimpl(GLuint index, const GLuint * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4Nuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawArraysIndirect_noimpl(GLenum mode, const void * indirect) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawArraysIndirect is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glVertexAttrib4usv_noimpl(GLuint index, const GLushort * v) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glVertexAttrib4usv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform1d_noimpl(GLint location, GLdouble x) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1d is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearTexImage_noimpl(GLuint texture, GLint level, GLenum format, GLenum type, const void * data) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearTexImage is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform1uiv_noimpl(GLint location, GLsizei count, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1uiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindSampler_noimpl(GLuint unit, GLuint sampler) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindSampler is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetTexLevelParameterfv_noimpl(GLenum target, GLint level, GLenum pname, GLfloat * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetTexLevelParameterfv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearBufferiv_noimpl(GLenum buffer, GLint drawbuffer, const GLint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearBufferiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glLogicOp_noimpl(GLenum opcode) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glLogicOp is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glActiveTexture_noimpl(GLenum texture) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glActiveTexture is not part of currently selected %s API\n", oc_glAPI->name); + } +} +GLint oc_glGetFragDataLocation_noimpl(GLuint program, const GLchar * name) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetFragDataLocation is not part of currently selected %s API\n", oc_glAPI->name); + } + return((GLint)0); +} +void oc_glBlendColor_noimpl(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendColor is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix4x3fv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix4x3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glProgramUniform3fv_noimpl(GLuint program, GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glProgramUniform3fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform1fv_noimpl(GLint location, GLsizei count, const GLfloat * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform1fv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawElementsBaseVertex_noimpl(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawElementsBaseVertex is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniform4f_noimpl(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniform4f is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendEquationSeparatei_noimpl(GLuint buf, GLenum modeRGB, GLenum modeAlpha) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendEquationSeparatei is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBlendFuncSeparate_noimpl(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBlendFuncSeparate is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glClearBufferuiv_noimpl(GLenum buffer, GLint drawbuffer, const GLuint * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glClearBufferuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCopyTexSubImage1D_noimpl(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCopyTexSubImage1D is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDrawTransformFeedback_noimpl(GLenum mode, GLuint id) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDrawTransformFeedback is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glReadBuffer_noimpl(GLenum src) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glReadBuffer is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glCopyBufferSubData_noimpl(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glCopyBufferSubData is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGetUniformuiv_noimpl(GLuint program, GLint location, GLuint * params) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGetUniformuiv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glPolygonOffset_noimpl(GLfloat factor, GLfloat units) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glPolygonOffset is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glDispatchCompute_noimpl(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glDispatchCompute is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glBindImageTexture_noimpl(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glBindImageTexture is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glUniformMatrix4x3dv_noimpl(GLint location, GLsizei count, GLboolean transpose, const GLdouble * value) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glUniformMatrix4x3dv is not part of currently selected %s API\n", oc_glAPI->name); + } +} +void oc_glGenRenderbuffers_noimpl(GLsizei n, GLuint * renderbuffers) +{ + if(oc_glAPI == &oc_glNoAPI) + { + oc_log_error("No GL or GLES API is selected. Make sure you call oc_surface_select() before calling OpenGL API functions.\n"); + } + else + { + oc_log_error("glGenRenderbuffers is not part of currently selected %s API\n", oc_glAPI->name); + } +} +oc_gl_api oc_glNoAPI = { + .GetFloatv = oc_glGetFloatv_noimpl, + .TexBufferRange = oc_glTexBufferRange_noimpl, + .IsBuffer = oc_glIsBuffer_noimpl, + .IsTexture = oc_glIsTexture_noimpl, + .DepthRangef = oc_glDepthRangef_noimpl, + .EndConditionalRender = oc_glEndConditionalRender_noimpl, + .BlendFunci = oc_glBlendFunci_noimpl, + .GetProgramPipelineiv = oc_glGetProgramPipelineiv_noimpl, + .WaitSync = oc_glWaitSync_noimpl, + .ProgramUniformMatrix2fv = oc_glProgramUniformMatrix2fv_noimpl, + .ProgramUniformMatrix4x3dv = oc_glProgramUniformMatrix4x3dv_noimpl, + .VertexAttrib1dv = oc_glVertexAttrib1dv_noimpl, + .SamplerParameteri = oc_glSamplerParameteri_noimpl, + .GetVertexAttribIiv = oc_glGetVertexAttribIiv_noimpl, + .GetSamplerParameterfv = oc_glGetSamplerParameterfv_noimpl, + .VertexAttrib1d = oc_glVertexAttrib1d_noimpl, + .TexBuffer = oc_glTexBuffer_noimpl, + .InvalidateBufferData = oc_glInvalidateBufferData_noimpl, + .ProgramUniform2i = oc_glProgramUniform2i_noimpl, + .Uniform4dv = oc_glUniform4dv_noimpl, + .UseProgram = oc_glUseProgram_noimpl, + .VertexAttribI3iv = oc_glVertexAttribI3iv_noimpl, + .DrawElementsIndirect = oc_glDrawElementsIndirect_noimpl, + .VertexAttrib4uiv = oc_glVertexAttrib4uiv_noimpl, + .GetQueryObjectiv = oc_glGetQueryObjectiv_noimpl, + .FramebufferRenderbuffer = oc_glFramebufferRenderbuffer_noimpl, + .BlendEquationi = oc_glBlendEquationi_noimpl, + .GetActiveSubroutineName = oc_glGetActiveSubroutineName_noimpl, + .VertexAttrib2s = oc_glVertexAttrib2s_noimpl, + .VertexAttribL1d = oc_glVertexAttribL1d_noimpl, + .BindTextures = oc_glBindTextures_noimpl, + .VertexAttrib3sv = oc_glVertexAttrib3sv_noimpl, + .GetFloati_v = oc_glGetFloati_v_noimpl, + .BeginTransformFeedback = oc_glBeginTransformFeedback_noimpl, + .ClearStencil = oc_glClearStencil_noimpl, + .Uniform3i = oc_glUniform3i_noimpl, + .ValidateProgramPipeline = oc_glValidateProgramPipeline_noimpl, + .ProgramUniformMatrix4x2fv = oc_glProgramUniformMatrix4x2fv_noimpl, + .VertexAttribI4ui = oc_glVertexAttribI4ui_noimpl, + .GetShaderiv = oc_glGetShaderiv_noimpl, + .ReadnPixels = oc_glReadnPixels_noimpl, + .UniformMatrix4x2fv = oc_glUniformMatrix4x2fv_noimpl, + .GetShaderPrecisionFormat = oc_glGetShaderPrecisionFormat_noimpl, + .ProgramUniformMatrix2x3fv = oc_glProgramUniformMatrix2x3fv_noimpl, + .TexSubImage3D = oc_glTexSubImage3D_noimpl, + .GetProgramResourceLocationIndex = oc_glGetProgramResourceLocationIndex_noimpl, + .BlendFunc = oc_glBlendFunc_noimpl, + .ProgramUniformMatrix3x4fv = oc_glProgramUniformMatrix3x4fv_noimpl, + .Uniform3d = oc_glUniform3d_noimpl, + .VertexAttrib1sv = oc_glVertexAttrib1sv_noimpl, + .BindFragDataLocation = oc_glBindFragDataLocation_noimpl, + .VertexAttrib4bv = oc_glVertexAttrib4bv_noimpl, + .Uniform4iv = oc_glUniform4iv_noimpl, + .ProgramUniform2ui = oc_glProgramUniform2ui_noimpl, + .DrawArrays = oc_glDrawArrays_noimpl, + .ProgramBinary = oc_glProgramBinary_noimpl, + .VertexAttrib4f = oc_glVertexAttrib4f_noimpl, + .VertexAttribP2uiv = oc_glVertexAttribP2uiv_noimpl, + .UniformMatrix3fv = oc_glUniformMatrix3fv_noimpl, + .Uniform2i = oc_glUniform2i_noimpl, + .GetQueryObjectuiv = oc_glGetQueryObjectuiv_noimpl, + .UniformBlockBinding = oc_glUniformBlockBinding_noimpl, + .SampleCoverage = oc_glSampleCoverage_noimpl, + .VertexAttrib4Nusv = oc_glVertexAttrib4Nusv_noimpl, + .ProgramUniformMatrix2x4dv = oc_glProgramUniformMatrix2x4dv_noimpl, + .Uniform3uiv = oc_glUniform3uiv_noimpl, + .VertexAttrib1s = oc_glVertexAttrib1s_noimpl, + .GetVertexAttribPointerv = oc_glGetVertexAttribPointerv_noimpl, + .BlendBarrier = oc_glBlendBarrier_noimpl, + .DrawRangeElements = oc_glDrawRangeElements_noimpl, + .TexStorage3D = oc_glTexStorage3D_noimpl, + .GetInternalformati64v = oc_glGetInternalformati64v_noimpl, + .GetQueryObjecti64v = oc_glGetQueryObjecti64v_noimpl, + .CompressedTexSubImage1D = oc_glCompressedTexSubImage1D_noimpl, + .VertexAttrib3dv = oc_glVertexAttrib3dv_noimpl, + .VertexBindingDivisor = oc_glVertexBindingDivisor_noimpl, + .UseProgramStages = oc_glUseProgramStages_noimpl, + .VertexAttribBinding = oc_glVertexAttribBinding_noimpl, + .DebugMessageInsert = oc_glDebugMessageInsert_noimpl, + .GetTexParameteriv = oc_glGetTexParameteriv_noimpl, + .MultiDrawArraysIndirect = oc_glMultiDrawArraysIndirect_noimpl, + .GetTexParameterfv = oc_glGetTexParameterfv_noimpl, + .GetProgramPipelineInfoLog = oc_glGetProgramPipelineInfoLog_noimpl, + .EndQuery = oc_glEndQuery_noimpl, + .GetProgramResourceLocation = oc_glGetProgramResourceLocation_noimpl, + .CompressedTexImage2D = oc_glCompressedTexImage2D_noimpl, + .VertexAttribP2ui = oc_glVertexAttribP2ui_noimpl, + .IsEnabledi = oc_glIsEnabledi_noimpl, + .GetActiveAtomicCounterBufferiv = oc_glGetActiveAtomicCounterBufferiv_noimpl, + .IsProgram = oc_glIsProgram_noimpl, + .Uniform1dv = oc_glUniform1dv_noimpl, + .TexParameteriv = oc_glTexParameteriv_noimpl, + .Uniform2fv = oc_glUniform2fv_noimpl, + .ReleaseShaderCompiler = oc_glReleaseShaderCompiler_noimpl, + .CullFace = oc_glCullFace_noimpl, + .VertexAttribI4i = oc_glVertexAttribI4i_noimpl, + .GetProgramResourceIndex = oc_glGetProgramResourceIndex_noimpl, + .ShaderBinary = oc_glShaderBinary_noimpl, + .UniformMatrix3x2dv = oc_glUniformMatrix3x2dv_noimpl, + .InvalidateFramebuffer = oc_glInvalidateFramebuffer_noimpl, + .AttachShader = oc_glAttachShader_noimpl, + .FlushMappedBufferRange = oc_glFlushMappedBufferRange_noimpl, + .VertexAttribP3uiv = oc_glVertexAttribP3uiv_noimpl, + .GetActiveUniformName = oc_glGetActiveUniformName_noimpl, + .MapBuffer = oc_glMapBuffer_noimpl, + .DrawBuffers = oc_glDrawBuffers_noimpl, + .GetSynciv = oc_glGetSynciv_noimpl, + .CopyTexSubImage2D = oc_glCopyTexSubImage2D_noimpl, + .ObjectLabel = oc_glObjectLabel_noimpl, + .BufferSubData = oc_glBufferSubData_noimpl, + .Uniform2f = oc_glUniform2f_noimpl, + .DebugMessageCallback = oc_glDebugMessageCallback_noimpl, + .VertexAttribL4dv = oc_glVertexAttribL4dv_noimpl, + .IsProgramPipeline = oc_glIsProgramPipeline_noimpl, + .ResumeTransformFeedback = oc_glResumeTransformFeedback_noimpl, + .VertexAttribI4iv = oc_glVertexAttribI4iv_noimpl, + .GetShaderInfoLog = oc_glGetShaderInfoLog_noimpl, + .GetIntegeri_v = oc_glGetIntegeri_v_noimpl, + .BindVertexBuffer = oc_glBindVertexBuffer_noimpl, + .BlendEquation = oc_glBlendEquation_noimpl, + .VertexAttribL2dv = oc_glVertexAttribL2dv_noimpl, + .VertexAttribI1ui = oc_glVertexAttribI1ui_noimpl, + .VertexAttrib4Nsv = oc_glVertexAttrib4Nsv_noimpl, + .VertexAttribL4d = oc_glVertexAttribL4d_noimpl, + .CopyImageSubData = oc_glCopyImageSubData_noimpl, + .GetFramebufferAttachmentParameteriv = oc_glGetFramebufferAttachmentParameteriv_noimpl, + .VertexAttribL2d = oc_glVertexAttribL2d_noimpl, + .GetSubroutineIndex = oc_glGetSubroutineIndex_noimpl, + .VertexAttribI3uiv = oc_glVertexAttribI3uiv_noimpl, + .VertexAttrib4iv = oc_glVertexAttrib4iv_noimpl, + .BindVertexBuffers = oc_glBindVertexBuffers_noimpl, + .ProgramUniformMatrix2x3dv = oc_glProgramUniformMatrix2x3dv_noimpl, + .PrimitiveBoundingBox = oc_glPrimitiveBoundingBox_noimpl, + .Scissor = oc_glScissor_noimpl, + .ClientWaitSync = oc_glClientWaitSync_noimpl, + .Uniform3ui = oc_glUniform3ui_noimpl, + .VertexAttribP3ui = oc_glVertexAttribP3ui_noimpl, + .Enable = oc_glEnable_noimpl, + .StencilOpSeparate = oc_glStencilOpSeparate_noimpl, + .UniformMatrix2x3dv = oc_glUniformMatrix2x3dv_noimpl, + .ProgramUniformMatrix3dv = oc_glProgramUniformMatrix3dv_noimpl, + .TexImage2DMultisample = oc_glTexImage2DMultisample_noimpl, + .VertexAttrib4Nbv = oc_glVertexAttrib4Nbv_noimpl, + .GetTexImage = oc_glGetTexImage_noimpl, + .VertexAttrib4sv = oc_glVertexAttrib4sv_noimpl, + .PixelStorei = oc_glPixelStorei_noimpl, + .DepthMask = oc_glDepthMask_noimpl, + .TexStorage2D = oc_glTexStorage2D_noimpl, + .Clear = oc_glClear_noimpl, + .UniformMatrix3x4dv = oc_glUniformMatrix3x4dv_noimpl, + .DeleteTransformFeedbacks = oc_glDeleteTransformFeedbacks_noimpl, + .MapBufferRange = oc_glMapBufferRange_noimpl, + .MemoryBarrier = oc_glMemoryBarrier_noimpl, + .ViewportIndexedf = oc_glViewportIndexedf_noimpl, + .VertexAttrib3fv = oc_glVertexAttrib3fv_noimpl, + .ObjectPtrLabel = oc_glObjectPtrLabel_noimpl, + .TexStorage1D = oc_glTexStorage1D_noimpl, + .CompressedTexImage3D = oc_glCompressedTexImage3D_noimpl, + .VertexAttrib1fv = oc_glVertexAttrib1fv_noimpl, + .VertexAttribPointer = oc_glVertexAttribPointer_noimpl, + .GetQueryIndexediv = oc_glGetQueryIndexediv_noimpl, + .CompileShader = oc_glCompileShader_noimpl, + .ProgramUniform1i = oc_glProgramUniform1i_noimpl, + .GetQueryiv = oc_glGetQueryiv_noimpl, + .VertexAttribI1iv = oc_glVertexAttribI1iv_noimpl, + .CopyTexImage2D = oc_glCopyTexImage2D_noimpl, + .GetQueryObjectui64v = oc_glGetQueryObjectui64v_noimpl, + .PointSize = oc_glPointSize_noimpl, + .Disablei = oc_glDisablei_noimpl, + .VertexAttribL1dv = oc_glVertexAttribL1dv_noimpl, + .CreateShader = oc_glCreateShader_noimpl, + .GetString = oc_glGetString_noimpl, + .ViewportArrayv = oc_glViewportArrayv_noimpl, + .ProgramUniform3d = oc_glProgramUniform3d_noimpl, + .VertexAttrib4Nubv = oc_glVertexAttrib4Nubv_noimpl, + .TexParameteri = oc_glTexParameteri_noimpl, + .ProgramUniform4fv = oc_glProgramUniform4fv_noimpl, + .GenerateMipmap = oc_glGenerateMipmap_noimpl, + .CompressedTexSubImage3D = oc_glCompressedTexSubImage3D_noimpl, + .Uniform3f = oc_glUniform3f_noimpl, + .GetUniformIndices = oc_glGetUniformIndices_noimpl, + .VertexAttribLPointer = oc_glVertexAttribLPointer_noimpl, + .VertexAttribI2uiv = oc_glVertexAttribI2uiv_noimpl, + .QueryCounter = oc_glQueryCounter_noimpl, + .ActiveShaderProgram = oc_glActiveShaderProgram_noimpl, + .Uniform1ui = oc_glUniform1ui_noimpl, + .VertexAttribI1i = oc_glVertexAttribI1i_noimpl, + .GetTexParameterIiv = oc_glGetTexParameterIiv_noimpl, + .GetUniformfv = oc_glGetUniformfv_noimpl, + .ProgramUniform2uiv = oc_glProgramUniform2uiv_noimpl, + .GetError = oc_glGetError_noimpl, + .GetActiveUniformBlockName = oc_glGetActiveUniformBlockName_noimpl, + .TextureView = oc_glTextureView_noimpl, + .GetnUniformiv = oc_glGetnUniformiv_noimpl, + .ProgramUniform4dv = oc_glProgramUniform4dv_noimpl, + .ViewportIndexedfv = oc_glViewportIndexedfv_noimpl, + .Hint = oc_glHint_noimpl, + .GetShaderSource = oc_glGetShaderSource_noimpl, + .ProgramUniformMatrix4x3fv = oc_glProgramUniformMatrix4x3fv_noimpl, + .Uniform1iv = oc_glUniform1iv_noimpl, + .VertexAttribI4bv = oc_glVertexAttribI4bv_noimpl, + .UniformMatrix4x2dv = oc_glUniformMatrix4x2dv_noimpl, + .BufferStorage = oc_glBufferStorage_noimpl, + .IsRenderbuffer = oc_glIsRenderbuffer_noimpl, + .GetActiveSubroutineUniformName = oc_glGetActiveSubroutineUniformName_noimpl, + .LinkProgram = oc_glLinkProgram_noimpl, + .GetActiveUniformsiv = oc_glGetActiveUniformsiv_noimpl, + .GetDebugMessageLog = oc_glGetDebugMessageLog_noimpl, + .CopyTexSubImage3D = oc_glCopyTexSubImage3D_noimpl, + .PointParameteri = oc_glPointParameteri_noimpl, + .ProgramUniform3dv = oc_glProgramUniform3dv_noimpl, + .CompressedTexImage1D = oc_glCompressedTexImage1D_noimpl, + .UniformMatrix3x4fv = oc_glUniformMatrix3x4fv_noimpl, + .GenSamplers = oc_glGenSamplers_noimpl, + .GetCompressedTexImage = oc_glGetCompressedTexImage_noimpl, + .DeleteQueries = oc_glDeleteQueries_noimpl, + .GenProgramPipelines = oc_glGenProgramPipelines_noimpl, + .DispatchComputeIndirect = oc_glDispatchComputeIndirect_noimpl, + .VertexAttribIPointer = oc_glVertexAttribIPointer_noimpl, + .CreateProgram = oc_glCreateProgram_noimpl, + .ClearTexSubImage = oc_glClearTexSubImage_noimpl, + .VertexAttrib4d = oc_glVertexAttrib4d_noimpl, + .FrontFace = oc_glFrontFace_noimpl, + .BindTransformFeedback = oc_glBindTransformFeedback_noimpl, + .GetProgramStageiv = oc_glGetProgramStageiv_noimpl, + .SamplerParameterIiv = oc_glSamplerParameterIiv_noimpl, + .GetInteger64v = oc_glGetInteger64v_noimpl, + .CreateShaderProgramv = oc_glCreateShaderProgramv_noimpl, + .BindBuffersRange = oc_glBindBuffersRange_noimpl, + .Uniform3fv = oc_glUniform3fv_noimpl, + .ProgramUniformMatrix4fv = oc_glProgramUniformMatrix4fv_noimpl, + .BindBuffersBase = oc_glBindBuffersBase_noimpl, + .ClearBufferfi = oc_glClearBufferfi_noimpl, + .FramebufferTexture3D = oc_glFramebufferTexture3D_noimpl, + .Disable = oc_glDisable_noimpl, + .ProgramUniform1iv = oc_glProgramUniform1iv_noimpl, + .VertexAttribI2iv = oc_glVertexAttribI2iv_noimpl, + .DepthRangeIndexed = oc_glDepthRangeIndexed_noimpl, + .PatchParameteri = oc_glPatchParameteri_noimpl, + .GetUniformBlockIndex = oc_glGetUniformBlockIndex_noimpl, + .MultiDrawArrays = oc_glMultiDrawArrays_noimpl, + .VertexAttribI4ubv = oc_glVertexAttribI4ubv_noimpl, + .BindBuffer = oc_glBindBuffer_noimpl, + .VertexAttribI3i = oc_glVertexAttribI3i_noimpl, + .GetDoublev = oc_glGetDoublev_noimpl, + .DrawTransformFeedbackStream = oc_glDrawTransformFeedbackStream_noimpl, + .VertexAttribI4uiv = oc_glVertexAttribI4uiv_noimpl, + .RenderbufferStorageMultisample = oc_glRenderbufferStorageMultisample_noimpl, + .VertexAttribL3dv = oc_glVertexAttribL3dv_noimpl, + .StencilMaskSeparate = oc_glStencilMaskSeparate_noimpl, + .ProgramUniform1d = oc_glProgramUniform1d_noimpl, + .Viewport = oc_glViewport_noimpl, + .VertexAttribP1ui = oc_glVertexAttribP1ui_noimpl, + .VertexAttrib4dv = oc_glVertexAttrib4dv_noimpl, + .GenQueries = oc_glGenQueries_noimpl, + .TexParameterIiv = oc_glTexParameterIiv_noimpl, + .ProgramUniform2d = oc_glProgramUniform2d_noimpl, + .ProgramUniform1uiv = oc_glProgramUniform1uiv_noimpl, + .VertexAttrib4Nub = oc_glVertexAttrib4Nub_noimpl, + .IsVertexArray = oc_glIsVertexArray_noimpl, + .ProgramUniform3f = oc_glProgramUniform3f_noimpl, + .ProgramUniform3iv = oc_glProgramUniform3iv_noimpl, + .GetProgramBinary = oc_glGetProgramBinary_noimpl, + .BindRenderbuffer = oc_glBindRenderbuffer_noimpl, + .BindFragDataLocationIndexed = oc_glBindFragDataLocationIndexed_noimpl, + .GetSamplerParameterIiv = oc_glGetSamplerParameterIiv_noimpl, + .VertexAttribDivisor = oc_glVertexAttribDivisor_noimpl, + .ProgramUniformMatrix3x2dv = oc_glProgramUniformMatrix3x2dv_noimpl, + .FramebufferParameteri = oc_glFramebufferParameteri_noimpl, + .GenTransformFeedbacks = oc_glGenTransformFeedbacks_noimpl, + .DeleteSync = oc_glDeleteSync_noimpl, + .ProgramUniform1ui = oc_glProgramUniform1ui_noimpl, + .TexSubImage1D = oc_glTexSubImage1D_noimpl, + .ClearDepthf = oc_glClearDepthf_noimpl, + .ReadPixels = oc_glReadPixels_noimpl, + .VertexAttribI2i = oc_glVertexAttribI2i_noimpl, + .Finish = oc_glFinish_noimpl, + .LineWidth = oc_glLineWidth_noimpl, + .DeleteShader = oc_glDeleteShader_noimpl, + .IsSampler = oc_glIsSampler_noimpl, + .ProgramUniformMatrix4dv = oc_glProgramUniformMatrix4dv_noimpl, + .TransformFeedbackVaryings = oc_glTransformFeedbackVaryings_noimpl, + .BeginConditionalRender = oc_glBeginConditionalRender_noimpl, + .BindSamplers = oc_glBindSamplers_noimpl, + .DeleteProgramPipelines = oc_glDeleteProgramPipelines_noimpl, + .ColorMask = oc_glColorMask_noimpl, + .TexParameterfv = oc_glTexParameterfv_noimpl, + .PushDebugGroup = oc_glPushDebugGroup_noimpl, + .ClearBufferfv = oc_glClearBufferfv_noimpl, + .IsEnabled = oc_glIsEnabled_noimpl, + .VertexAttrib2f = oc_glVertexAttrib2f_noimpl, + .ProgramUniform2f = oc_glProgramUniform2f_noimpl, + .GetSamplerParameterIuiv = oc_glGetSamplerParameterIuiv_noimpl, + .GetInteger64i_v = oc_glGetInteger64i_v_noimpl, + .Uniform2dv = oc_glUniform2dv_noimpl, + .GetBufferSubData = oc_glGetBufferSubData_noimpl, + .MultiDrawElementsIndirect = oc_glMultiDrawElementsIndirect_noimpl, + .ProgramParameteri = oc_glProgramParameteri_noimpl, + .VertexAttribP4ui = oc_glVertexAttribP4ui_noimpl, + .SamplerParameterfv = oc_glSamplerParameterfv_noimpl, + .PointParameterf = oc_glPointParameterf_noimpl, + .UniformMatrix2x4fv = oc_glUniformMatrix2x4fv_noimpl, + .GenBuffers = oc_glGenBuffers_noimpl, + .ProgramUniform2dv = oc_glProgramUniform2dv_noimpl, + .VertexAttribFormat = oc_glVertexAttribFormat_noimpl, + .TexSubImage2D = oc_glTexSubImage2D_noimpl, + .VertexAttrib4ubv = oc_glVertexAttrib4ubv_noimpl, + .GetGraphicsResetStatus = oc_glGetGraphicsResetStatus_noimpl, + .GetProgramInterfaceiv = oc_glGetProgramInterfaceiv_noimpl, + .VertexAttribIFormat = oc_glVertexAttribIFormat_noimpl, + .GetnUniformfv = oc_glGetnUniformfv_noimpl, + .DeleteProgram = oc_glDeleteProgram_noimpl, + .ClampColor = oc_glClampColor_noimpl, + .DrawElementsInstancedBaseVertexBaseInstance = oc_glDrawElementsInstancedBaseVertexBaseInstance_noimpl, + .DrawElements = oc_glDrawElements_noimpl, + .DebugMessageControl = oc_glDebugMessageControl_noimpl, + .GetRenderbufferParameteriv = oc_glGetRenderbufferParameteriv_noimpl, + .DetachShader = oc_glDetachShader_noimpl, + .GenFramebuffers = oc_glGenFramebuffers_noimpl, + .ProvokingVertex = oc_glProvokingVertex_noimpl, + .SampleMaski = oc_glSampleMaski_noimpl, + .EndQueryIndexed = oc_glEndQueryIndexed_noimpl, + .ProgramUniform1f = oc_glProgramUniform1f_noimpl, + .BindFramebuffer = oc_glBindFramebuffer_noimpl, + .BeginQueryIndexed = oc_glBeginQueryIndexed_noimpl, + .UniformSubroutinesuiv = oc_glUniformSubroutinesuiv_noimpl, + .GetUniformiv = oc_glGetUniformiv_noimpl, + .FramebufferTexture = oc_glFramebufferTexture_noimpl, + .PointParameterfv = oc_glPointParameterfv_noimpl, + .IsTransformFeedback = oc_glIsTransformFeedback_noimpl, + .CheckFramebufferStatus = oc_glCheckFramebufferStatus_noimpl, + .ShaderSource = oc_glShaderSource_noimpl, + .UniformMatrix2x4dv = oc_glUniformMatrix2x4dv_noimpl, + .BindImageTextures = oc_glBindImageTextures_noimpl, + .CopyTexImage1D = oc_glCopyTexImage1D_noimpl, + .UniformMatrix3dv = oc_glUniformMatrix3dv_noimpl, + .ProgramUniform1dv = oc_glProgramUniform1dv_noimpl, + .BlitFramebuffer = oc_glBlitFramebuffer_noimpl, + .PopDebugGroup = oc_glPopDebugGroup_noimpl, + .TexParameterIuiv = oc_glTexParameterIuiv_noimpl, + .VertexAttrib2d = oc_glVertexAttrib2d_noimpl, + .TexImage1D = oc_glTexImage1D_noimpl, + .GetObjectPtrLabel = oc_glGetObjectPtrLabel_noimpl, + .StencilMask = oc_glStencilMask_noimpl, + .BeginQuery = oc_glBeginQuery_noimpl, + .UniformMatrix4fv = oc_glUniformMatrix4fv_noimpl, + .IsSync = oc_glIsSync_noimpl, + .Uniform3dv = oc_glUniform3dv_noimpl, + .ProgramUniform2fv = oc_glProgramUniform2fv_noimpl, + .VertexAttribI4sv = oc_glVertexAttribI4sv_noimpl, + .ScissorArrayv = oc_glScissorArrayv_noimpl, + .VertexAttribP1uiv = oc_glVertexAttribP1uiv_noimpl, + .Uniform2uiv = oc_glUniform2uiv_noimpl, + .DeleteBuffers = oc_glDeleteBuffers_noimpl, + .ProgramUniform3ui = oc_glProgramUniform3ui_noimpl, + .FramebufferTextureLayer = oc_glFramebufferTextureLayer_noimpl, + .EndTransformFeedback = oc_glEndTransformFeedback_noimpl, + .BlendFuncSeparatei = oc_glBlendFuncSeparatei_noimpl, + .DrawTransformFeedbackInstanced = oc_glDrawTransformFeedbackInstanced_noimpl, + .DrawRangeElementsBaseVertex = oc_glDrawRangeElementsBaseVertex_noimpl, + .VertexAttrib1f = oc_glVertexAttrib1f_noimpl, + .GetUniformSubroutineuiv = oc_glGetUniformSubroutineuiv_noimpl, + .DisableVertexAttribArray = oc_glDisableVertexAttribArray_noimpl, + .ProgramUniformMatrix3x2fv = oc_glProgramUniformMatrix3x2fv_noimpl, + .VertexAttribI4usv = oc_glVertexAttribI4usv_noimpl, + .GetObjectLabel = oc_glGetObjectLabel_noimpl, + .BindAttribLocation = oc_glBindAttribLocation_noimpl, + .Uniform1f = oc_glUniform1f_noimpl, + .GetUniformdv = oc_glGetUniformdv_noimpl, + .GetUniformLocation = oc_glGetUniformLocation_noimpl, + .GetSubroutineUniformLocation = oc_glGetSubroutineUniformLocation_noimpl, + .GetTexParameterIuiv = oc_glGetTexParameterIuiv_noimpl, + .SamplerParameterf = oc_glSamplerParameterf_noimpl, + .VertexAttribL3d = oc_glVertexAttribL3d_noimpl, + .TexImage3DMultisample = oc_glTexImage3DMultisample_noimpl, + .TexImage3D = oc_glTexImage3D_noimpl, + .RenderbufferStorage = oc_glRenderbufferStorage_noimpl, + .EnableVertexAttribArray = oc_glEnableVertexAttribArray_noimpl, + .VertexAttribP4uiv = oc_glVertexAttribP4uiv_noimpl, + .Uniform4d = oc_glUniform4d_noimpl, + .VertexAttrib4s = oc_glVertexAttrib4s_noimpl, + .DrawElementsInstancedBaseVertex = oc_glDrawElementsInstancedBaseVertex_noimpl, + .VertexAttrib3s = oc_glVertexAttrib3s_noimpl, + .ProgramUniform2iv = oc_glProgramUniform2iv_noimpl, + .StencilFuncSeparate = oc_glStencilFuncSeparate_noimpl, + .DeleteFramebuffers = oc_glDeleteFramebuffers_noimpl, + .DepthRange = oc_glDepthRange_noimpl, + .UniformMatrix3x2fv = oc_glUniformMatrix3x2fv_noimpl, + .ProgramUniformMatrix2dv = oc_glProgramUniformMatrix2dv_noimpl, + .ShaderStorageBlockBinding = oc_glShaderStorageBlockBinding_noimpl, + .ClearDepth = oc_glClearDepth_noimpl, + .VertexAttrib2dv = oc_glVertexAttrib2dv_noimpl, + .SamplerParameterIuiv = oc_glSamplerParameterIuiv_noimpl, + .GetVertexAttribLdv = oc_glGetVertexAttribLdv_noimpl, + .ProgramUniformMatrix3x4dv = oc_glProgramUniformMatrix3x4dv_noimpl, + .DepthRangeArrayv = oc_glDepthRangeArrayv_noimpl, + .GetActiveUniform = oc_glGetActiveUniform_noimpl, + .PatchParameterfv = oc_glPatchParameterfv_noimpl, + .InvalidateTexImage = oc_glInvalidateTexImage_noimpl, + .VertexAttrib3f = oc_glVertexAttrib3f_noimpl, + .ProgramUniform4iv = oc_glProgramUniform4iv_noimpl, + .ProgramUniform4d = oc_glProgramUniform4d_noimpl, + .IsFramebuffer = oc_glIsFramebuffer_noimpl, + .PixelStoref = oc_glPixelStoref_noimpl, + .ProgramUniform4uiv = oc_glProgramUniform4uiv_noimpl, + .ProgramUniformMatrix4x2dv = oc_glProgramUniformMatrix4x2dv_noimpl, + .FenceSync = oc_glFenceSync_noimpl, + .GetBufferParameteri64v = oc_glGetBufferParameteri64v_noimpl, + .StencilOp = oc_glStencilOp_noimpl, + .ClearBufferData = oc_glClearBufferData_noimpl, + .GetnUniformuiv = oc_glGetnUniformuiv_noimpl, + .GetProgramResourceiv = oc_glGetProgramResourceiv_noimpl, + .GetVertexAttribdv = oc_glGetVertexAttribdv_noimpl, + .GetTransformFeedbackVarying = oc_glGetTransformFeedbackVarying_noimpl, + .VertexAttrib2fv = oc_glVertexAttrib2fv_noimpl, + .GetBooleani_v = oc_glGetBooleani_v_noimpl, + .ColorMaski = oc_glColorMaski_noimpl, + .InvalidateBufferSubData = oc_glInvalidateBufferSubData_noimpl, + .UniformMatrix4dv = oc_glUniformMatrix4dv_noimpl, + .IsQuery = oc_glIsQuery_noimpl, + .Uniform4ui = oc_glUniform4ui_noimpl, + .Uniform4i = oc_glUniform4i_noimpl, + .GetSamplerParameteriv = oc_glGetSamplerParameteriv_noimpl, + .MultiDrawElementsBaseVertex = oc_glMultiDrawElementsBaseVertex_noimpl, + .VertexAttribI1uiv = oc_glVertexAttribI1uiv_noimpl, + .GetIntegerv = oc_glGetIntegerv_noimpl, + .UniformMatrix2x3fv = oc_glUniformMatrix2x3fv_noimpl, + .TexImage2D = oc_glTexImage2D_noimpl, + .GetAttachedShaders = oc_glGetAttachedShaders_noimpl, + .Uniform2d = oc_glUniform2d_noimpl, + .MemoryBarrierByRegion = oc_glMemoryBarrierByRegion_noimpl, + .UniformMatrix2fv = oc_glUniformMatrix2fv_noimpl, + .PrimitiveRestartIndex = oc_glPrimitiveRestartIndex_noimpl, + .GetVertexAttribiv = oc_glGetVertexAttribiv_noimpl, + .GetAttribLocation = oc_glGetAttribLocation_noimpl, + .TexStorage2DMultisample = oc_glTexStorage2DMultisample_noimpl, + .CompressedTexSubImage2D = oc_glCompressedTexSubImage2D_noimpl, + .GetVertexAttribfv = oc_glGetVertexAttribfv_noimpl, + .GetBufferParameteriv = oc_glGetBufferParameteriv_noimpl, + .TexParameterf = oc_glTexParameterf_noimpl, + .FramebufferTexture2D = oc_glFramebufferTexture2D_noimpl, + .GetActiveAttrib = oc_glGetActiveAttrib_noimpl, + .InvalidateTexSubImage = oc_glInvalidateTexSubImage_noimpl, + .DeleteVertexArrays = oc_glDeleteVertexArrays_noimpl, + .VertexAttribI2ui = oc_glVertexAttribI2ui_noimpl, + .PointParameteriv = oc_glPointParameteriv_noimpl, + .GetPointerv = oc_glGetPointerv_noimpl, + .Enablei = oc_glEnablei_noimpl, + .BindBufferRange = oc_glBindBufferRange_noimpl, + .DrawArraysInstanced = oc_glDrawArraysInstanced_noimpl, + .DeleteTextures = oc_glDeleteTextures_noimpl, + .VertexAttrib4Niv = oc_glVertexAttrib4Niv_noimpl, + .MultiDrawElements = oc_glMultiDrawElements_noimpl, + .GetProgramiv = oc_glGetProgramiv_noimpl, + .DepthFunc = oc_glDepthFunc_noimpl, + .GenTextures = oc_glGenTextures_noimpl, + .GetInternalformativ = oc_glGetInternalformativ_noimpl, + .ProgramUniform3i = oc_glProgramUniform3i_noimpl, + .ScissorIndexed = oc_glScissorIndexed_noimpl, + .VertexAttrib2sv = oc_glVertexAttrib2sv_noimpl, + .TexStorage3DMultisample = oc_glTexStorage3DMultisample_noimpl, + .Uniform2iv = oc_glUniform2iv_noimpl, + .DrawArraysInstancedBaseInstance = oc_glDrawArraysInstancedBaseInstance_noimpl, + .VertexAttribI3ui = oc_glVertexAttribI3ui_noimpl, + .DeleteSamplers = oc_glDeleteSamplers_noimpl, + .GenVertexArrays = oc_glGenVertexArrays_noimpl, + .GetFramebufferParameteriv = oc_glGetFramebufferParameteriv_noimpl, + .PolygonMode = oc_glPolygonMode_noimpl, + .ProgramUniformMatrix2x4fv = oc_glProgramUniformMatrix2x4fv_noimpl, + .GetProgramResourceName = oc_glGetProgramResourceName_noimpl, + .SamplerParameteriv = oc_glSamplerParameteriv_noimpl, + .GetActiveSubroutineUniformiv = oc_glGetActiveSubroutineUniformiv_noimpl, + .GetStringi = oc_glGetStringi_noimpl, + .VertexAttribLFormat = oc_glVertexAttribLFormat_noimpl, + .VertexAttrib3d = oc_glVertexAttrib3d_noimpl, + .BindVertexArray = oc_glBindVertexArray_noimpl, + .UnmapBuffer = oc_glUnmapBuffer_noimpl, + .DrawElementsInstancedBaseInstance = oc_glDrawElementsInstancedBaseInstance_noimpl, + .Uniform4uiv = oc_glUniform4uiv_noimpl, + .FramebufferTexture1D = oc_glFramebufferTexture1D_noimpl, + .DrawTransformFeedbackStreamInstanced = oc_glDrawTransformFeedbackStreamInstanced_noimpl, + .StencilFunc = oc_glStencilFunc_noimpl, + .ValidateProgram = oc_glValidateProgram_noimpl, + .Flush = oc_glFlush_noimpl, + .ProgramUniform3uiv = oc_glProgramUniform3uiv_noimpl, + .DeleteRenderbuffers = oc_glDeleteRenderbuffers_noimpl, + .VertexAttrib4fv = oc_glVertexAttrib4fv_noimpl, + .UniformMatrix2dv = oc_glUniformMatrix2dv_noimpl, + .GetFragDataIndex = oc_glGetFragDataIndex_noimpl, + .Uniform3iv = oc_glUniform3iv_noimpl, + .MinSampleShading = oc_glMinSampleShading_noimpl, + .GetBooleanv = oc_glGetBooleanv_noimpl, + .GetMultisamplefv = oc_glGetMultisamplefv_noimpl, + .GetVertexAttribIuiv = oc_glGetVertexAttribIuiv_noimpl, + .GetProgramInfoLog = oc_glGetProgramInfoLog_noimpl, + .Uniform4fv = oc_glUniform4fv_noimpl, + .DrawBuffer = oc_glDrawBuffer_noimpl, + .Uniform1i = oc_glUniform1i_noimpl, + .ProgramUniform4ui = oc_glProgramUniform4ui_noimpl, + .ProgramUniformMatrix3fv = oc_glProgramUniformMatrix3fv_noimpl, + .BlendEquationSeparate = oc_glBlendEquationSeparate_noimpl, + .BindProgramPipeline = oc_glBindProgramPipeline_noimpl, + .GetDoublei_v = oc_glGetDoublei_v_noimpl, + .BufferData = oc_glBufferData_noimpl, + .ClearColor = oc_glClearColor_noimpl, + .ProgramUniform4i = oc_glProgramUniform4i_noimpl, + .GetTexLevelParameteriv = oc_glGetTexLevelParameteriv_noimpl, + .GetActiveUniformBlockiv = oc_glGetActiveUniformBlockiv_noimpl, + .ProgramUniform1fv = oc_glProgramUniform1fv_noimpl, + .PauseTransformFeedback = oc_glPauseTransformFeedback_noimpl, + .GetBufferPointerv = oc_glGetBufferPointerv_noimpl, + .InvalidateSubFramebuffer = oc_glInvalidateSubFramebuffer_noimpl, + .ScissorIndexedv = oc_glScissorIndexedv_noimpl, + .Uniform2ui = oc_glUniform2ui_noimpl, + .BindTexture = oc_glBindTexture_noimpl, + .DrawElementsInstanced = oc_glDrawElementsInstanced_noimpl, + .ProgramUniform4f = oc_glProgramUniform4f_noimpl, + .BindBufferBase = oc_glBindBufferBase_noimpl, + .IsShader = oc_glIsShader_noimpl, + .ClearBufferSubData = oc_glClearBufferSubData_noimpl, + .VertexAttrib4Nuiv = oc_glVertexAttrib4Nuiv_noimpl, + .DrawArraysIndirect = oc_glDrawArraysIndirect_noimpl, + .VertexAttrib4usv = oc_glVertexAttrib4usv_noimpl, + .Uniform1d = oc_glUniform1d_noimpl, + .ClearTexImage = oc_glClearTexImage_noimpl, + .Uniform1uiv = oc_glUniform1uiv_noimpl, + .BindSampler = oc_glBindSampler_noimpl, + .GetTexLevelParameterfv = oc_glGetTexLevelParameterfv_noimpl, + .ClearBufferiv = oc_glClearBufferiv_noimpl, + .LogicOp = oc_glLogicOp_noimpl, + .ActiveTexture = oc_glActiveTexture_noimpl, + .GetFragDataLocation = oc_glGetFragDataLocation_noimpl, + .BlendColor = oc_glBlendColor_noimpl, + .UniformMatrix4x3fv = oc_glUniformMatrix4x3fv_noimpl, + .ProgramUniform3fv = oc_glProgramUniform3fv_noimpl, + .Uniform1fv = oc_glUniform1fv_noimpl, + .DrawElementsBaseVertex = oc_glDrawElementsBaseVertex_noimpl, + .Uniform4f = oc_glUniform4f_noimpl, + .BlendEquationSeparatei = oc_glBlendEquationSeparatei_noimpl, + .BlendFuncSeparate = oc_glBlendFuncSeparate_noimpl, + .ClearBufferuiv = oc_glClearBufferuiv_noimpl, + .CopyTexSubImage1D = oc_glCopyTexSubImage1D_noimpl, + .DrawTransformFeedback = oc_glDrawTransformFeedback_noimpl, + .ReadBuffer = oc_glReadBuffer_noimpl, + .CopyBufferSubData = oc_glCopyBufferSubData_noimpl, + .GetUniformuiv = oc_glGetUniformuiv_noimpl, + .PolygonOffset = oc_glPolygonOffset_noimpl, + .DispatchCompute = oc_glDispatchCompute_noimpl, + .BindImageTexture = oc_glBindImageTexture_noimpl, + .UniformMatrix4x3dv = oc_glUniformMatrix4x3dv_noimpl, + .GenRenderbuffers = oc_glGenRenderbuffers_noimpl, +}; + +void oc_gl_load_gl41(oc_gl_api* api, oc_gl_load_proc loadProc) +{ + api->name = "gl41"; + api->GetFloatv = loadProc("glGetFloatv"); + api->TexBufferRange = oc_glTexBufferRange_noimpl; + api->IsBuffer = loadProc("glIsBuffer"); + api->IsTexture = loadProc("glIsTexture"); + api->DepthRangef = loadProc("glDepthRangef"); + api->EndConditionalRender = loadProc("glEndConditionalRender"); + api->BlendFunci = loadProc("glBlendFunci"); + api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); + api->WaitSync = loadProc("glWaitSync"); + api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); + api->ProgramUniformMatrix4x3dv = loadProc("glProgramUniformMatrix4x3dv"); + api->VertexAttrib1dv = loadProc("glVertexAttrib1dv"); + api->SamplerParameteri = loadProc("glSamplerParameteri"); + api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); + api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); + api->VertexAttrib1d = loadProc("glVertexAttrib1d"); + api->TexBuffer = loadProc("glTexBuffer"); + api->InvalidateBufferData = oc_glInvalidateBufferData_noimpl; + api->ProgramUniform2i = loadProc("glProgramUniform2i"); + api->Uniform4dv = loadProc("glUniform4dv"); + api->UseProgram = loadProc("glUseProgram"); + api->VertexAttribI3iv = loadProc("glVertexAttribI3iv"); + api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); + api->VertexAttrib4uiv = loadProc("glVertexAttrib4uiv"); + api->GetQueryObjectiv = loadProc("glGetQueryObjectiv"); + api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); + api->BlendEquationi = loadProc("glBlendEquationi"); + api->GetActiveSubroutineName = loadProc("glGetActiveSubroutineName"); + api->VertexAttrib2s = loadProc("glVertexAttrib2s"); + api->VertexAttribL1d = loadProc("glVertexAttribL1d"); + api->BindTextures = oc_glBindTextures_noimpl; + api->VertexAttrib3sv = loadProc("glVertexAttrib3sv"); + api->GetFloati_v = loadProc("glGetFloati_v"); + api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); + api->ClearStencil = loadProc("glClearStencil"); + api->Uniform3i = loadProc("glUniform3i"); + api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); + api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); + api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); + api->GetShaderiv = loadProc("glGetShaderiv"); + api->ReadnPixels = oc_glReadnPixels_noimpl; + api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); + api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); + api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); + api->TexSubImage3D = loadProc("glTexSubImage3D"); + api->GetProgramResourceLocationIndex = oc_glGetProgramResourceLocationIndex_noimpl; + api->BlendFunc = loadProc("glBlendFunc"); + api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); + api->Uniform3d = loadProc("glUniform3d"); + api->VertexAttrib1sv = loadProc("glVertexAttrib1sv"); + api->BindFragDataLocation = loadProc("glBindFragDataLocation"); + api->VertexAttrib4bv = loadProc("glVertexAttrib4bv"); + api->Uniform4iv = loadProc("glUniform4iv"); + api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); + api->DrawArrays = loadProc("glDrawArrays"); + api->ProgramBinary = loadProc("glProgramBinary"); + api->VertexAttrib4f = loadProc("glVertexAttrib4f"); + api->VertexAttribP2uiv = loadProc("glVertexAttribP2uiv"); + api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); + api->Uniform2i = loadProc("glUniform2i"); + api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); + api->UniformBlockBinding = loadProc("glUniformBlockBinding"); + api->SampleCoverage = loadProc("glSampleCoverage"); + api->VertexAttrib4Nusv = loadProc("glVertexAttrib4Nusv"); + api->ProgramUniformMatrix2x4dv = loadProc("glProgramUniformMatrix2x4dv"); + api->Uniform3uiv = loadProc("glUniform3uiv"); + api->VertexAttrib1s = loadProc("glVertexAttrib1s"); + api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); + api->BlendBarrier = oc_glBlendBarrier_noimpl; + api->DrawRangeElements = loadProc("glDrawRangeElements"); + api->TexStorage3D = oc_glTexStorage3D_noimpl; + api->GetInternalformati64v = oc_glGetInternalformati64v_noimpl; + api->GetQueryObjecti64v = loadProc("glGetQueryObjecti64v"); + api->CompressedTexSubImage1D = loadProc("glCompressedTexSubImage1D"); + api->VertexAttrib3dv = loadProc("glVertexAttrib3dv"); + api->VertexBindingDivisor = oc_glVertexBindingDivisor_noimpl; + api->UseProgramStages = loadProc("glUseProgramStages"); + api->VertexAttribBinding = oc_glVertexAttribBinding_noimpl; + api->DebugMessageInsert = oc_glDebugMessageInsert_noimpl; + api->GetTexParameteriv = loadProc("glGetTexParameteriv"); + api->MultiDrawArraysIndirect = oc_glMultiDrawArraysIndirect_noimpl; + api->GetTexParameterfv = loadProc("glGetTexParameterfv"); + api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); + api->EndQuery = loadProc("glEndQuery"); + api->GetProgramResourceLocation = oc_glGetProgramResourceLocation_noimpl; + api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); + api->VertexAttribP2ui = loadProc("glVertexAttribP2ui"); + api->IsEnabledi = loadProc("glIsEnabledi"); + api->GetActiveAtomicCounterBufferiv = oc_glGetActiveAtomicCounterBufferiv_noimpl; + api->IsProgram = loadProc("glIsProgram"); + api->Uniform1dv = loadProc("glUniform1dv"); + api->TexParameteriv = loadProc("glTexParameteriv"); + api->Uniform2fv = loadProc("glUniform2fv"); + api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); + api->CullFace = loadProc("glCullFace"); + api->VertexAttribI4i = loadProc("glVertexAttribI4i"); + api->GetProgramResourceIndex = oc_glGetProgramResourceIndex_noimpl; + api->ShaderBinary = loadProc("glShaderBinary"); + api->UniformMatrix3x2dv = loadProc("glUniformMatrix3x2dv"); + api->InvalidateFramebuffer = oc_glInvalidateFramebuffer_noimpl; + api->AttachShader = loadProc("glAttachShader"); + api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); + api->VertexAttribP3uiv = loadProc("glVertexAttribP3uiv"); + api->GetActiveUniformName = loadProc("glGetActiveUniformName"); + api->MapBuffer = loadProc("glMapBuffer"); + api->DrawBuffers = loadProc("glDrawBuffers"); + api->GetSynciv = loadProc("glGetSynciv"); + api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); + api->ObjectLabel = oc_glObjectLabel_noimpl; + api->BufferSubData = loadProc("glBufferSubData"); + api->Uniform2f = loadProc("glUniform2f"); + api->DebugMessageCallback = oc_glDebugMessageCallback_noimpl; + api->VertexAttribL4dv = loadProc("glVertexAttribL4dv"); + api->IsProgramPipeline = loadProc("glIsProgramPipeline"); + api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); + api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); + api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); + api->GetIntegeri_v = loadProc("glGetIntegeri_v"); + api->BindVertexBuffer = oc_glBindVertexBuffer_noimpl; + api->BlendEquation = loadProc("glBlendEquation"); + api->VertexAttribL2dv = loadProc("glVertexAttribL2dv"); + api->VertexAttribI1ui = loadProc("glVertexAttribI1ui"); + api->VertexAttrib4Nsv = loadProc("glVertexAttrib4Nsv"); + api->VertexAttribL4d = loadProc("glVertexAttribL4d"); + api->CopyImageSubData = oc_glCopyImageSubData_noimpl; + api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); + api->VertexAttribL2d = loadProc("glVertexAttribL2d"); + api->GetSubroutineIndex = loadProc("glGetSubroutineIndex"); + api->VertexAttribI3uiv = loadProc("glVertexAttribI3uiv"); + api->VertexAttrib4iv = loadProc("glVertexAttrib4iv"); + api->BindVertexBuffers = oc_glBindVertexBuffers_noimpl; + api->ProgramUniformMatrix2x3dv = loadProc("glProgramUniformMatrix2x3dv"); + api->PrimitiveBoundingBox = oc_glPrimitiveBoundingBox_noimpl; + api->Scissor = loadProc("glScissor"); + api->ClientWaitSync = loadProc("glClientWaitSync"); + api->Uniform3ui = loadProc("glUniform3ui"); + api->VertexAttribP3ui = loadProc("glVertexAttribP3ui"); + api->Enable = loadProc("glEnable"); + api->StencilOpSeparate = loadProc("glStencilOpSeparate"); + api->UniformMatrix2x3dv = loadProc("glUniformMatrix2x3dv"); + api->ProgramUniformMatrix3dv = loadProc("glProgramUniformMatrix3dv"); + api->TexImage2DMultisample = loadProc("glTexImage2DMultisample"); + api->VertexAttrib4Nbv = loadProc("glVertexAttrib4Nbv"); + api->GetTexImage = loadProc("glGetTexImage"); + api->VertexAttrib4sv = loadProc("glVertexAttrib4sv"); + api->PixelStorei = loadProc("glPixelStorei"); + api->DepthMask = loadProc("glDepthMask"); + api->TexStorage2D = oc_glTexStorage2D_noimpl; + api->Clear = loadProc("glClear"); + api->UniformMatrix3x4dv = loadProc("glUniformMatrix3x4dv"); + api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); + api->MapBufferRange = loadProc("glMapBufferRange"); + api->MemoryBarrier = oc_glMemoryBarrier_noimpl; + api->ViewportIndexedf = loadProc("glViewportIndexedf"); + api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); + api->ObjectPtrLabel = oc_glObjectPtrLabel_noimpl; + api->TexStorage1D = oc_glTexStorage1D_noimpl; + api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); + api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); + api->VertexAttribPointer = loadProc("glVertexAttribPointer"); + api->GetQueryIndexediv = loadProc("glGetQueryIndexediv"); + api->CompileShader = loadProc("glCompileShader"); + api->ProgramUniform1i = loadProc("glProgramUniform1i"); + api->GetQueryiv = loadProc("glGetQueryiv"); + api->VertexAttribI1iv = loadProc("glVertexAttribI1iv"); + api->CopyTexImage2D = loadProc("glCopyTexImage2D"); + api->GetQueryObjectui64v = loadProc("glGetQueryObjectui64v"); + api->PointSize = loadProc("glPointSize"); + api->Disablei = loadProc("glDisablei"); + api->VertexAttribL1dv = loadProc("glVertexAttribL1dv"); + api->CreateShader = loadProc("glCreateShader"); + api->GetString = loadProc("glGetString"); + api->ViewportArrayv = loadProc("glViewportArrayv"); + api->ProgramUniform3d = loadProc("glProgramUniform3d"); + api->VertexAttrib4Nubv = loadProc("glVertexAttrib4Nubv"); + api->TexParameteri = loadProc("glTexParameteri"); + api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); + api->GenerateMipmap = loadProc("glGenerateMipmap"); + api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); + api->Uniform3f = loadProc("glUniform3f"); + api->GetUniformIndices = loadProc("glGetUniformIndices"); + api->VertexAttribLPointer = loadProc("glVertexAttribLPointer"); + api->VertexAttribI2uiv = loadProc("glVertexAttribI2uiv"); + api->QueryCounter = loadProc("glQueryCounter"); + api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); + api->Uniform1ui = loadProc("glUniform1ui"); + api->VertexAttribI1i = loadProc("glVertexAttribI1i"); + api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); + api->GetUniformfv = loadProc("glGetUniformfv"); + api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); + api->GetError = loadProc("glGetError"); + api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); + api->TextureView = oc_glTextureView_noimpl; + api->GetnUniformiv = oc_glGetnUniformiv_noimpl; + api->ProgramUniform4dv = loadProc("glProgramUniform4dv"); + api->ViewportIndexedfv = loadProc("glViewportIndexedfv"); + api->Hint = loadProc("glHint"); + api->GetShaderSource = loadProc("glGetShaderSource"); + api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); + api->Uniform1iv = loadProc("glUniform1iv"); + api->VertexAttribI4bv = loadProc("glVertexAttribI4bv"); + api->UniformMatrix4x2dv = loadProc("glUniformMatrix4x2dv"); + api->BufferStorage = oc_glBufferStorage_noimpl; + api->IsRenderbuffer = loadProc("glIsRenderbuffer"); + api->GetActiveSubroutineUniformName = loadProc("glGetActiveSubroutineUniformName"); + api->LinkProgram = loadProc("glLinkProgram"); + api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); + api->GetDebugMessageLog = oc_glGetDebugMessageLog_noimpl; + api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); + api->PointParameteri = loadProc("glPointParameteri"); + api->ProgramUniform3dv = loadProc("glProgramUniform3dv"); + api->CompressedTexImage1D = loadProc("glCompressedTexImage1D"); + api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); + api->GenSamplers = loadProc("glGenSamplers"); + api->GetCompressedTexImage = loadProc("glGetCompressedTexImage"); + api->DeleteQueries = loadProc("glDeleteQueries"); + api->GenProgramPipelines = loadProc("glGenProgramPipelines"); + api->DispatchComputeIndirect = oc_glDispatchComputeIndirect_noimpl; + api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); + api->CreateProgram = loadProc("glCreateProgram"); + api->ClearTexSubImage = oc_glClearTexSubImage_noimpl; + api->VertexAttrib4d = loadProc("glVertexAttrib4d"); + api->FrontFace = loadProc("glFrontFace"); + api->BindTransformFeedback = loadProc("glBindTransformFeedback"); + api->GetProgramStageiv = loadProc("glGetProgramStageiv"); + api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); + api->GetInteger64v = loadProc("glGetInteger64v"); + api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); + api->BindBuffersRange = oc_glBindBuffersRange_noimpl; + api->Uniform3fv = loadProc("glUniform3fv"); + api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); + api->BindBuffersBase = oc_glBindBuffersBase_noimpl; + api->ClearBufferfi = loadProc("glClearBufferfi"); + api->FramebufferTexture3D = loadProc("glFramebufferTexture3D"); + api->Disable = loadProc("glDisable"); + api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); + api->VertexAttribI2iv = loadProc("glVertexAttribI2iv"); + api->DepthRangeIndexed = loadProc("glDepthRangeIndexed"); + api->PatchParameteri = loadProc("glPatchParameteri"); + api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); + api->MultiDrawArrays = loadProc("glMultiDrawArrays"); + api->VertexAttribI4ubv = loadProc("glVertexAttribI4ubv"); + api->BindBuffer = loadProc("glBindBuffer"); + api->VertexAttribI3i = loadProc("glVertexAttribI3i"); + api->GetDoublev = loadProc("glGetDoublev"); + api->DrawTransformFeedbackStream = loadProc("glDrawTransformFeedbackStream"); + api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); + api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); + api->VertexAttribL3dv = loadProc("glVertexAttribL3dv"); + api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); + api->ProgramUniform1d = loadProc("glProgramUniform1d"); + api->Viewport = loadProc("glViewport"); + api->VertexAttribP1ui = loadProc("glVertexAttribP1ui"); + api->VertexAttrib4dv = loadProc("glVertexAttrib4dv"); + api->GenQueries = loadProc("glGenQueries"); + api->TexParameterIiv = loadProc("glTexParameterIiv"); + api->ProgramUniform2d = loadProc("glProgramUniform2d"); + api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); + api->VertexAttrib4Nub = loadProc("glVertexAttrib4Nub"); + api->IsVertexArray = loadProc("glIsVertexArray"); + api->ProgramUniform3f = loadProc("glProgramUniform3f"); + api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); + api->GetProgramBinary = loadProc("glGetProgramBinary"); + api->BindRenderbuffer = loadProc("glBindRenderbuffer"); + api->BindFragDataLocationIndexed = loadProc("glBindFragDataLocationIndexed"); + api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); + api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); + api->ProgramUniformMatrix3x2dv = loadProc("glProgramUniformMatrix3x2dv"); + api->FramebufferParameteri = oc_glFramebufferParameteri_noimpl; + api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); + api->DeleteSync = loadProc("glDeleteSync"); + api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); + api->TexSubImage1D = loadProc("glTexSubImage1D"); + api->ClearDepthf = loadProc("glClearDepthf"); + api->ReadPixels = loadProc("glReadPixels"); + api->VertexAttribI2i = loadProc("glVertexAttribI2i"); + api->Finish = loadProc("glFinish"); + api->LineWidth = loadProc("glLineWidth"); + api->DeleteShader = loadProc("glDeleteShader"); + api->IsSampler = loadProc("glIsSampler"); + api->ProgramUniformMatrix4dv = loadProc("glProgramUniformMatrix4dv"); + api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); + api->BeginConditionalRender = loadProc("glBeginConditionalRender"); + api->BindSamplers = oc_glBindSamplers_noimpl; + api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); + api->ColorMask = loadProc("glColorMask"); + api->TexParameterfv = loadProc("glTexParameterfv"); + api->PushDebugGroup = oc_glPushDebugGroup_noimpl; + api->ClearBufferfv = loadProc("glClearBufferfv"); + api->IsEnabled = loadProc("glIsEnabled"); + api->VertexAttrib2f = loadProc("glVertexAttrib2f"); + api->ProgramUniform2f = loadProc("glProgramUniform2f"); + api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); + api->GetInteger64i_v = loadProc("glGetInteger64i_v"); + api->Uniform2dv = loadProc("glUniform2dv"); + api->GetBufferSubData = loadProc("glGetBufferSubData"); + api->MultiDrawElementsIndirect = oc_glMultiDrawElementsIndirect_noimpl; + api->ProgramParameteri = loadProc("glProgramParameteri"); + api->VertexAttribP4ui = loadProc("glVertexAttribP4ui"); + api->SamplerParameterfv = loadProc("glSamplerParameterfv"); + api->PointParameterf = loadProc("glPointParameterf"); + api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); + api->GenBuffers = loadProc("glGenBuffers"); + api->ProgramUniform2dv = loadProc("glProgramUniform2dv"); + api->VertexAttribFormat = oc_glVertexAttribFormat_noimpl; + api->TexSubImage2D = loadProc("glTexSubImage2D"); + api->VertexAttrib4ubv = loadProc("glVertexAttrib4ubv"); + api->GetGraphicsResetStatus = oc_glGetGraphicsResetStatus_noimpl; + api->GetProgramInterfaceiv = oc_glGetProgramInterfaceiv_noimpl; + api->VertexAttribIFormat = oc_glVertexAttribIFormat_noimpl; + api->GetnUniformfv = oc_glGetnUniformfv_noimpl; + api->DeleteProgram = loadProc("glDeleteProgram"); + api->ClampColor = loadProc("glClampColor"); + api->DrawElementsInstancedBaseVertexBaseInstance = oc_glDrawElementsInstancedBaseVertexBaseInstance_noimpl; + api->DrawElements = loadProc("glDrawElements"); + api->DebugMessageControl = oc_glDebugMessageControl_noimpl; + api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); + api->DetachShader = loadProc("glDetachShader"); + api->GenFramebuffers = loadProc("glGenFramebuffers"); + api->ProvokingVertex = loadProc("glProvokingVertex"); + api->SampleMaski = loadProc("glSampleMaski"); + api->EndQueryIndexed = loadProc("glEndQueryIndexed"); + api->ProgramUniform1f = loadProc("glProgramUniform1f"); + api->BindFramebuffer = loadProc("glBindFramebuffer"); + api->BeginQueryIndexed = loadProc("glBeginQueryIndexed"); + api->UniformSubroutinesuiv = loadProc("glUniformSubroutinesuiv"); + api->GetUniformiv = loadProc("glGetUniformiv"); + api->FramebufferTexture = loadProc("glFramebufferTexture"); + api->PointParameterfv = loadProc("glPointParameterfv"); + api->IsTransformFeedback = loadProc("glIsTransformFeedback"); + api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); + api->ShaderSource = loadProc("glShaderSource"); + api->UniformMatrix2x4dv = loadProc("glUniformMatrix2x4dv"); + api->BindImageTextures = oc_glBindImageTextures_noimpl; + api->CopyTexImage1D = loadProc("glCopyTexImage1D"); + api->UniformMatrix3dv = loadProc("glUniformMatrix3dv"); + api->ProgramUniform1dv = loadProc("glProgramUniform1dv"); + api->BlitFramebuffer = loadProc("glBlitFramebuffer"); + api->PopDebugGroup = oc_glPopDebugGroup_noimpl; + api->TexParameterIuiv = loadProc("glTexParameterIuiv"); + api->VertexAttrib2d = loadProc("glVertexAttrib2d"); + api->TexImage1D = loadProc("glTexImage1D"); + api->GetObjectPtrLabel = oc_glGetObjectPtrLabel_noimpl; + api->StencilMask = loadProc("glStencilMask"); + api->BeginQuery = loadProc("glBeginQuery"); + api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); + api->IsSync = loadProc("glIsSync"); + api->Uniform3dv = loadProc("glUniform3dv"); + api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); + api->VertexAttribI4sv = loadProc("glVertexAttribI4sv"); + api->ScissorArrayv = loadProc("glScissorArrayv"); + api->VertexAttribP1uiv = loadProc("glVertexAttribP1uiv"); + api->Uniform2uiv = loadProc("glUniform2uiv"); + api->DeleteBuffers = loadProc("glDeleteBuffers"); + api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); + api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); + api->EndTransformFeedback = loadProc("glEndTransformFeedback"); + api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); + api->DrawTransformFeedbackInstanced = oc_glDrawTransformFeedbackInstanced_noimpl; + api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); + api->VertexAttrib1f = loadProc("glVertexAttrib1f"); + api->GetUniformSubroutineuiv = loadProc("glGetUniformSubroutineuiv"); + api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); + api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); + api->VertexAttribI4usv = loadProc("glVertexAttribI4usv"); + api->GetObjectLabel = oc_glGetObjectLabel_noimpl; + api->BindAttribLocation = loadProc("glBindAttribLocation"); + api->Uniform1f = loadProc("glUniform1f"); + api->GetUniformdv = loadProc("glGetUniformdv"); + api->GetUniformLocation = loadProc("glGetUniformLocation"); + api->GetSubroutineUniformLocation = loadProc("glGetSubroutineUniformLocation"); + api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); + api->SamplerParameterf = loadProc("glSamplerParameterf"); + api->VertexAttribL3d = loadProc("glVertexAttribL3d"); + api->TexImage3DMultisample = loadProc("glTexImage3DMultisample"); + api->TexImage3D = loadProc("glTexImage3D"); + api->RenderbufferStorage = loadProc("glRenderbufferStorage"); + api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); + api->VertexAttribP4uiv = loadProc("glVertexAttribP4uiv"); + api->Uniform4d = loadProc("glUniform4d"); + api->VertexAttrib4s = loadProc("glVertexAttrib4s"); + api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); + api->VertexAttrib3s = loadProc("glVertexAttrib3s"); + api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); + api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); + api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); + api->DepthRange = loadProc("glDepthRange"); + api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); + api->ProgramUniformMatrix2dv = loadProc("glProgramUniformMatrix2dv"); + api->ShaderStorageBlockBinding = oc_glShaderStorageBlockBinding_noimpl; + api->ClearDepth = loadProc("glClearDepth"); + api->VertexAttrib2dv = loadProc("glVertexAttrib2dv"); + api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); + api->GetVertexAttribLdv = loadProc("glGetVertexAttribLdv"); + api->ProgramUniformMatrix3x4dv = loadProc("glProgramUniformMatrix3x4dv"); + api->DepthRangeArrayv = loadProc("glDepthRangeArrayv"); + api->GetActiveUniform = loadProc("glGetActiveUniform"); + api->PatchParameterfv = loadProc("glPatchParameterfv"); + api->InvalidateTexImage = oc_glInvalidateTexImage_noimpl; + api->VertexAttrib3f = loadProc("glVertexAttrib3f"); + api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); + api->ProgramUniform4d = loadProc("glProgramUniform4d"); + api->IsFramebuffer = loadProc("glIsFramebuffer"); + api->PixelStoref = loadProc("glPixelStoref"); + api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); + api->ProgramUniformMatrix4x2dv = loadProc("glProgramUniformMatrix4x2dv"); + api->FenceSync = loadProc("glFenceSync"); + api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); + api->StencilOp = loadProc("glStencilOp"); + api->ClearBufferData = oc_glClearBufferData_noimpl; + api->GetnUniformuiv = oc_glGetnUniformuiv_noimpl; + api->GetProgramResourceiv = oc_glGetProgramResourceiv_noimpl; + api->GetVertexAttribdv = loadProc("glGetVertexAttribdv"); + api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); + api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); + api->GetBooleani_v = loadProc("glGetBooleani_v"); + api->ColorMaski = loadProc("glColorMaski"); + api->InvalidateBufferSubData = oc_glInvalidateBufferSubData_noimpl; + api->UniformMatrix4dv = loadProc("glUniformMatrix4dv"); + api->IsQuery = loadProc("glIsQuery"); + api->Uniform4ui = loadProc("glUniform4ui"); + api->Uniform4i = loadProc("glUniform4i"); + api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); + api->MultiDrawElementsBaseVertex = loadProc("glMultiDrawElementsBaseVertex"); + api->VertexAttribI1uiv = loadProc("glVertexAttribI1uiv"); + api->GetIntegerv = loadProc("glGetIntegerv"); + api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); + api->TexImage2D = loadProc("glTexImage2D"); + api->GetAttachedShaders = loadProc("glGetAttachedShaders"); + api->Uniform2d = loadProc("glUniform2d"); + api->MemoryBarrierByRegion = oc_glMemoryBarrierByRegion_noimpl; + api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); + api->PrimitiveRestartIndex = loadProc("glPrimitiveRestartIndex"); + api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); + api->GetAttribLocation = loadProc("glGetAttribLocation"); + api->TexStorage2DMultisample = oc_glTexStorage2DMultisample_noimpl; + api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); + api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); + api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); + api->TexParameterf = loadProc("glTexParameterf"); + api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); + api->GetActiveAttrib = loadProc("glGetActiveAttrib"); + api->InvalidateTexSubImage = oc_glInvalidateTexSubImage_noimpl; + api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); + api->VertexAttribI2ui = loadProc("glVertexAttribI2ui"); + api->PointParameteriv = loadProc("glPointParameteriv"); + api->GetPointerv = oc_glGetPointerv_noimpl; + api->Enablei = loadProc("glEnablei"); + api->BindBufferRange = loadProc("glBindBufferRange"); + api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); + api->DeleteTextures = loadProc("glDeleteTextures"); + api->VertexAttrib4Niv = loadProc("glVertexAttrib4Niv"); + api->MultiDrawElements = loadProc("glMultiDrawElements"); + api->GetProgramiv = loadProc("glGetProgramiv"); + api->DepthFunc = loadProc("glDepthFunc"); + api->GenTextures = loadProc("glGenTextures"); + api->GetInternalformativ = oc_glGetInternalformativ_noimpl; + api->ProgramUniform3i = loadProc("glProgramUniform3i"); + api->ScissorIndexed = loadProc("glScissorIndexed"); + api->VertexAttrib2sv = loadProc("glVertexAttrib2sv"); + api->TexStorage3DMultisample = oc_glTexStorage3DMultisample_noimpl; + api->Uniform2iv = loadProc("glUniform2iv"); + api->DrawArraysInstancedBaseInstance = oc_glDrawArraysInstancedBaseInstance_noimpl; + api->VertexAttribI3ui = loadProc("glVertexAttribI3ui"); + api->DeleteSamplers = loadProc("glDeleteSamplers"); + api->GenVertexArrays = loadProc("glGenVertexArrays"); + api->GetFramebufferParameteriv = oc_glGetFramebufferParameteriv_noimpl; + api->PolygonMode = loadProc("glPolygonMode"); + api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); + api->GetProgramResourceName = oc_glGetProgramResourceName_noimpl; + api->SamplerParameteriv = loadProc("glSamplerParameteriv"); + api->GetActiveSubroutineUniformiv = loadProc("glGetActiveSubroutineUniformiv"); + api->GetStringi = loadProc("glGetStringi"); + api->VertexAttribLFormat = oc_glVertexAttribLFormat_noimpl; + api->VertexAttrib3d = loadProc("glVertexAttrib3d"); + api->BindVertexArray = loadProc("glBindVertexArray"); + api->UnmapBuffer = loadProc("glUnmapBuffer"); + api->DrawElementsInstancedBaseInstance = oc_glDrawElementsInstancedBaseInstance_noimpl; + api->Uniform4uiv = loadProc("glUniform4uiv"); + api->FramebufferTexture1D = loadProc("glFramebufferTexture1D"); + api->DrawTransformFeedbackStreamInstanced = oc_glDrawTransformFeedbackStreamInstanced_noimpl; + api->StencilFunc = loadProc("glStencilFunc"); + api->ValidateProgram = loadProc("glValidateProgram"); + api->Flush = loadProc("glFlush"); + api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); + api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); + api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); + api->UniformMatrix2dv = loadProc("glUniformMatrix2dv"); + api->GetFragDataIndex = loadProc("glGetFragDataIndex"); + api->Uniform3iv = loadProc("glUniform3iv"); + api->MinSampleShading = loadProc("glMinSampleShading"); + api->GetBooleanv = loadProc("glGetBooleanv"); + api->GetMultisamplefv = loadProc("glGetMultisamplefv"); + api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); + api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); + api->Uniform4fv = loadProc("glUniform4fv"); + api->DrawBuffer = loadProc("glDrawBuffer"); + api->Uniform1i = loadProc("glUniform1i"); + api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); + api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); + api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); + api->BindProgramPipeline = loadProc("glBindProgramPipeline"); + api->GetDoublei_v = loadProc("glGetDoublei_v"); + api->BufferData = loadProc("glBufferData"); + api->ClearColor = loadProc("glClearColor"); + api->ProgramUniform4i = loadProc("glProgramUniform4i"); + api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); + api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); + api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); + api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); + api->GetBufferPointerv = loadProc("glGetBufferPointerv"); + api->InvalidateSubFramebuffer = oc_glInvalidateSubFramebuffer_noimpl; + api->ScissorIndexedv = loadProc("glScissorIndexedv"); + api->Uniform2ui = loadProc("glUniform2ui"); + api->BindTexture = loadProc("glBindTexture"); + api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); + api->ProgramUniform4f = loadProc("glProgramUniform4f"); + api->BindBufferBase = loadProc("glBindBufferBase"); + api->IsShader = loadProc("glIsShader"); + api->ClearBufferSubData = oc_glClearBufferSubData_noimpl; + api->VertexAttrib4Nuiv = loadProc("glVertexAttrib4Nuiv"); + api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); + api->VertexAttrib4usv = loadProc("glVertexAttrib4usv"); + api->Uniform1d = loadProc("glUniform1d"); + api->ClearTexImage = oc_glClearTexImage_noimpl; + api->Uniform1uiv = loadProc("glUniform1uiv"); + api->BindSampler = loadProc("glBindSampler"); + api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); + api->ClearBufferiv = loadProc("glClearBufferiv"); + api->LogicOp = loadProc("glLogicOp"); + api->ActiveTexture = loadProc("glActiveTexture"); + api->GetFragDataLocation = loadProc("glGetFragDataLocation"); + api->BlendColor = loadProc("glBlendColor"); + api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); + api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); + api->Uniform1fv = loadProc("glUniform1fv"); + api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); + api->Uniform4f = loadProc("glUniform4f"); + api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); + api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); + api->ClearBufferuiv = loadProc("glClearBufferuiv"); + api->CopyTexSubImage1D = loadProc("glCopyTexSubImage1D"); + api->DrawTransformFeedback = loadProc("glDrawTransformFeedback"); + api->ReadBuffer = loadProc("glReadBuffer"); + api->CopyBufferSubData = loadProc("glCopyBufferSubData"); + api->GetUniformuiv = loadProc("glGetUniformuiv"); + api->PolygonOffset = loadProc("glPolygonOffset"); + api->DispatchCompute = oc_glDispatchCompute_noimpl; + api->BindImageTexture = oc_glBindImageTexture_noimpl; + api->UniformMatrix4x3dv = loadProc("glUniformMatrix4x3dv"); + api->GenRenderbuffers = loadProc("glGenRenderbuffers"); +} + +void oc_gl_load_gl43(oc_gl_api* api, oc_gl_load_proc loadProc) +{ + api->name = "gl43"; + api->GetFloatv = loadProc("glGetFloatv"); + api->TexBufferRange = loadProc("glTexBufferRange"); + api->IsBuffer = loadProc("glIsBuffer"); + api->IsTexture = loadProc("glIsTexture"); + api->DepthRangef = loadProc("glDepthRangef"); + api->EndConditionalRender = loadProc("glEndConditionalRender"); + api->BlendFunci = loadProc("glBlendFunci"); + api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); + api->WaitSync = loadProc("glWaitSync"); + api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); + api->ProgramUniformMatrix4x3dv = loadProc("glProgramUniformMatrix4x3dv"); + api->VertexAttrib1dv = loadProc("glVertexAttrib1dv"); + api->SamplerParameteri = loadProc("glSamplerParameteri"); + api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); + api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); + api->VertexAttrib1d = loadProc("glVertexAttrib1d"); + api->TexBuffer = loadProc("glTexBuffer"); + api->InvalidateBufferData = loadProc("glInvalidateBufferData"); + api->ProgramUniform2i = loadProc("glProgramUniform2i"); + api->Uniform4dv = loadProc("glUniform4dv"); + api->UseProgram = loadProc("glUseProgram"); + api->VertexAttribI3iv = loadProc("glVertexAttribI3iv"); + api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); + api->VertexAttrib4uiv = loadProc("glVertexAttrib4uiv"); + api->GetQueryObjectiv = loadProc("glGetQueryObjectiv"); + api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); + api->BlendEquationi = loadProc("glBlendEquationi"); + api->GetActiveSubroutineName = loadProc("glGetActiveSubroutineName"); + api->VertexAttrib2s = loadProc("glVertexAttrib2s"); + api->VertexAttribL1d = loadProc("glVertexAttribL1d"); + api->BindTextures = oc_glBindTextures_noimpl; + api->VertexAttrib3sv = loadProc("glVertexAttrib3sv"); + api->GetFloati_v = loadProc("glGetFloati_v"); + api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); + api->ClearStencil = loadProc("glClearStencil"); + api->Uniform3i = loadProc("glUniform3i"); + api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); + api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); + api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); + api->GetShaderiv = loadProc("glGetShaderiv"); + api->ReadnPixels = oc_glReadnPixels_noimpl; + api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); + api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); + api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); + api->TexSubImage3D = loadProc("glTexSubImage3D"); + api->GetProgramResourceLocationIndex = loadProc("glGetProgramResourceLocationIndex"); + api->BlendFunc = loadProc("glBlendFunc"); + api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); + api->Uniform3d = loadProc("glUniform3d"); + api->VertexAttrib1sv = loadProc("glVertexAttrib1sv"); + api->BindFragDataLocation = loadProc("glBindFragDataLocation"); + api->VertexAttrib4bv = loadProc("glVertexAttrib4bv"); + api->Uniform4iv = loadProc("glUniform4iv"); + api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); + api->DrawArrays = loadProc("glDrawArrays"); + api->ProgramBinary = loadProc("glProgramBinary"); + api->VertexAttrib4f = loadProc("glVertexAttrib4f"); + api->VertexAttribP2uiv = loadProc("glVertexAttribP2uiv"); + api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); + api->Uniform2i = loadProc("glUniform2i"); + api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); + api->UniformBlockBinding = loadProc("glUniformBlockBinding"); + api->SampleCoverage = loadProc("glSampleCoverage"); + api->VertexAttrib4Nusv = loadProc("glVertexAttrib4Nusv"); + api->ProgramUniformMatrix2x4dv = loadProc("glProgramUniformMatrix2x4dv"); + api->Uniform3uiv = loadProc("glUniform3uiv"); + api->VertexAttrib1s = loadProc("glVertexAttrib1s"); + api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); + api->BlendBarrier = oc_glBlendBarrier_noimpl; + api->DrawRangeElements = loadProc("glDrawRangeElements"); + api->TexStorage3D = loadProc("glTexStorage3D"); + api->GetInternalformati64v = loadProc("glGetInternalformati64v"); + api->GetQueryObjecti64v = loadProc("glGetQueryObjecti64v"); + api->CompressedTexSubImage1D = loadProc("glCompressedTexSubImage1D"); + api->VertexAttrib3dv = loadProc("glVertexAttrib3dv"); + api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); + api->UseProgramStages = loadProc("glUseProgramStages"); + api->VertexAttribBinding = loadProc("glVertexAttribBinding"); + api->DebugMessageInsert = loadProc("glDebugMessageInsert"); + api->GetTexParameteriv = loadProc("glGetTexParameteriv"); + api->MultiDrawArraysIndirect = loadProc("glMultiDrawArraysIndirect"); + api->GetTexParameterfv = loadProc("glGetTexParameterfv"); + api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); + api->EndQuery = loadProc("glEndQuery"); + api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); + api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); + api->VertexAttribP2ui = loadProc("glVertexAttribP2ui"); + api->IsEnabledi = loadProc("glIsEnabledi"); + api->GetActiveAtomicCounterBufferiv = loadProc("glGetActiveAtomicCounterBufferiv"); + api->IsProgram = loadProc("glIsProgram"); + api->Uniform1dv = loadProc("glUniform1dv"); + api->TexParameteriv = loadProc("glTexParameteriv"); + api->Uniform2fv = loadProc("glUniform2fv"); + api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); + api->CullFace = loadProc("glCullFace"); + api->VertexAttribI4i = loadProc("glVertexAttribI4i"); + api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); + api->ShaderBinary = loadProc("glShaderBinary"); + api->UniformMatrix3x2dv = loadProc("glUniformMatrix3x2dv"); + api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); + api->AttachShader = loadProc("glAttachShader"); + api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); + api->VertexAttribP3uiv = loadProc("glVertexAttribP3uiv"); + api->GetActiveUniformName = loadProc("glGetActiveUniformName"); + api->MapBuffer = loadProc("glMapBuffer"); + api->DrawBuffers = loadProc("glDrawBuffers"); + api->GetSynciv = loadProc("glGetSynciv"); + api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); + api->ObjectLabel = loadProc("glObjectLabel"); + api->BufferSubData = loadProc("glBufferSubData"); + api->Uniform2f = loadProc("glUniform2f"); + api->DebugMessageCallback = loadProc("glDebugMessageCallback"); + api->VertexAttribL4dv = loadProc("glVertexAttribL4dv"); + api->IsProgramPipeline = loadProc("glIsProgramPipeline"); + api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); + api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); + api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); + api->GetIntegeri_v = loadProc("glGetIntegeri_v"); + api->BindVertexBuffer = loadProc("glBindVertexBuffer"); + api->BlendEquation = loadProc("glBlendEquation"); + api->VertexAttribL2dv = loadProc("glVertexAttribL2dv"); + api->VertexAttribI1ui = loadProc("glVertexAttribI1ui"); + api->VertexAttrib4Nsv = loadProc("glVertexAttrib4Nsv"); + api->VertexAttribL4d = loadProc("glVertexAttribL4d"); + api->CopyImageSubData = loadProc("glCopyImageSubData"); + api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); + api->VertexAttribL2d = loadProc("glVertexAttribL2d"); + api->GetSubroutineIndex = loadProc("glGetSubroutineIndex"); + api->VertexAttribI3uiv = loadProc("glVertexAttribI3uiv"); + api->VertexAttrib4iv = loadProc("glVertexAttrib4iv"); + api->BindVertexBuffers = oc_glBindVertexBuffers_noimpl; + api->ProgramUniformMatrix2x3dv = loadProc("glProgramUniformMatrix2x3dv"); + api->PrimitiveBoundingBox = oc_glPrimitiveBoundingBox_noimpl; + api->Scissor = loadProc("glScissor"); + api->ClientWaitSync = loadProc("glClientWaitSync"); + api->Uniform3ui = loadProc("glUniform3ui"); + api->VertexAttribP3ui = loadProc("glVertexAttribP3ui"); + api->Enable = loadProc("glEnable"); + api->StencilOpSeparate = loadProc("glStencilOpSeparate"); + api->UniformMatrix2x3dv = loadProc("glUniformMatrix2x3dv"); + api->ProgramUniformMatrix3dv = loadProc("glProgramUniformMatrix3dv"); + api->TexImage2DMultisample = loadProc("glTexImage2DMultisample"); + api->VertexAttrib4Nbv = loadProc("glVertexAttrib4Nbv"); + api->GetTexImage = loadProc("glGetTexImage"); + api->VertexAttrib4sv = loadProc("glVertexAttrib4sv"); + api->PixelStorei = loadProc("glPixelStorei"); + api->DepthMask = loadProc("glDepthMask"); + api->TexStorage2D = loadProc("glTexStorage2D"); + api->Clear = loadProc("glClear"); + api->UniformMatrix3x4dv = loadProc("glUniformMatrix3x4dv"); + api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); + api->MapBufferRange = loadProc("glMapBufferRange"); + api->MemoryBarrier = loadProc("glMemoryBarrier"); + api->ViewportIndexedf = loadProc("glViewportIndexedf"); + api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); + api->ObjectPtrLabel = loadProc("glObjectPtrLabel"); + api->TexStorage1D = loadProc("glTexStorage1D"); + api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); + api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); + api->VertexAttribPointer = loadProc("glVertexAttribPointer"); + api->GetQueryIndexediv = loadProc("glGetQueryIndexediv"); + api->CompileShader = loadProc("glCompileShader"); + api->ProgramUniform1i = loadProc("glProgramUniform1i"); + api->GetQueryiv = loadProc("glGetQueryiv"); + api->VertexAttribI1iv = loadProc("glVertexAttribI1iv"); + api->CopyTexImage2D = loadProc("glCopyTexImage2D"); + api->GetQueryObjectui64v = loadProc("glGetQueryObjectui64v"); + api->PointSize = loadProc("glPointSize"); + api->Disablei = loadProc("glDisablei"); + api->VertexAttribL1dv = loadProc("glVertexAttribL1dv"); + api->CreateShader = loadProc("glCreateShader"); + api->GetString = loadProc("glGetString"); + api->ViewportArrayv = loadProc("glViewportArrayv"); + api->ProgramUniform3d = loadProc("glProgramUniform3d"); + api->VertexAttrib4Nubv = loadProc("glVertexAttrib4Nubv"); + api->TexParameteri = loadProc("glTexParameteri"); + api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); + api->GenerateMipmap = loadProc("glGenerateMipmap"); + api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); + api->Uniform3f = loadProc("glUniform3f"); + api->GetUniformIndices = loadProc("glGetUniformIndices"); + api->VertexAttribLPointer = loadProc("glVertexAttribLPointer"); + api->VertexAttribI2uiv = loadProc("glVertexAttribI2uiv"); + api->QueryCounter = loadProc("glQueryCounter"); + api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); + api->Uniform1ui = loadProc("glUniform1ui"); + api->VertexAttribI1i = loadProc("glVertexAttribI1i"); + api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); + api->GetUniformfv = loadProc("glGetUniformfv"); + api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); + api->GetError = loadProc("glGetError"); + api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); + api->TextureView = loadProc("glTextureView"); + api->GetnUniformiv = oc_glGetnUniformiv_noimpl; + api->ProgramUniform4dv = loadProc("glProgramUniform4dv"); + api->ViewportIndexedfv = loadProc("glViewportIndexedfv"); + api->Hint = loadProc("glHint"); + api->GetShaderSource = loadProc("glGetShaderSource"); + api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); + api->Uniform1iv = loadProc("glUniform1iv"); + api->VertexAttribI4bv = loadProc("glVertexAttribI4bv"); + api->UniformMatrix4x2dv = loadProc("glUniformMatrix4x2dv"); + api->BufferStorage = oc_glBufferStorage_noimpl; + api->IsRenderbuffer = loadProc("glIsRenderbuffer"); + api->GetActiveSubroutineUniformName = loadProc("glGetActiveSubroutineUniformName"); + api->LinkProgram = loadProc("glLinkProgram"); + api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); + api->GetDebugMessageLog = loadProc("glGetDebugMessageLog"); + api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); + api->PointParameteri = loadProc("glPointParameteri"); + api->ProgramUniform3dv = loadProc("glProgramUniform3dv"); + api->CompressedTexImage1D = loadProc("glCompressedTexImage1D"); + api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); + api->GenSamplers = loadProc("glGenSamplers"); + api->GetCompressedTexImage = loadProc("glGetCompressedTexImage"); + api->DeleteQueries = loadProc("glDeleteQueries"); + api->GenProgramPipelines = loadProc("glGenProgramPipelines"); + api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); + api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); + api->CreateProgram = loadProc("glCreateProgram"); + api->ClearTexSubImage = oc_glClearTexSubImage_noimpl; + api->VertexAttrib4d = loadProc("glVertexAttrib4d"); + api->FrontFace = loadProc("glFrontFace"); + api->BindTransformFeedback = loadProc("glBindTransformFeedback"); + api->GetProgramStageiv = loadProc("glGetProgramStageiv"); + api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); + api->GetInteger64v = loadProc("glGetInteger64v"); + api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); + api->BindBuffersRange = oc_glBindBuffersRange_noimpl; + api->Uniform3fv = loadProc("glUniform3fv"); + api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); + api->BindBuffersBase = oc_glBindBuffersBase_noimpl; + api->ClearBufferfi = loadProc("glClearBufferfi"); + api->FramebufferTexture3D = loadProc("glFramebufferTexture3D"); + api->Disable = loadProc("glDisable"); + api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); + api->VertexAttribI2iv = loadProc("glVertexAttribI2iv"); + api->DepthRangeIndexed = loadProc("glDepthRangeIndexed"); + api->PatchParameteri = loadProc("glPatchParameteri"); + api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); + api->MultiDrawArrays = loadProc("glMultiDrawArrays"); + api->VertexAttribI4ubv = loadProc("glVertexAttribI4ubv"); + api->BindBuffer = loadProc("glBindBuffer"); + api->VertexAttribI3i = loadProc("glVertexAttribI3i"); + api->GetDoublev = loadProc("glGetDoublev"); + api->DrawTransformFeedbackStream = loadProc("glDrawTransformFeedbackStream"); + api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); + api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); + api->VertexAttribL3dv = loadProc("glVertexAttribL3dv"); + api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); + api->ProgramUniform1d = loadProc("glProgramUniform1d"); + api->Viewport = loadProc("glViewport"); + api->VertexAttribP1ui = loadProc("glVertexAttribP1ui"); + api->VertexAttrib4dv = loadProc("glVertexAttrib4dv"); + api->GenQueries = loadProc("glGenQueries"); + api->TexParameterIiv = loadProc("glTexParameterIiv"); + api->ProgramUniform2d = loadProc("glProgramUniform2d"); + api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); + api->VertexAttrib4Nub = loadProc("glVertexAttrib4Nub"); + api->IsVertexArray = loadProc("glIsVertexArray"); + api->ProgramUniform3f = loadProc("glProgramUniform3f"); + api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); + api->GetProgramBinary = loadProc("glGetProgramBinary"); + api->BindRenderbuffer = loadProc("glBindRenderbuffer"); + api->BindFragDataLocationIndexed = loadProc("glBindFragDataLocationIndexed"); + api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); + api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); + api->ProgramUniformMatrix3x2dv = loadProc("glProgramUniformMatrix3x2dv"); + api->FramebufferParameteri = loadProc("glFramebufferParameteri"); + api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); + api->DeleteSync = loadProc("glDeleteSync"); + api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); + api->TexSubImage1D = loadProc("glTexSubImage1D"); + api->ClearDepthf = loadProc("glClearDepthf"); + api->ReadPixels = loadProc("glReadPixels"); + api->VertexAttribI2i = loadProc("glVertexAttribI2i"); + api->Finish = loadProc("glFinish"); + api->LineWidth = loadProc("glLineWidth"); + api->DeleteShader = loadProc("glDeleteShader"); + api->IsSampler = loadProc("glIsSampler"); + api->ProgramUniformMatrix4dv = loadProc("glProgramUniformMatrix4dv"); + api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); + api->BeginConditionalRender = loadProc("glBeginConditionalRender"); + api->BindSamplers = oc_glBindSamplers_noimpl; + api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); + api->ColorMask = loadProc("glColorMask"); + api->TexParameterfv = loadProc("glTexParameterfv"); + api->PushDebugGroup = loadProc("glPushDebugGroup"); + api->ClearBufferfv = loadProc("glClearBufferfv"); + api->IsEnabled = loadProc("glIsEnabled"); + api->VertexAttrib2f = loadProc("glVertexAttrib2f"); + api->ProgramUniform2f = loadProc("glProgramUniform2f"); + api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); + api->GetInteger64i_v = loadProc("glGetInteger64i_v"); + api->Uniform2dv = loadProc("glUniform2dv"); + api->GetBufferSubData = loadProc("glGetBufferSubData"); + api->MultiDrawElementsIndirect = loadProc("glMultiDrawElementsIndirect"); + api->ProgramParameteri = loadProc("glProgramParameteri"); + api->VertexAttribP4ui = loadProc("glVertexAttribP4ui"); + api->SamplerParameterfv = loadProc("glSamplerParameterfv"); + api->PointParameterf = loadProc("glPointParameterf"); + api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); + api->GenBuffers = loadProc("glGenBuffers"); + api->ProgramUniform2dv = loadProc("glProgramUniform2dv"); + api->VertexAttribFormat = loadProc("glVertexAttribFormat"); + api->TexSubImage2D = loadProc("glTexSubImage2D"); + api->VertexAttrib4ubv = loadProc("glVertexAttrib4ubv"); + api->GetGraphicsResetStatus = oc_glGetGraphicsResetStatus_noimpl; + api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); + api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); + api->GetnUniformfv = oc_glGetnUniformfv_noimpl; + api->DeleteProgram = loadProc("glDeleteProgram"); + api->ClampColor = loadProc("glClampColor"); + api->DrawElementsInstancedBaseVertexBaseInstance = loadProc("glDrawElementsInstancedBaseVertexBaseInstance"); + api->DrawElements = loadProc("glDrawElements"); + api->DebugMessageControl = loadProc("glDebugMessageControl"); + api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); + api->DetachShader = loadProc("glDetachShader"); + api->GenFramebuffers = loadProc("glGenFramebuffers"); + api->ProvokingVertex = loadProc("glProvokingVertex"); + api->SampleMaski = loadProc("glSampleMaski"); + api->EndQueryIndexed = loadProc("glEndQueryIndexed"); + api->ProgramUniform1f = loadProc("glProgramUniform1f"); + api->BindFramebuffer = loadProc("glBindFramebuffer"); + api->BeginQueryIndexed = loadProc("glBeginQueryIndexed"); + api->UniformSubroutinesuiv = loadProc("glUniformSubroutinesuiv"); + api->GetUniformiv = loadProc("glGetUniformiv"); + api->FramebufferTexture = loadProc("glFramebufferTexture"); + api->PointParameterfv = loadProc("glPointParameterfv"); + api->IsTransformFeedback = loadProc("glIsTransformFeedback"); + api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); + api->ShaderSource = loadProc("glShaderSource"); + api->UniformMatrix2x4dv = loadProc("glUniformMatrix2x4dv"); + api->BindImageTextures = oc_glBindImageTextures_noimpl; + api->CopyTexImage1D = loadProc("glCopyTexImage1D"); + api->UniformMatrix3dv = loadProc("glUniformMatrix3dv"); + api->ProgramUniform1dv = loadProc("glProgramUniform1dv"); + api->BlitFramebuffer = loadProc("glBlitFramebuffer"); + api->PopDebugGroup = loadProc("glPopDebugGroup"); + api->TexParameterIuiv = loadProc("glTexParameterIuiv"); + api->VertexAttrib2d = loadProc("glVertexAttrib2d"); + api->TexImage1D = loadProc("glTexImage1D"); + api->GetObjectPtrLabel = loadProc("glGetObjectPtrLabel"); + api->StencilMask = loadProc("glStencilMask"); + api->BeginQuery = loadProc("glBeginQuery"); + api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); + api->IsSync = loadProc("glIsSync"); + api->Uniform3dv = loadProc("glUniform3dv"); + api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); + api->VertexAttribI4sv = loadProc("glVertexAttribI4sv"); + api->ScissorArrayv = loadProc("glScissorArrayv"); + api->VertexAttribP1uiv = loadProc("glVertexAttribP1uiv"); + api->Uniform2uiv = loadProc("glUniform2uiv"); + api->DeleteBuffers = loadProc("glDeleteBuffers"); + api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); + api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); + api->EndTransformFeedback = loadProc("glEndTransformFeedback"); + api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); + api->DrawTransformFeedbackInstanced = loadProc("glDrawTransformFeedbackInstanced"); + api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); + api->VertexAttrib1f = loadProc("glVertexAttrib1f"); + api->GetUniformSubroutineuiv = loadProc("glGetUniformSubroutineuiv"); + api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); + api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); + api->VertexAttribI4usv = loadProc("glVertexAttribI4usv"); + api->GetObjectLabel = loadProc("glGetObjectLabel"); + api->BindAttribLocation = loadProc("glBindAttribLocation"); + api->Uniform1f = loadProc("glUniform1f"); + api->GetUniformdv = loadProc("glGetUniformdv"); + api->GetUniformLocation = loadProc("glGetUniformLocation"); + api->GetSubroutineUniformLocation = loadProc("glGetSubroutineUniformLocation"); + api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); + api->SamplerParameterf = loadProc("glSamplerParameterf"); + api->VertexAttribL3d = loadProc("glVertexAttribL3d"); + api->TexImage3DMultisample = loadProc("glTexImage3DMultisample"); + api->TexImage3D = loadProc("glTexImage3D"); + api->RenderbufferStorage = loadProc("glRenderbufferStorage"); + api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); + api->VertexAttribP4uiv = loadProc("glVertexAttribP4uiv"); + api->Uniform4d = loadProc("glUniform4d"); + api->VertexAttrib4s = loadProc("glVertexAttrib4s"); + api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); + api->VertexAttrib3s = loadProc("glVertexAttrib3s"); + api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); + api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); + api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); + api->DepthRange = loadProc("glDepthRange"); + api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); + api->ProgramUniformMatrix2dv = loadProc("glProgramUniformMatrix2dv"); + api->ShaderStorageBlockBinding = loadProc("glShaderStorageBlockBinding"); + api->ClearDepth = loadProc("glClearDepth"); + api->VertexAttrib2dv = loadProc("glVertexAttrib2dv"); + api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); + api->GetVertexAttribLdv = loadProc("glGetVertexAttribLdv"); + api->ProgramUniformMatrix3x4dv = loadProc("glProgramUniformMatrix3x4dv"); + api->DepthRangeArrayv = loadProc("glDepthRangeArrayv"); + api->GetActiveUniform = loadProc("glGetActiveUniform"); + api->PatchParameterfv = loadProc("glPatchParameterfv"); + api->InvalidateTexImage = loadProc("glInvalidateTexImage"); + api->VertexAttrib3f = loadProc("glVertexAttrib3f"); + api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); + api->ProgramUniform4d = loadProc("glProgramUniform4d"); + api->IsFramebuffer = loadProc("glIsFramebuffer"); + api->PixelStoref = loadProc("glPixelStoref"); + api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); + api->ProgramUniformMatrix4x2dv = loadProc("glProgramUniformMatrix4x2dv"); + api->FenceSync = loadProc("glFenceSync"); + api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); + api->StencilOp = loadProc("glStencilOp"); + api->ClearBufferData = loadProc("glClearBufferData"); + api->GetnUniformuiv = oc_glGetnUniformuiv_noimpl; + api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); + api->GetVertexAttribdv = loadProc("glGetVertexAttribdv"); + api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); + api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); + api->GetBooleani_v = loadProc("glGetBooleani_v"); + api->ColorMaski = loadProc("glColorMaski"); + api->InvalidateBufferSubData = loadProc("glInvalidateBufferSubData"); + api->UniformMatrix4dv = loadProc("glUniformMatrix4dv"); + api->IsQuery = loadProc("glIsQuery"); + api->Uniform4ui = loadProc("glUniform4ui"); + api->Uniform4i = loadProc("glUniform4i"); + api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); + api->MultiDrawElementsBaseVertex = loadProc("glMultiDrawElementsBaseVertex"); + api->VertexAttribI1uiv = loadProc("glVertexAttribI1uiv"); + api->GetIntegerv = loadProc("glGetIntegerv"); + api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); + api->TexImage2D = loadProc("glTexImage2D"); + api->GetAttachedShaders = loadProc("glGetAttachedShaders"); + api->Uniform2d = loadProc("glUniform2d"); + api->MemoryBarrierByRegion = oc_glMemoryBarrierByRegion_noimpl; + api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); + api->PrimitiveRestartIndex = loadProc("glPrimitiveRestartIndex"); + api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); + api->GetAttribLocation = loadProc("glGetAttribLocation"); + api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); + api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); + api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); + api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); + api->TexParameterf = loadProc("glTexParameterf"); + api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); + api->GetActiveAttrib = loadProc("glGetActiveAttrib"); + api->InvalidateTexSubImage = loadProc("glInvalidateTexSubImage"); + api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); + api->VertexAttribI2ui = loadProc("glVertexAttribI2ui"); + api->PointParameteriv = loadProc("glPointParameteriv"); + api->GetPointerv = loadProc("glGetPointerv"); + api->Enablei = loadProc("glEnablei"); + api->BindBufferRange = loadProc("glBindBufferRange"); + api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); + api->DeleteTextures = loadProc("glDeleteTextures"); + api->VertexAttrib4Niv = loadProc("glVertexAttrib4Niv"); + api->MultiDrawElements = loadProc("glMultiDrawElements"); + api->GetProgramiv = loadProc("glGetProgramiv"); + api->DepthFunc = loadProc("glDepthFunc"); + api->GenTextures = loadProc("glGenTextures"); + api->GetInternalformativ = loadProc("glGetInternalformativ"); + api->ProgramUniform3i = loadProc("glProgramUniform3i"); + api->ScissorIndexed = loadProc("glScissorIndexed"); + api->VertexAttrib2sv = loadProc("glVertexAttrib2sv"); + api->TexStorage3DMultisample = loadProc("glTexStorage3DMultisample"); + api->Uniform2iv = loadProc("glUniform2iv"); + api->DrawArraysInstancedBaseInstance = loadProc("glDrawArraysInstancedBaseInstance"); + api->VertexAttribI3ui = loadProc("glVertexAttribI3ui"); + api->DeleteSamplers = loadProc("glDeleteSamplers"); + api->GenVertexArrays = loadProc("glGenVertexArrays"); + api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); + api->PolygonMode = loadProc("glPolygonMode"); + api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); + api->GetProgramResourceName = loadProc("glGetProgramResourceName"); + api->SamplerParameteriv = loadProc("glSamplerParameteriv"); + api->GetActiveSubroutineUniformiv = loadProc("glGetActiveSubroutineUniformiv"); + api->GetStringi = loadProc("glGetStringi"); + api->VertexAttribLFormat = loadProc("glVertexAttribLFormat"); + api->VertexAttrib3d = loadProc("glVertexAttrib3d"); + api->BindVertexArray = loadProc("glBindVertexArray"); + api->UnmapBuffer = loadProc("glUnmapBuffer"); + api->DrawElementsInstancedBaseInstance = loadProc("glDrawElementsInstancedBaseInstance"); + api->Uniform4uiv = loadProc("glUniform4uiv"); + api->FramebufferTexture1D = loadProc("glFramebufferTexture1D"); + api->DrawTransformFeedbackStreamInstanced = loadProc("glDrawTransformFeedbackStreamInstanced"); + api->StencilFunc = loadProc("glStencilFunc"); + api->ValidateProgram = loadProc("glValidateProgram"); + api->Flush = loadProc("glFlush"); + api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); + api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); + api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); + api->UniformMatrix2dv = loadProc("glUniformMatrix2dv"); + api->GetFragDataIndex = loadProc("glGetFragDataIndex"); + api->Uniform3iv = loadProc("glUniform3iv"); + api->MinSampleShading = loadProc("glMinSampleShading"); + api->GetBooleanv = loadProc("glGetBooleanv"); + api->GetMultisamplefv = loadProc("glGetMultisamplefv"); + api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); + api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); + api->Uniform4fv = loadProc("glUniform4fv"); + api->DrawBuffer = loadProc("glDrawBuffer"); + api->Uniform1i = loadProc("glUniform1i"); + api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); + api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); + api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); + api->BindProgramPipeline = loadProc("glBindProgramPipeline"); + api->GetDoublei_v = loadProc("glGetDoublei_v"); + api->BufferData = loadProc("glBufferData"); + api->ClearColor = loadProc("glClearColor"); + api->ProgramUniform4i = loadProc("glProgramUniform4i"); + api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); + api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); + api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); + api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); + api->GetBufferPointerv = loadProc("glGetBufferPointerv"); + api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); + api->ScissorIndexedv = loadProc("glScissorIndexedv"); + api->Uniform2ui = loadProc("glUniform2ui"); + api->BindTexture = loadProc("glBindTexture"); + api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); + api->ProgramUniform4f = loadProc("glProgramUniform4f"); + api->BindBufferBase = loadProc("glBindBufferBase"); + api->IsShader = loadProc("glIsShader"); + api->ClearBufferSubData = loadProc("glClearBufferSubData"); + api->VertexAttrib4Nuiv = loadProc("glVertexAttrib4Nuiv"); + api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); + api->VertexAttrib4usv = loadProc("glVertexAttrib4usv"); + api->Uniform1d = loadProc("glUniform1d"); + api->ClearTexImage = oc_glClearTexImage_noimpl; + api->Uniform1uiv = loadProc("glUniform1uiv"); + api->BindSampler = loadProc("glBindSampler"); + api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); + api->ClearBufferiv = loadProc("glClearBufferiv"); + api->LogicOp = loadProc("glLogicOp"); + api->ActiveTexture = loadProc("glActiveTexture"); + api->GetFragDataLocation = loadProc("glGetFragDataLocation"); + api->BlendColor = loadProc("glBlendColor"); + api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); + api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); + api->Uniform1fv = loadProc("glUniform1fv"); + api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); + api->Uniform4f = loadProc("glUniform4f"); + api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); + api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); + api->ClearBufferuiv = loadProc("glClearBufferuiv"); + api->CopyTexSubImage1D = loadProc("glCopyTexSubImage1D"); + api->DrawTransformFeedback = loadProc("glDrawTransformFeedback"); + api->ReadBuffer = loadProc("glReadBuffer"); + api->CopyBufferSubData = loadProc("glCopyBufferSubData"); + api->GetUniformuiv = loadProc("glGetUniformuiv"); + api->PolygonOffset = loadProc("glPolygonOffset"); + api->DispatchCompute = loadProc("glDispatchCompute"); + api->BindImageTexture = loadProc("glBindImageTexture"); + api->UniformMatrix4x3dv = loadProc("glUniformMatrix4x3dv"); + api->GenRenderbuffers = loadProc("glGenRenderbuffers"); +} + +void oc_gl_load_gl44(oc_gl_api* api, oc_gl_load_proc loadProc) +{ + api->name = "gl44"; + api->GetFloatv = loadProc("glGetFloatv"); + api->TexBufferRange = loadProc("glTexBufferRange"); + api->IsBuffer = loadProc("glIsBuffer"); + api->IsTexture = loadProc("glIsTexture"); + api->DepthRangef = loadProc("glDepthRangef"); + api->EndConditionalRender = loadProc("glEndConditionalRender"); + api->BlendFunci = loadProc("glBlendFunci"); + api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); + api->WaitSync = loadProc("glWaitSync"); + api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); + api->ProgramUniformMatrix4x3dv = loadProc("glProgramUniformMatrix4x3dv"); + api->VertexAttrib1dv = loadProc("glVertexAttrib1dv"); + api->SamplerParameteri = loadProc("glSamplerParameteri"); + api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); + api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); + api->VertexAttrib1d = loadProc("glVertexAttrib1d"); + api->TexBuffer = loadProc("glTexBuffer"); + api->InvalidateBufferData = loadProc("glInvalidateBufferData"); + api->ProgramUniform2i = loadProc("glProgramUniform2i"); + api->Uniform4dv = loadProc("glUniform4dv"); + api->UseProgram = loadProc("glUseProgram"); + api->VertexAttribI3iv = loadProc("glVertexAttribI3iv"); + api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); + api->VertexAttrib4uiv = loadProc("glVertexAttrib4uiv"); + api->GetQueryObjectiv = loadProc("glGetQueryObjectiv"); + api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); + api->BlendEquationi = loadProc("glBlendEquationi"); + api->GetActiveSubroutineName = loadProc("glGetActiveSubroutineName"); + api->VertexAttrib2s = loadProc("glVertexAttrib2s"); + api->VertexAttribL1d = loadProc("glVertexAttribL1d"); + api->BindTextures = loadProc("glBindTextures"); + api->VertexAttrib3sv = loadProc("glVertexAttrib3sv"); + api->GetFloati_v = loadProc("glGetFloati_v"); + api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); + api->ClearStencil = loadProc("glClearStencil"); + api->Uniform3i = loadProc("glUniform3i"); + api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); + api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); + api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); + api->GetShaderiv = loadProc("glGetShaderiv"); + api->ReadnPixels = oc_glReadnPixels_noimpl; + api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); + api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); + api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); + api->TexSubImage3D = loadProc("glTexSubImage3D"); + api->GetProgramResourceLocationIndex = loadProc("glGetProgramResourceLocationIndex"); + api->BlendFunc = loadProc("glBlendFunc"); + api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); + api->Uniform3d = loadProc("glUniform3d"); + api->VertexAttrib1sv = loadProc("glVertexAttrib1sv"); + api->BindFragDataLocation = loadProc("glBindFragDataLocation"); + api->VertexAttrib4bv = loadProc("glVertexAttrib4bv"); + api->Uniform4iv = loadProc("glUniform4iv"); + api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); + api->DrawArrays = loadProc("glDrawArrays"); + api->ProgramBinary = loadProc("glProgramBinary"); + api->VertexAttrib4f = loadProc("glVertexAttrib4f"); + api->VertexAttribP2uiv = loadProc("glVertexAttribP2uiv"); + api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); + api->Uniform2i = loadProc("glUniform2i"); + api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); + api->UniformBlockBinding = loadProc("glUniformBlockBinding"); + api->SampleCoverage = loadProc("glSampleCoverage"); + api->VertexAttrib4Nusv = loadProc("glVertexAttrib4Nusv"); + api->ProgramUniformMatrix2x4dv = loadProc("glProgramUniformMatrix2x4dv"); + api->Uniform3uiv = loadProc("glUniform3uiv"); + api->VertexAttrib1s = loadProc("glVertexAttrib1s"); + api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); + api->BlendBarrier = oc_glBlendBarrier_noimpl; + api->DrawRangeElements = loadProc("glDrawRangeElements"); + api->TexStorage3D = loadProc("glTexStorage3D"); + api->GetInternalformati64v = loadProc("glGetInternalformati64v"); + api->GetQueryObjecti64v = loadProc("glGetQueryObjecti64v"); + api->CompressedTexSubImage1D = loadProc("glCompressedTexSubImage1D"); + api->VertexAttrib3dv = loadProc("glVertexAttrib3dv"); + api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); + api->UseProgramStages = loadProc("glUseProgramStages"); + api->VertexAttribBinding = loadProc("glVertexAttribBinding"); + api->DebugMessageInsert = loadProc("glDebugMessageInsert"); + api->GetTexParameteriv = loadProc("glGetTexParameteriv"); + api->MultiDrawArraysIndirect = loadProc("glMultiDrawArraysIndirect"); + api->GetTexParameterfv = loadProc("glGetTexParameterfv"); + api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); + api->EndQuery = loadProc("glEndQuery"); + api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); + api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); + api->VertexAttribP2ui = loadProc("glVertexAttribP2ui"); + api->IsEnabledi = loadProc("glIsEnabledi"); + api->GetActiveAtomicCounterBufferiv = loadProc("glGetActiveAtomicCounterBufferiv"); + api->IsProgram = loadProc("glIsProgram"); + api->Uniform1dv = loadProc("glUniform1dv"); + api->TexParameteriv = loadProc("glTexParameteriv"); + api->Uniform2fv = loadProc("glUniform2fv"); + api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); + api->CullFace = loadProc("glCullFace"); + api->VertexAttribI4i = loadProc("glVertexAttribI4i"); + api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); + api->ShaderBinary = loadProc("glShaderBinary"); + api->UniformMatrix3x2dv = loadProc("glUniformMatrix3x2dv"); + api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); + api->AttachShader = loadProc("glAttachShader"); + api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); + api->VertexAttribP3uiv = loadProc("glVertexAttribP3uiv"); + api->GetActiveUniformName = loadProc("glGetActiveUniformName"); + api->MapBuffer = loadProc("glMapBuffer"); + api->DrawBuffers = loadProc("glDrawBuffers"); + api->GetSynciv = loadProc("glGetSynciv"); + api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); + api->ObjectLabel = loadProc("glObjectLabel"); + api->BufferSubData = loadProc("glBufferSubData"); + api->Uniform2f = loadProc("glUniform2f"); + api->DebugMessageCallback = loadProc("glDebugMessageCallback"); + api->VertexAttribL4dv = loadProc("glVertexAttribL4dv"); + api->IsProgramPipeline = loadProc("glIsProgramPipeline"); + api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); + api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); + api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); + api->GetIntegeri_v = loadProc("glGetIntegeri_v"); + api->BindVertexBuffer = loadProc("glBindVertexBuffer"); + api->BlendEquation = loadProc("glBlendEquation"); + api->VertexAttribL2dv = loadProc("glVertexAttribL2dv"); + api->VertexAttribI1ui = loadProc("glVertexAttribI1ui"); + api->VertexAttrib4Nsv = loadProc("glVertexAttrib4Nsv"); + api->VertexAttribL4d = loadProc("glVertexAttribL4d"); + api->CopyImageSubData = loadProc("glCopyImageSubData"); + api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); + api->VertexAttribL2d = loadProc("glVertexAttribL2d"); + api->GetSubroutineIndex = loadProc("glGetSubroutineIndex"); + api->VertexAttribI3uiv = loadProc("glVertexAttribI3uiv"); + api->VertexAttrib4iv = loadProc("glVertexAttrib4iv"); + api->BindVertexBuffers = loadProc("glBindVertexBuffers"); + api->ProgramUniformMatrix2x3dv = loadProc("glProgramUniformMatrix2x3dv"); + api->PrimitiveBoundingBox = oc_glPrimitiveBoundingBox_noimpl; + api->Scissor = loadProc("glScissor"); + api->ClientWaitSync = loadProc("glClientWaitSync"); + api->Uniform3ui = loadProc("glUniform3ui"); + api->VertexAttribP3ui = loadProc("glVertexAttribP3ui"); + api->Enable = loadProc("glEnable"); + api->StencilOpSeparate = loadProc("glStencilOpSeparate"); + api->UniformMatrix2x3dv = loadProc("glUniformMatrix2x3dv"); + api->ProgramUniformMatrix3dv = loadProc("glProgramUniformMatrix3dv"); + api->TexImage2DMultisample = loadProc("glTexImage2DMultisample"); + api->VertexAttrib4Nbv = loadProc("glVertexAttrib4Nbv"); + api->GetTexImage = loadProc("glGetTexImage"); + api->VertexAttrib4sv = loadProc("glVertexAttrib4sv"); + api->PixelStorei = loadProc("glPixelStorei"); + api->DepthMask = loadProc("glDepthMask"); + api->TexStorage2D = loadProc("glTexStorage2D"); + api->Clear = loadProc("glClear"); + api->UniformMatrix3x4dv = loadProc("glUniformMatrix3x4dv"); + api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); + api->MapBufferRange = loadProc("glMapBufferRange"); + api->MemoryBarrier = loadProc("glMemoryBarrier"); + api->ViewportIndexedf = loadProc("glViewportIndexedf"); + api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); + api->ObjectPtrLabel = loadProc("glObjectPtrLabel"); + api->TexStorage1D = loadProc("glTexStorage1D"); + api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); + api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); + api->VertexAttribPointer = loadProc("glVertexAttribPointer"); + api->GetQueryIndexediv = loadProc("glGetQueryIndexediv"); + api->CompileShader = loadProc("glCompileShader"); + api->ProgramUniform1i = loadProc("glProgramUniform1i"); + api->GetQueryiv = loadProc("glGetQueryiv"); + api->VertexAttribI1iv = loadProc("glVertexAttribI1iv"); + api->CopyTexImage2D = loadProc("glCopyTexImage2D"); + api->GetQueryObjectui64v = loadProc("glGetQueryObjectui64v"); + api->PointSize = loadProc("glPointSize"); + api->Disablei = loadProc("glDisablei"); + api->VertexAttribL1dv = loadProc("glVertexAttribL1dv"); + api->CreateShader = loadProc("glCreateShader"); + api->GetString = loadProc("glGetString"); + api->ViewportArrayv = loadProc("glViewportArrayv"); + api->ProgramUniform3d = loadProc("glProgramUniform3d"); + api->VertexAttrib4Nubv = loadProc("glVertexAttrib4Nubv"); + api->TexParameteri = loadProc("glTexParameteri"); + api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); + api->GenerateMipmap = loadProc("glGenerateMipmap"); + api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); + api->Uniform3f = loadProc("glUniform3f"); + api->GetUniformIndices = loadProc("glGetUniformIndices"); + api->VertexAttribLPointer = loadProc("glVertexAttribLPointer"); + api->VertexAttribI2uiv = loadProc("glVertexAttribI2uiv"); + api->QueryCounter = loadProc("glQueryCounter"); + api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); + api->Uniform1ui = loadProc("glUniform1ui"); + api->VertexAttribI1i = loadProc("glVertexAttribI1i"); + api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); + api->GetUniformfv = loadProc("glGetUniformfv"); + api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); + api->GetError = loadProc("glGetError"); + api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); + api->TextureView = loadProc("glTextureView"); + api->GetnUniformiv = oc_glGetnUniformiv_noimpl; + api->ProgramUniform4dv = loadProc("glProgramUniform4dv"); + api->ViewportIndexedfv = loadProc("glViewportIndexedfv"); + api->Hint = loadProc("glHint"); + api->GetShaderSource = loadProc("glGetShaderSource"); + api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); + api->Uniform1iv = loadProc("glUniform1iv"); + api->VertexAttribI4bv = loadProc("glVertexAttribI4bv"); + api->UniformMatrix4x2dv = loadProc("glUniformMatrix4x2dv"); + api->BufferStorage = loadProc("glBufferStorage"); + api->IsRenderbuffer = loadProc("glIsRenderbuffer"); + api->GetActiveSubroutineUniformName = loadProc("glGetActiveSubroutineUniformName"); + api->LinkProgram = loadProc("glLinkProgram"); + api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); + api->GetDebugMessageLog = loadProc("glGetDebugMessageLog"); + api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); + api->PointParameteri = loadProc("glPointParameteri"); + api->ProgramUniform3dv = loadProc("glProgramUniform3dv"); + api->CompressedTexImage1D = loadProc("glCompressedTexImage1D"); + api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); + api->GenSamplers = loadProc("glGenSamplers"); + api->GetCompressedTexImage = loadProc("glGetCompressedTexImage"); + api->DeleteQueries = loadProc("glDeleteQueries"); + api->GenProgramPipelines = loadProc("glGenProgramPipelines"); + api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); + api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); + api->CreateProgram = loadProc("glCreateProgram"); + api->ClearTexSubImage = loadProc("glClearTexSubImage"); + api->VertexAttrib4d = loadProc("glVertexAttrib4d"); + api->FrontFace = loadProc("glFrontFace"); + api->BindTransformFeedback = loadProc("glBindTransformFeedback"); + api->GetProgramStageiv = loadProc("glGetProgramStageiv"); + api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); + api->GetInteger64v = loadProc("glGetInteger64v"); + api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); + api->BindBuffersRange = loadProc("glBindBuffersRange"); + api->Uniform3fv = loadProc("glUniform3fv"); + api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); + api->BindBuffersBase = loadProc("glBindBuffersBase"); + api->ClearBufferfi = loadProc("glClearBufferfi"); + api->FramebufferTexture3D = loadProc("glFramebufferTexture3D"); + api->Disable = loadProc("glDisable"); + api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); + api->VertexAttribI2iv = loadProc("glVertexAttribI2iv"); + api->DepthRangeIndexed = loadProc("glDepthRangeIndexed"); + api->PatchParameteri = loadProc("glPatchParameteri"); + api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); + api->MultiDrawArrays = loadProc("glMultiDrawArrays"); + api->VertexAttribI4ubv = loadProc("glVertexAttribI4ubv"); + api->BindBuffer = loadProc("glBindBuffer"); + api->VertexAttribI3i = loadProc("glVertexAttribI3i"); + api->GetDoublev = loadProc("glGetDoublev"); + api->DrawTransformFeedbackStream = loadProc("glDrawTransformFeedbackStream"); + api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); + api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); + api->VertexAttribL3dv = loadProc("glVertexAttribL3dv"); + api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); + api->ProgramUniform1d = loadProc("glProgramUniform1d"); + api->Viewport = loadProc("glViewport"); + api->VertexAttribP1ui = loadProc("glVertexAttribP1ui"); + api->VertexAttrib4dv = loadProc("glVertexAttrib4dv"); + api->GenQueries = loadProc("glGenQueries"); + api->TexParameterIiv = loadProc("glTexParameterIiv"); + api->ProgramUniform2d = loadProc("glProgramUniform2d"); + api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); + api->VertexAttrib4Nub = loadProc("glVertexAttrib4Nub"); + api->IsVertexArray = loadProc("glIsVertexArray"); + api->ProgramUniform3f = loadProc("glProgramUniform3f"); + api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); + api->GetProgramBinary = loadProc("glGetProgramBinary"); + api->BindRenderbuffer = loadProc("glBindRenderbuffer"); + api->BindFragDataLocationIndexed = loadProc("glBindFragDataLocationIndexed"); + api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); + api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); + api->ProgramUniformMatrix3x2dv = loadProc("glProgramUniformMatrix3x2dv"); + api->FramebufferParameteri = loadProc("glFramebufferParameteri"); + api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); + api->DeleteSync = loadProc("glDeleteSync"); + api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); + api->TexSubImage1D = loadProc("glTexSubImage1D"); + api->ClearDepthf = loadProc("glClearDepthf"); + api->ReadPixels = loadProc("glReadPixels"); + api->VertexAttribI2i = loadProc("glVertexAttribI2i"); + api->Finish = loadProc("glFinish"); + api->LineWidth = loadProc("glLineWidth"); + api->DeleteShader = loadProc("glDeleteShader"); + api->IsSampler = loadProc("glIsSampler"); + api->ProgramUniformMatrix4dv = loadProc("glProgramUniformMatrix4dv"); + api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); + api->BeginConditionalRender = loadProc("glBeginConditionalRender"); + api->BindSamplers = loadProc("glBindSamplers"); + api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); + api->ColorMask = loadProc("glColorMask"); + api->TexParameterfv = loadProc("glTexParameterfv"); + api->PushDebugGroup = loadProc("glPushDebugGroup"); + api->ClearBufferfv = loadProc("glClearBufferfv"); + api->IsEnabled = loadProc("glIsEnabled"); + api->VertexAttrib2f = loadProc("glVertexAttrib2f"); + api->ProgramUniform2f = loadProc("glProgramUniform2f"); + api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); + api->GetInteger64i_v = loadProc("glGetInteger64i_v"); + api->Uniform2dv = loadProc("glUniform2dv"); + api->GetBufferSubData = loadProc("glGetBufferSubData"); + api->MultiDrawElementsIndirect = loadProc("glMultiDrawElementsIndirect"); + api->ProgramParameteri = loadProc("glProgramParameteri"); + api->VertexAttribP4ui = loadProc("glVertexAttribP4ui"); + api->SamplerParameterfv = loadProc("glSamplerParameterfv"); + api->PointParameterf = loadProc("glPointParameterf"); + api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); + api->GenBuffers = loadProc("glGenBuffers"); + api->ProgramUniform2dv = loadProc("glProgramUniform2dv"); + api->VertexAttribFormat = loadProc("glVertexAttribFormat"); + api->TexSubImage2D = loadProc("glTexSubImage2D"); + api->VertexAttrib4ubv = loadProc("glVertexAttrib4ubv"); + api->GetGraphicsResetStatus = oc_glGetGraphicsResetStatus_noimpl; + api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); + api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); + api->GetnUniformfv = oc_glGetnUniformfv_noimpl; + api->DeleteProgram = loadProc("glDeleteProgram"); + api->ClampColor = loadProc("glClampColor"); + api->DrawElementsInstancedBaseVertexBaseInstance = loadProc("glDrawElementsInstancedBaseVertexBaseInstance"); + api->DrawElements = loadProc("glDrawElements"); + api->DebugMessageControl = loadProc("glDebugMessageControl"); + api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); + api->DetachShader = loadProc("glDetachShader"); + api->GenFramebuffers = loadProc("glGenFramebuffers"); + api->ProvokingVertex = loadProc("glProvokingVertex"); + api->SampleMaski = loadProc("glSampleMaski"); + api->EndQueryIndexed = loadProc("glEndQueryIndexed"); + api->ProgramUniform1f = loadProc("glProgramUniform1f"); + api->BindFramebuffer = loadProc("glBindFramebuffer"); + api->BeginQueryIndexed = loadProc("glBeginQueryIndexed"); + api->UniformSubroutinesuiv = loadProc("glUniformSubroutinesuiv"); + api->GetUniformiv = loadProc("glGetUniformiv"); + api->FramebufferTexture = loadProc("glFramebufferTexture"); + api->PointParameterfv = loadProc("glPointParameterfv"); + api->IsTransformFeedback = loadProc("glIsTransformFeedback"); + api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); + api->ShaderSource = loadProc("glShaderSource"); + api->UniformMatrix2x4dv = loadProc("glUniformMatrix2x4dv"); + api->BindImageTextures = loadProc("glBindImageTextures"); + api->CopyTexImage1D = loadProc("glCopyTexImage1D"); + api->UniformMatrix3dv = loadProc("glUniformMatrix3dv"); + api->ProgramUniform1dv = loadProc("glProgramUniform1dv"); + api->BlitFramebuffer = loadProc("glBlitFramebuffer"); + api->PopDebugGroup = loadProc("glPopDebugGroup"); + api->TexParameterIuiv = loadProc("glTexParameterIuiv"); + api->VertexAttrib2d = loadProc("glVertexAttrib2d"); + api->TexImage1D = loadProc("glTexImage1D"); + api->GetObjectPtrLabel = loadProc("glGetObjectPtrLabel"); + api->StencilMask = loadProc("glStencilMask"); + api->BeginQuery = loadProc("glBeginQuery"); + api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); + api->IsSync = loadProc("glIsSync"); + api->Uniform3dv = loadProc("glUniform3dv"); + api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); + api->VertexAttribI4sv = loadProc("glVertexAttribI4sv"); + api->ScissorArrayv = loadProc("glScissorArrayv"); + api->VertexAttribP1uiv = loadProc("glVertexAttribP1uiv"); + api->Uniform2uiv = loadProc("glUniform2uiv"); + api->DeleteBuffers = loadProc("glDeleteBuffers"); + api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); + api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); + api->EndTransformFeedback = loadProc("glEndTransformFeedback"); + api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); + api->DrawTransformFeedbackInstanced = loadProc("glDrawTransformFeedbackInstanced"); + api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); + api->VertexAttrib1f = loadProc("glVertexAttrib1f"); + api->GetUniformSubroutineuiv = loadProc("glGetUniformSubroutineuiv"); + api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); + api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); + api->VertexAttribI4usv = loadProc("glVertexAttribI4usv"); + api->GetObjectLabel = loadProc("glGetObjectLabel"); + api->BindAttribLocation = loadProc("glBindAttribLocation"); + api->Uniform1f = loadProc("glUniform1f"); + api->GetUniformdv = loadProc("glGetUniformdv"); + api->GetUniformLocation = loadProc("glGetUniformLocation"); + api->GetSubroutineUniformLocation = loadProc("glGetSubroutineUniformLocation"); + api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); + api->SamplerParameterf = loadProc("glSamplerParameterf"); + api->VertexAttribL3d = loadProc("glVertexAttribL3d"); + api->TexImage3DMultisample = loadProc("glTexImage3DMultisample"); + api->TexImage3D = loadProc("glTexImage3D"); + api->RenderbufferStorage = loadProc("glRenderbufferStorage"); + api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); + api->VertexAttribP4uiv = loadProc("glVertexAttribP4uiv"); + api->Uniform4d = loadProc("glUniform4d"); + api->VertexAttrib4s = loadProc("glVertexAttrib4s"); + api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); + api->VertexAttrib3s = loadProc("glVertexAttrib3s"); + api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); + api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); + api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); + api->DepthRange = loadProc("glDepthRange"); + api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); + api->ProgramUniformMatrix2dv = loadProc("glProgramUniformMatrix2dv"); + api->ShaderStorageBlockBinding = loadProc("glShaderStorageBlockBinding"); + api->ClearDepth = loadProc("glClearDepth"); + api->VertexAttrib2dv = loadProc("glVertexAttrib2dv"); + api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); + api->GetVertexAttribLdv = loadProc("glGetVertexAttribLdv"); + api->ProgramUniformMatrix3x4dv = loadProc("glProgramUniformMatrix3x4dv"); + api->DepthRangeArrayv = loadProc("glDepthRangeArrayv"); + api->GetActiveUniform = loadProc("glGetActiveUniform"); + api->PatchParameterfv = loadProc("glPatchParameterfv"); + api->InvalidateTexImage = loadProc("glInvalidateTexImage"); + api->VertexAttrib3f = loadProc("glVertexAttrib3f"); + api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); + api->ProgramUniform4d = loadProc("glProgramUniform4d"); + api->IsFramebuffer = loadProc("glIsFramebuffer"); + api->PixelStoref = loadProc("glPixelStoref"); + api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); + api->ProgramUniformMatrix4x2dv = loadProc("glProgramUniformMatrix4x2dv"); + api->FenceSync = loadProc("glFenceSync"); + api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); + api->StencilOp = loadProc("glStencilOp"); + api->ClearBufferData = loadProc("glClearBufferData"); + api->GetnUniformuiv = oc_glGetnUniformuiv_noimpl; + api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); + api->GetVertexAttribdv = loadProc("glGetVertexAttribdv"); + api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); + api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); + api->GetBooleani_v = loadProc("glGetBooleani_v"); + api->ColorMaski = loadProc("glColorMaski"); + api->InvalidateBufferSubData = loadProc("glInvalidateBufferSubData"); + api->UniformMatrix4dv = loadProc("glUniformMatrix4dv"); + api->IsQuery = loadProc("glIsQuery"); + api->Uniform4ui = loadProc("glUniform4ui"); + api->Uniform4i = loadProc("glUniform4i"); + api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); + api->MultiDrawElementsBaseVertex = loadProc("glMultiDrawElementsBaseVertex"); + api->VertexAttribI1uiv = loadProc("glVertexAttribI1uiv"); + api->GetIntegerv = loadProc("glGetIntegerv"); + api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); + api->TexImage2D = loadProc("glTexImage2D"); + api->GetAttachedShaders = loadProc("glGetAttachedShaders"); + api->Uniform2d = loadProc("glUniform2d"); + api->MemoryBarrierByRegion = oc_glMemoryBarrierByRegion_noimpl; + api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); + api->PrimitiveRestartIndex = loadProc("glPrimitiveRestartIndex"); + api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); + api->GetAttribLocation = loadProc("glGetAttribLocation"); + api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); + api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); + api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); + api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); + api->TexParameterf = loadProc("glTexParameterf"); + api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); + api->GetActiveAttrib = loadProc("glGetActiveAttrib"); + api->InvalidateTexSubImage = loadProc("glInvalidateTexSubImage"); + api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); + api->VertexAttribI2ui = loadProc("glVertexAttribI2ui"); + api->PointParameteriv = loadProc("glPointParameteriv"); + api->GetPointerv = loadProc("glGetPointerv"); + api->Enablei = loadProc("glEnablei"); + api->BindBufferRange = loadProc("glBindBufferRange"); + api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); + api->DeleteTextures = loadProc("glDeleteTextures"); + api->VertexAttrib4Niv = loadProc("glVertexAttrib4Niv"); + api->MultiDrawElements = loadProc("glMultiDrawElements"); + api->GetProgramiv = loadProc("glGetProgramiv"); + api->DepthFunc = loadProc("glDepthFunc"); + api->GenTextures = loadProc("glGenTextures"); + api->GetInternalformativ = loadProc("glGetInternalformativ"); + api->ProgramUniform3i = loadProc("glProgramUniform3i"); + api->ScissorIndexed = loadProc("glScissorIndexed"); + api->VertexAttrib2sv = loadProc("glVertexAttrib2sv"); + api->TexStorage3DMultisample = loadProc("glTexStorage3DMultisample"); + api->Uniform2iv = loadProc("glUniform2iv"); + api->DrawArraysInstancedBaseInstance = loadProc("glDrawArraysInstancedBaseInstance"); + api->VertexAttribI3ui = loadProc("glVertexAttribI3ui"); + api->DeleteSamplers = loadProc("glDeleteSamplers"); + api->GenVertexArrays = loadProc("glGenVertexArrays"); + api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); + api->PolygonMode = loadProc("glPolygonMode"); + api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); + api->GetProgramResourceName = loadProc("glGetProgramResourceName"); + api->SamplerParameteriv = loadProc("glSamplerParameteriv"); + api->GetActiveSubroutineUniformiv = loadProc("glGetActiveSubroutineUniformiv"); + api->GetStringi = loadProc("glGetStringi"); + api->VertexAttribLFormat = loadProc("glVertexAttribLFormat"); + api->VertexAttrib3d = loadProc("glVertexAttrib3d"); + api->BindVertexArray = loadProc("glBindVertexArray"); + api->UnmapBuffer = loadProc("glUnmapBuffer"); + api->DrawElementsInstancedBaseInstance = loadProc("glDrawElementsInstancedBaseInstance"); + api->Uniform4uiv = loadProc("glUniform4uiv"); + api->FramebufferTexture1D = loadProc("glFramebufferTexture1D"); + api->DrawTransformFeedbackStreamInstanced = loadProc("glDrawTransformFeedbackStreamInstanced"); + api->StencilFunc = loadProc("glStencilFunc"); + api->ValidateProgram = loadProc("glValidateProgram"); + api->Flush = loadProc("glFlush"); + api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); + api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); + api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); + api->UniformMatrix2dv = loadProc("glUniformMatrix2dv"); + api->GetFragDataIndex = loadProc("glGetFragDataIndex"); + api->Uniform3iv = loadProc("glUniform3iv"); + api->MinSampleShading = loadProc("glMinSampleShading"); + api->GetBooleanv = loadProc("glGetBooleanv"); + api->GetMultisamplefv = loadProc("glGetMultisamplefv"); + api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); + api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); + api->Uniform4fv = loadProc("glUniform4fv"); + api->DrawBuffer = loadProc("glDrawBuffer"); + api->Uniform1i = loadProc("glUniform1i"); + api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); + api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); + api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); + api->BindProgramPipeline = loadProc("glBindProgramPipeline"); + api->GetDoublei_v = loadProc("glGetDoublei_v"); + api->BufferData = loadProc("glBufferData"); + api->ClearColor = loadProc("glClearColor"); + api->ProgramUniform4i = loadProc("glProgramUniform4i"); + api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); + api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); + api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); + api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); + api->GetBufferPointerv = loadProc("glGetBufferPointerv"); + api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); + api->ScissorIndexedv = loadProc("glScissorIndexedv"); + api->Uniform2ui = loadProc("glUniform2ui"); + api->BindTexture = loadProc("glBindTexture"); + api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); + api->ProgramUniform4f = loadProc("glProgramUniform4f"); + api->BindBufferBase = loadProc("glBindBufferBase"); + api->IsShader = loadProc("glIsShader"); + api->ClearBufferSubData = loadProc("glClearBufferSubData"); + api->VertexAttrib4Nuiv = loadProc("glVertexAttrib4Nuiv"); + api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); + api->VertexAttrib4usv = loadProc("glVertexAttrib4usv"); + api->Uniform1d = loadProc("glUniform1d"); + api->ClearTexImage = loadProc("glClearTexImage"); + api->Uniform1uiv = loadProc("glUniform1uiv"); + api->BindSampler = loadProc("glBindSampler"); + api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); + api->ClearBufferiv = loadProc("glClearBufferiv"); + api->LogicOp = loadProc("glLogicOp"); + api->ActiveTexture = loadProc("glActiveTexture"); + api->GetFragDataLocation = loadProc("glGetFragDataLocation"); + api->BlendColor = loadProc("glBlendColor"); + api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); + api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); + api->Uniform1fv = loadProc("glUniform1fv"); + api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); + api->Uniform4f = loadProc("glUniform4f"); + api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); + api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); + api->ClearBufferuiv = loadProc("glClearBufferuiv"); + api->CopyTexSubImage1D = loadProc("glCopyTexSubImage1D"); + api->DrawTransformFeedback = loadProc("glDrawTransformFeedback"); + api->ReadBuffer = loadProc("glReadBuffer"); + api->CopyBufferSubData = loadProc("glCopyBufferSubData"); + api->GetUniformuiv = loadProc("glGetUniformuiv"); + api->PolygonOffset = loadProc("glPolygonOffset"); + api->DispatchCompute = loadProc("glDispatchCompute"); + api->BindImageTexture = loadProc("glBindImageTexture"); + api->UniformMatrix4x3dv = loadProc("glUniformMatrix4x3dv"); + api->GenRenderbuffers = loadProc("glGenRenderbuffers"); +} + +void oc_gl_load_gles31(oc_gl_api* api, oc_gl_load_proc loadProc) +{ + api->name = "gles31"; + api->GetFloatv = loadProc("glGetFloatv"); + api->TexBufferRange = oc_glTexBufferRange_noimpl; + api->IsBuffer = loadProc("glIsBuffer"); + api->IsTexture = loadProc("glIsTexture"); + api->DepthRangef = loadProc("glDepthRangef"); + api->EndConditionalRender = oc_glEndConditionalRender_noimpl; + api->BlendFunci = oc_glBlendFunci_noimpl; + api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); + api->WaitSync = loadProc("glWaitSync"); + api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); + api->ProgramUniformMatrix4x3dv = oc_glProgramUniformMatrix4x3dv_noimpl; + api->VertexAttrib1dv = oc_glVertexAttrib1dv_noimpl; + api->SamplerParameteri = loadProc("glSamplerParameteri"); + api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); + api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); + api->VertexAttrib1d = oc_glVertexAttrib1d_noimpl; + api->TexBuffer = oc_glTexBuffer_noimpl; + api->InvalidateBufferData = oc_glInvalidateBufferData_noimpl; + api->ProgramUniform2i = loadProc("glProgramUniform2i"); + api->Uniform4dv = oc_glUniform4dv_noimpl; + api->UseProgram = loadProc("glUseProgram"); + api->VertexAttribI3iv = oc_glVertexAttribI3iv_noimpl; + api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); + api->VertexAttrib4uiv = oc_glVertexAttrib4uiv_noimpl; + api->GetQueryObjectiv = oc_glGetQueryObjectiv_noimpl; + api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); + api->BlendEquationi = oc_glBlendEquationi_noimpl; + api->GetActiveSubroutineName = oc_glGetActiveSubroutineName_noimpl; + api->VertexAttrib2s = oc_glVertexAttrib2s_noimpl; + api->VertexAttribL1d = oc_glVertexAttribL1d_noimpl; + api->BindTextures = oc_glBindTextures_noimpl; + api->VertexAttrib3sv = oc_glVertexAttrib3sv_noimpl; + api->GetFloati_v = oc_glGetFloati_v_noimpl; + api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); + api->ClearStencil = loadProc("glClearStencil"); + api->Uniform3i = loadProc("glUniform3i"); + api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); + api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); + api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); + api->GetShaderiv = loadProc("glGetShaderiv"); + api->ReadnPixels = oc_glReadnPixels_noimpl; + api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); + api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); + api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); + api->TexSubImage3D = loadProc("glTexSubImage3D"); + api->GetProgramResourceLocationIndex = oc_glGetProgramResourceLocationIndex_noimpl; + api->BlendFunc = loadProc("glBlendFunc"); + api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); + api->Uniform3d = oc_glUniform3d_noimpl; + api->VertexAttrib1sv = oc_glVertexAttrib1sv_noimpl; + api->BindFragDataLocation = oc_glBindFragDataLocation_noimpl; + api->VertexAttrib4bv = oc_glVertexAttrib4bv_noimpl; + api->Uniform4iv = loadProc("glUniform4iv"); + api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); + api->DrawArrays = loadProc("glDrawArrays"); + api->ProgramBinary = loadProc("glProgramBinary"); + api->VertexAttrib4f = loadProc("glVertexAttrib4f"); + api->VertexAttribP2uiv = oc_glVertexAttribP2uiv_noimpl; + api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); + api->Uniform2i = loadProc("glUniform2i"); + api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); + api->UniformBlockBinding = loadProc("glUniformBlockBinding"); + api->SampleCoverage = loadProc("glSampleCoverage"); + api->VertexAttrib4Nusv = oc_glVertexAttrib4Nusv_noimpl; + api->ProgramUniformMatrix2x4dv = oc_glProgramUniformMatrix2x4dv_noimpl; + api->Uniform3uiv = loadProc("glUniform3uiv"); + api->VertexAttrib1s = oc_glVertexAttrib1s_noimpl; + api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); + api->BlendBarrier = oc_glBlendBarrier_noimpl; + api->DrawRangeElements = loadProc("glDrawRangeElements"); + api->TexStorage3D = loadProc("glTexStorage3D"); + api->GetInternalformati64v = oc_glGetInternalformati64v_noimpl; + api->GetQueryObjecti64v = oc_glGetQueryObjecti64v_noimpl; + api->CompressedTexSubImage1D = oc_glCompressedTexSubImage1D_noimpl; + api->VertexAttrib3dv = oc_glVertexAttrib3dv_noimpl; + api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); + api->UseProgramStages = loadProc("glUseProgramStages"); + api->VertexAttribBinding = loadProc("glVertexAttribBinding"); + api->DebugMessageInsert = oc_glDebugMessageInsert_noimpl; + api->GetTexParameteriv = loadProc("glGetTexParameteriv"); + api->MultiDrawArraysIndirect = oc_glMultiDrawArraysIndirect_noimpl; + api->GetTexParameterfv = loadProc("glGetTexParameterfv"); + api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); + api->EndQuery = loadProc("glEndQuery"); + api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); + api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); + api->VertexAttribP2ui = oc_glVertexAttribP2ui_noimpl; + api->IsEnabledi = oc_glIsEnabledi_noimpl; + api->GetActiveAtomicCounterBufferiv = oc_glGetActiveAtomicCounterBufferiv_noimpl; + api->IsProgram = loadProc("glIsProgram"); + api->Uniform1dv = oc_glUniform1dv_noimpl; + api->TexParameteriv = loadProc("glTexParameteriv"); + api->Uniform2fv = loadProc("glUniform2fv"); + api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); + api->CullFace = loadProc("glCullFace"); + api->VertexAttribI4i = loadProc("glVertexAttribI4i"); + api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); + api->ShaderBinary = loadProc("glShaderBinary"); + api->UniformMatrix3x2dv = oc_glUniformMatrix3x2dv_noimpl; + api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); + api->AttachShader = loadProc("glAttachShader"); + api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); + api->VertexAttribP3uiv = oc_glVertexAttribP3uiv_noimpl; + api->GetActiveUniformName = oc_glGetActiveUniformName_noimpl; + api->MapBuffer = oc_glMapBuffer_noimpl; + api->DrawBuffers = loadProc("glDrawBuffers"); + api->GetSynciv = loadProc("glGetSynciv"); + api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); + api->ObjectLabel = oc_glObjectLabel_noimpl; + api->BufferSubData = loadProc("glBufferSubData"); + api->Uniform2f = loadProc("glUniform2f"); + api->DebugMessageCallback = oc_glDebugMessageCallback_noimpl; + api->VertexAttribL4dv = oc_glVertexAttribL4dv_noimpl; + api->IsProgramPipeline = loadProc("glIsProgramPipeline"); + api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); + api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); + api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); + api->GetIntegeri_v = loadProc("glGetIntegeri_v"); + api->BindVertexBuffer = loadProc("glBindVertexBuffer"); + api->BlendEquation = loadProc("glBlendEquation"); + api->VertexAttribL2dv = oc_glVertexAttribL2dv_noimpl; + api->VertexAttribI1ui = oc_glVertexAttribI1ui_noimpl; + api->VertexAttrib4Nsv = oc_glVertexAttrib4Nsv_noimpl; + api->VertexAttribL4d = oc_glVertexAttribL4d_noimpl; + api->CopyImageSubData = oc_glCopyImageSubData_noimpl; + api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); + api->VertexAttribL2d = oc_glVertexAttribL2d_noimpl; + api->GetSubroutineIndex = oc_glGetSubroutineIndex_noimpl; + api->VertexAttribI3uiv = oc_glVertexAttribI3uiv_noimpl; + api->VertexAttrib4iv = oc_glVertexAttrib4iv_noimpl; + api->BindVertexBuffers = oc_glBindVertexBuffers_noimpl; + api->ProgramUniformMatrix2x3dv = oc_glProgramUniformMatrix2x3dv_noimpl; + api->PrimitiveBoundingBox = oc_glPrimitiveBoundingBox_noimpl; + api->Scissor = loadProc("glScissor"); + api->ClientWaitSync = loadProc("glClientWaitSync"); + api->Uniform3ui = loadProc("glUniform3ui"); + api->VertexAttribP3ui = oc_glVertexAttribP3ui_noimpl; + api->Enable = loadProc("glEnable"); + api->StencilOpSeparate = loadProc("glStencilOpSeparate"); + api->UniformMatrix2x3dv = oc_glUniformMatrix2x3dv_noimpl; + api->ProgramUniformMatrix3dv = oc_glProgramUniformMatrix3dv_noimpl; + api->TexImage2DMultisample = oc_glTexImage2DMultisample_noimpl; + api->VertexAttrib4Nbv = oc_glVertexAttrib4Nbv_noimpl; + api->GetTexImage = oc_glGetTexImage_noimpl; + api->VertexAttrib4sv = oc_glVertexAttrib4sv_noimpl; + api->PixelStorei = loadProc("glPixelStorei"); + api->DepthMask = loadProc("glDepthMask"); + api->TexStorage2D = loadProc("glTexStorage2D"); + api->Clear = loadProc("glClear"); + api->UniformMatrix3x4dv = oc_glUniformMatrix3x4dv_noimpl; + api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); + api->MapBufferRange = loadProc("glMapBufferRange"); + api->MemoryBarrier = loadProc("glMemoryBarrier"); + api->ViewportIndexedf = oc_glViewportIndexedf_noimpl; + api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); + api->ObjectPtrLabel = oc_glObjectPtrLabel_noimpl; + api->TexStorage1D = oc_glTexStorage1D_noimpl; + api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); + api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); + api->VertexAttribPointer = loadProc("glVertexAttribPointer"); + api->GetQueryIndexediv = oc_glGetQueryIndexediv_noimpl; + api->CompileShader = loadProc("glCompileShader"); + api->ProgramUniform1i = loadProc("glProgramUniform1i"); + api->GetQueryiv = loadProc("glGetQueryiv"); + api->VertexAttribI1iv = oc_glVertexAttribI1iv_noimpl; + api->CopyTexImage2D = loadProc("glCopyTexImage2D"); + api->GetQueryObjectui64v = oc_glGetQueryObjectui64v_noimpl; + api->PointSize = oc_glPointSize_noimpl; + api->Disablei = oc_glDisablei_noimpl; + api->VertexAttribL1dv = oc_glVertexAttribL1dv_noimpl; + api->CreateShader = loadProc("glCreateShader"); + api->GetString = loadProc("glGetString"); + api->ViewportArrayv = oc_glViewportArrayv_noimpl; + api->ProgramUniform3d = oc_glProgramUniform3d_noimpl; + api->VertexAttrib4Nubv = oc_glVertexAttrib4Nubv_noimpl; + api->TexParameteri = loadProc("glTexParameteri"); + api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); + api->GenerateMipmap = loadProc("glGenerateMipmap"); + api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); + api->Uniform3f = loadProc("glUniform3f"); + api->GetUniformIndices = loadProc("glGetUniformIndices"); + api->VertexAttribLPointer = oc_glVertexAttribLPointer_noimpl; + api->VertexAttribI2uiv = oc_glVertexAttribI2uiv_noimpl; + api->QueryCounter = oc_glQueryCounter_noimpl; + api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); + api->Uniform1ui = loadProc("glUniform1ui"); + api->VertexAttribI1i = oc_glVertexAttribI1i_noimpl; + api->GetTexParameterIiv = oc_glGetTexParameterIiv_noimpl; + api->GetUniformfv = loadProc("glGetUniformfv"); + api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); + api->GetError = loadProc("glGetError"); + api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); + api->TextureView = oc_glTextureView_noimpl; + api->GetnUniformiv = oc_glGetnUniformiv_noimpl; + api->ProgramUniform4dv = oc_glProgramUniform4dv_noimpl; + api->ViewportIndexedfv = oc_glViewportIndexedfv_noimpl; + api->Hint = loadProc("glHint"); + api->GetShaderSource = loadProc("glGetShaderSource"); + api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); + api->Uniform1iv = loadProc("glUniform1iv"); + api->VertexAttribI4bv = oc_glVertexAttribI4bv_noimpl; + api->UniformMatrix4x2dv = oc_glUniformMatrix4x2dv_noimpl; + api->BufferStorage = oc_glBufferStorage_noimpl; + api->IsRenderbuffer = loadProc("glIsRenderbuffer"); + api->GetActiveSubroutineUniformName = oc_glGetActiveSubroutineUniformName_noimpl; + api->LinkProgram = loadProc("glLinkProgram"); + api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); + api->GetDebugMessageLog = oc_glGetDebugMessageLog_noimpl; + api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); + api->PointParameteri = oc_glPointParameteri_noimpl; + api->ProgramUniform3dv = oc_glProgramUniform3dv_noimpl; + api->CompressedTexImage1D = oc_glCompressedTexImage1D_noimpl; + api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); + api->GenSamplers = loadProc("glGenSamplers"); + api->GetCompressedTexImage = oc_glGetCompressedTexImage_noimpl; + api->DeleteQueries = loadProc("glDeleteQueries"); + api->GenProgramPipelines = loadProc("glGenProgramPipelines"); + api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); + api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); + api->CreateProgram = loadProc("glCreateProgram"); + api->ClearTexSubImage = oc_glClearTexSubImage_noimpl; + api->VertexAttrib4d = oc_glVertexAttrib4d_noimpl; + api->FrontFace = loadProc("glFrontFace"); + api->BindTransformFeedback = loadProc("glBindTransformFeedback"); + api->GetProgramStageiv = oc_glGetProgramStageiv_noimpl; + api->SamplerParameterIiv = oc_glSamplerParameterIiv_noimpl; + api->GetInteger64v = loadProc("glGetInteger64v"); + api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); + api->BindBuffersRange = oc_glBindBuffersRange_noimpl; + api->Uniform3fv = loadProc("glUniform3fv"); + api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); + api->BindBuffersBase = oc_glBindBuffersBase_noimpl; + api->ClearBufferfi = loadProc("glClearBufferfi"); + api->FramebufferTexture3D = oc_glFramebufferTexture3D_noimpl; + api->Disable = loadProc("glDisable"); + api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); + api->VertexAttribI2iv = oc_glVertexAttribI2iv_noimpl; + api->DepthRangeIndexed = oc_glDepthRangeIndexed_noimpl; + api->PatchParameteri = oc_glPatchParameteri_noimpl; + api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); + api->MultiDrawArrays = oc_glMultiDrawArrays_noimpl; + api->VertexAttribI4ubv = oc_glVertexAttribI4ubv_noimpl; + api->BindBuffer = loadProc("glBindBuffer"); + api->VertexAttribI3i = oc_glVertexAttribI3i_noimpl; + api->GetDoublev = oc_glGetDoublev_noimpl; + api->DrawTransformFeedbackStream = oc_glDrawTransformFeedbackStream_noimpl; + api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); + api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); + api->VertexAttribL3dv = oc_glVertexAttribL3dv_noimpl; + api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); + api->ProgramUniform1d = oc_glProgramUniform1d_noimpl; + api->Viewport = loadProc("glViewport"); + api->VertexAttribP1ui = oc_glVertexAttribP1ui_noimpl; + api->VertexAttrib4dv = oc_glVertexAttrib4dv_noimpl; + api->GenQueries = loadProc("glGenQueries"); + api->TexParameterIiv = oc_glTexParameterIiv_noimpl; + api->ProgramUniform2d = oc_glProgramUniform2d_noimpl; + api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); + api->VertexAttrib4Nub = oc_glVertexAttrib4Nub_noimpl; + api->IsVertexArray = loadProc("glIsVertexArray"); + api->ProgramUniform3f = loadProc("glProgramUniform3f"); + api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); + api->GetProgramBinary = loadProc("glGetProgramBinary"); + api->BindRenderbuffer = loadProc("glBindRenderbuffer"); + api->BindFragDataLocationIndexed = oc_glBindFragDataLocationIndexed_noimpl; + api->GetSamplerParameterIiv = oc_glGetSamplerParameterIiv_noimpl; + api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); + api->ProgramUniformMatrix3x2dv = oc_glProgramUniformMatrix3x2dv_noimpl; + api->FramebufferParameteri = loadProc("glFramebufferParameteri"); + api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); + api->DeleteSync = loadProc("glDeleteSync"); + api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); + api->TexSubImage1D = oc_glTexSubImage1D_noimpl; + api->ClearDepthf = loadProc("glClearDepthf"); + api->ReadPixels = loadProc("glReadPixels"); + api->VertexAttribI2i = oc_glVertexAttribI2i_noimpl; + api->Finish = loadProc("glFinish"); + api->LineWidth = loadProc("glLineWidth"); + api->DeleteShader = loadProc("glDeleteShader"); + api->IsSampler = loadProc("glIsSampler"); + api->ProgramUniformMatrix4dv = oc_glProgramUniformMatrix4dv_noimpl; + api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); + api->BeginConditionalRender = oc_glBeginConditionalRender_noimpl; + api->BindSamplers = oc_glBindSamplers_noimpl; + api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); + api->ColorMask = loadProc("glColorMask"); + api->TexParameterfv = loadProc("glTexParameterfv"); + api->PushDebugGroup = oc_glPushDebugGroup_noimpl; + api->ClearBufferfv = loadProc("glClearBufferfv"); + api->IsEnabled = loadProc("glIsEnabled"); + api->VertexAttrib2f = loadProc("glVertexAttrib2f"); + api->ProgramUniform2f = loadProc("glProgramUniform2f"); + api->GetSamplerParameterIuiv = oc_glGetSamplerParameterIuiv_noimpl; + api->GetInteger64i_v = loadProc("glGetInteger64i_v"); + api->Uniform2dv = oc_glUniform2dv_noimpl; + api->GetBufferSubData = oc_glGetBufferSubData_noimpl; + api->MultiDrawElementsIndirect = oc_glMultiDrawElementsIndirect_noimpl; + api->ProgramParameteri = loadProc("glProgramParameteri"); + api->VertexAttribP4ui = oc_glVertexAttribP4ui_noimpl; + api->SamplerParameterfv = loadProc("glSamplerParameterfv"); + api->PointParameterf = oc_glPointParameterf_noimpl; + api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); + api->GenBuffers = loadProc("glGenBuffers"); + api->ProgramUniform2dv = oc_glProgramUniform2dv_noimpl; + api->VertexAttribFormat = loadProc("glVertexAttribFormat"); + api->TexSubImage2D = loadProc("glTexSubImage2D"); + api->VertexAttrib4ubv = oc_glVertexAttrib4ubv_noimpl; + api->GetGraphicsResetStatus = oc_glGetGraphicsResetStatus_noimpl; + api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); + api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); + api->GetnUniformfv = oc_glGetnUniformfv_noimpl; + api->DeleteProgram = loadProc("glDeleteProgram"); + api->ClampColor = oc_glClampColor_noimpl; + api->DrawElementsInstancedBaseVertexBaseInstance = oc_glDrawElementsInstancedBaseVertexBaseInstance_noimpl; + api->DrawElements = loadProc("glDrawElements"); + api->DebugMessageControl = oc_glDebugMessageControl_noimpl; + api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); + api->DetachShader = loadProc("glDetachShader"); + api->GenFramebuffers = loadProc("glGenFramebuffers"); + api->ProvokingVertex = oc_glProvokingVertex_noimpl; + api->SampleMaski = loadProc("glSampleMaski"); + api->EndQueryIndexed = oc_glEndQueryIndexed_noimpl; + api->ProgramUniform1f = loadProc("glProgramUniform1f"); + api->BindFramebuffer = loadProc("glBindFramebuffer"); + api->BeginQueryIndexed = oc_glBeginQueryIndexed_noimpl; + api->UniformSubroutinesuiv = oc_glUniformSubroutinesuiv_noimpl; + api->GetUniformiv = loadProc("glGetUniformiv"); + api->FramebufferTexture = oc_glFramebufferTexture_noimpl; + api->PointParameterfv = oc_glPointParameterfv_noimpl; + api->IsTransformFeedback = loadProc("glIsTransformFeedback"); + api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); + api->ShaderSource = loadProc("glShaderSource"); + api->UniformMatrix2x4dv = oc_glUniformMatrix2x4dv_noimpl; + api->BindImageTextures = oc_glBindImageTextures_noimpl; + api->CopyTexImage1D = oc_glCopyTexImage1D_noimpl; + api->UniformMatrix3dv = oc_glUniformMatrix3dv_noimpl; + api->ProgramUniform1dv = oc_glProgramUniform1dv_noimpl; + api->BlitFramebuffer = loadProc("glBlitFramebuffer"); + api->PopDebugGroup = oc_glPopDebugGroup_noimpl; + api->TexParameterIuiv = oc_glTexParameterIuiv_noimpl; + api->VertexAttrib2d = oc_glVertexAttrib2d_noimpl; + api->TexImage1D = oc_glTexImage1D_noimpl; + api->GetObjectPtrLabel = oc_glGetObjectPtrLabel_noimpl; + api->StencilMask = loadProc("glStencilMask"); + api->BeginQuery = loadProc("glBeginQuery"); + api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); + api->IsSync = loadProc("glIsSync"); + api->Uniform3dv = oc_glUniform3dv_noimpl; + api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); + api->VertexAttribI4sv = oc_glVertexAttribI4sv_noimpl; + api->ScissorArrayv = oc_glScissorArrayv_noimpl; + api->VertexAttribP1uiv = oc_glVertexAttribP1uiv_noimpl; + api->Uniform2uiv = loadProc("glUniform2uiv"); + api->DeleteBuffers = loadProc("glDeleteBuffers"); + api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); + api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); + api->EndTransformFeedback = loadProc("glEndTransformFeedback"); + api->BlendFuncSeparatei = oc_glBlendFuncSeparatei_noimpl; + api->DrawTransformFeedbackInstanced = oc_glDrawTransformFeedbackInstanced_noimpl; + api->DrawRangeElementsBaseVertex = oc_glDrawRangeElementsBaseVertex_noimpl; + api->VertexAttrib1f = loadProc("glVertexAttrib1f"); + api->GetUniformSubroutineuiv = oc_glGetUniformSubroutineuiv_noimpl; + api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); + api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); + api->VertexAttribI4usv = oc_glVertexAttribI4usv_noimpl; + api->GetObjectLabel = oc_glGetObjectLabel_noimpl; + api->BindAttribLocation = loadProc("glBindAttribLocation"); + api->Uniform1f = loadProc("glUniform1f"); + api->GetUniformdv = oc_glGetUniformdv_noimpl; + api->GetUniformLocation = loadProc("glGetUniformLocation"); + api->GetSubroutineUniformLocation = oc_glGetSubroutineUniformLocation_noimpl; + api->GetTexParameterIuiv = oc_glGetTexParameterIuiv_noimpl; + api->SamplerParameterf = loadProc("glSamplerParameterf"); + api->VertexAttribL3d = oc_glVertexAttribL3d_noimpl; + api->TexImage3DMultisample = oc_glTexImage3DMultisample_noimpl; + api->TexImage3D = loadProc("glTexImage3D"); + api->RenderbufferStorage = loadProc("glRenderbufferStorage"); + api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); + api->VertexAttribP4uiv = oc_glVertexAttribP4uiv_noimpl; + api->Uniform4d = oc_glUniform4d_noimpl; + api->VertexAttrib4s = oc_glVertexAttrib4s_noimpl; + api->DrawElementsInstancedBaseVertex = oc_glDrawElementsInstancedBaseVertex_noimpl; + api->VertexAttrib3s = oc_glVertexAttrib3s_noimpl; + api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); + api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); + api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); + api->DepthRange = oc_glDepthRange_noimpl; + api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); + api->ProgramUniformMatrix2dv = oc_glProgramUniformMatrix2dv_noimpl; + api->ShaderStorageBlockBinding = oc_glShaderStorageBlockBinding_noimpl; + api->ClearDepth = oc_glClearDepth_noimpl; + api->VertexAttrib2dv = oc_glVertexAttrib2dv_noimpl; + api->SamplerParameterIuiv = oc_glSamplerParameterIuiv_noimpl; + api->GetVertexAttribLdv = oc_glGetVertexAttribLdv_noimpl; + api->ProgramUniformMatrix3x4dv = oc_glProgramUniformMatrix3x4dv_noimpl; + api->DepthRangeArrayv = oc_glDepthRangeArrayv_noimpl; + api->GetActiveUniform = loadProc("glGetActiveUniform"); + api->PatchParameterfv = oc_glPatchParameterfv_noimpl; + api->InvalidateTexImage = oc_glInvalidateTexImage_noimpl; + api->VertexAttrib3f = loadProc("glVertexAttrib3f"); + api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); + api->ProgramUniform4d = oc_glProgramUniform4d_noimpl; + api->IsFramebuffer = loadProc("glIsFramebuffer"); + api->PixelStoref = oc_glPixelStoref_noimpl; + api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); + api->ProgramUniformMatrix4x2dv = oc_glProgramUniformMatrix4x2dv_noimpl; + api->FenceSync = loadProc("glFenceSync"); + api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); + api->StencilOp = loadProc("glStencilOp"); + api->ClearBufferData = oc_glClearBufferData_noimpl; + api->GetnUniformuiv = oc_glGetnUniformuiv_noimpl; + api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); + api->GetVertexAttribdv = oc_glGetVertexAttribdv_noimpl; + api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); + api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); + api->GetBooleani_v = loadProc("glGetBooleani_v"); + api->ColorMaski = oc_glColorMaski_noimpl; + api->InvalidateBufferSubData = oc_glInvalidateBufferSubData_noimpl; + api->UniformMatrix4dv = oc_glUniformMatrix4dv_noimpl; + api->IsQuery = loadProc("glIsQuery"); + api->Uniform4ui = loadProc("glUniform4ui"); + api->Uniform4i = loadProc("glUniform4i"); + api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); + api->MultiDrawElementsBaseVertex = oc_glMultiDrawElementsBaseVertex_noimpl; + api->VertexAttribI1uiv = oc_glVertexAttribI1uiv_noimpl; + api->GetIntegerv = loadProc("glGetIntegerv"); + api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); + api->TexImage2D = loadProc("glTexImage2D"); + api->GetAttachedShaders = loadProc("glGetAttachedShaders"); + api->Uniform2d = oc_glUniform2d_noimpl; + api->MemoryBarrierByRegion = loadProc("glMemoryBarrierByRegion"); + api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); + api->PrimitiveRestartIndex = oc_glPrimitiveRestartIndex_noimpl; + api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); + api->GetAttribLocation = loadProc("glGetAttribLocation"); + api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); + api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); + api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); + api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); + api->TexParameterf = loadProc("glTexParameterf"); + api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); + api->GetActiveAttrib = loadProc("glGetActiveAttrib"); + api->InvalidateTexSubImage = oc_glInvalidateTexSubImage_noimpl; + api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); + api->VertexAttribI2ui = oc_glVertexAttribI2ui_noimpl; + api->PointParameteriv = oc_glPointParameteriv_noimpl; + api->GetPointerv = oc_glGetPointerv_noimpl; + api->Enablei = oc_glEnablei_noimpl; + api->BindBufferRange = loadProc("glBindBufferRange"); + api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); + api->DeleteTextures = loadProc("glDeleteTextures"); + api->VertexAttrib4Niv = oc_glVertexAttrib4Niv_noimpl; + api->MultiDrawElements = oc_glMultiDrawElements_noimpl; + api->GetProgramiv = loadProc("glGetProgramiv"); + api->DepthFunc = loadProc("glDepthFunc"); + api->GenTextures = loadProc("glGenTextures"); + api->GetInternalformativ = loadProc("glGetInternalformativ"); + api->ProgramUniform3i = loadProc("glProgramUniform3i"); + api->ScissorIndexed = oc_glScissorIndexed_noimpl; + api->VertexAttrib2sv = oc_glVertexAttrib2sv_noimpl; + api->TexStorage3DMultisample = oc_glTexStorage3DMultisample_noimpl; + api->Uniform2iv = loadProc("glUniform2iv"); + api->DrawArraysInstancedBaseInstance = oc_glDrawArraysInstancedBaseInstance_noimpl; + api->VertexAttribI3ui = oc_glVertexAttribI3ui_noimpl; + api->DeleteSamplers = loadProc("glDeleteSamplers"); + api->GenVertexArrays = loadProc("glGenVertexArrays"); + api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); + api->PolygonMode = oc_glPolygonMode_noimpl; + api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); + api->GetProgramResourceName = loadProc("glGetProgramResourceName"); + api->SamplerParameteriv = loadProc("glSamplerParameteriv"); + api->GetActiveSubroutineUniformiv = oc_glGetActiveSubroutineUniformiv_noimpl; + api->GetStringi = loadProc("glGetStringi"); + api->VertexAttribLFormat = oc_glVertexAttribLFormat_noimpl; + api->VertexAttrib3d = oc_glVertexAttrib3d_noimpl; + api->BindVertexArray = loadProc("glBindVertexArray"); + api->UnmapBuffer = loadProc("glUnmapBuffer"); + api->DrawElementsInstancedBaseInstance = oc_glDrawElementsInstancedBaseInstance_noimpl; + api->Uniform4uiv = loadProc("glUniform4uiv"); + api->FramebufferTexture1D = oc_glFramebufferTexture1D_noimpl; + api->DrawTransformFeedbackStreamInstanced = oc_glDrawTransformFeedbackStreamInstanced_noimpl; + api->StencilFunc = loadProc("glStencilFunc"); + api->ValidateProgram = loadProc("glValidateProgram"); + api->Flush = loadProc("glFlush"); + api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); + api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); + api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); + api->UniformMatrix2dv = oc_glUniformMatrix2dv_noimpl; + api->GetFragDataIndex = oc_glGetFragDataIndex_noimpl; + api->Uniform3iv = loadProc("glUniform3iv"); + api->MinSampleShading = oc_glMinSampleShading_noimpl; + api->GetBooleanv = loadProc("glGetBooleanv"); + api->GetMultisamplefv = loadProc("glGetMultisamplefv"); + api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); + api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); + api->Uniform4fv = loadProc("glUniform4fv"); + api->DrawBuffer = oc_glDrawBuffer_noimpl; + api->Uniform1i = loadProc("glUniform1i"); + api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); + api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); + api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); + api->BindProgramPipeline = loadProc("glBindProgramPipeline"); + api->GetDoublei_v = oc_glGetDoublei_v_noimpl; + api->BufferData = loadProc("glBufferData"); + api->ClearColor = loadProc("glClearColor"); + api->ProgramUniform4i = loadProc("glProgramUniform4i"); + api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); + api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); + api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); + api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); + api->GetBufferPointerv = loadProc("glGetBufferPointerv"); + api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); + api->ScissorIndexedv = oc_glScissorIndexedv_noimpl; + api->Uniform2ui = loadProc("glUniform2ui"); + api->BindTexture = loadProc("glBindTexture"); + api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); + api->ProgramUniform4f = loadProc("glProgramUniform4f"); + api->BindBufferBase = loadProc("glBindBufferBase"); + api->IsShader = loadProc("glIsShader"); + api->ClearBufferSubData = oc_glClearBufferSubData_noimpl; + api->VertexAttrib4Nuiv = oc_glVertexAttrib4Nuiv_noimpl; + api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); + api->VertexAttrib4usv = oc_glVertexAttrib4usv_noimpl; + api->Uniform1d = oc_glUniform1d_noimpl; + api->ClearTexImage = oc_glClearTexImage_noimpl; + api->Uniform1uiv = loadProc("glUniform1uiv"); + api->BindSampler = loadProc("glBindSampler"); + api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); + api->ClearBufferiv = loadProc("glClearBufferiv"); + api->LogicOp = oc_glLogicOp_noimpl; + api->ActiveTexture = loadProc("glActiveTexture"); + api->GetFragDataLocation = loadProc("glGetFragDataLocation"); + api->BlendColor = loadProc("glBlendColor"); + api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); + api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); + api->Uniform1fv = loadProc("glUniform1fv"); + api->DrawElementsBaseVertex = oc_glDrawElementsBaseVertex_noimpl; + api->Uniform4f = loadProc("glUniform4f"); + api->BlendEquationSeparatei = oc_glBlendEquationSeparatei_noimpl; + api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); + api->ClearBufferuiv = loadProc("glClearBufferuiv"); + api->CopyTexSubImage1D = oc_glCopyTexSubImage1D_noimpl; + api->DrawTransformFeedback = oc_glDrawTransformFeedback_noimpl; + api->ReadBuffer = loadProc("glReadBuffer"); + api->CopyBufferSubData = loadProc("glCopyBufferSubData"); + api->GetUniformuiv = loadProc("glGetUniformuiv"); + api->PolygonOffset = loadProc("glPolygonOffset"); + api->DispatchCompute = loadProc("glDispatchCompute"); + api->BindImageTexture = loadProc("glBindImageTexture"); + api->UniformMatrix4x3dv = oc_glUniformMatrix4x3dv_noimpl; + api->GenRenderbuffers = loadProc("glGenRenderbuffers"); +} + +void oc_gl_load_gles32(oc_gl_api* api, oc_gl_load_proc loadProc) +{ + api->name = "gles32"; + api->GetFloatv = loadProc("glGetFloatv"); + api->TexBufferRange = loadProc("glTexBufferRange"); + api->IsBuffer = loadProc("glIsBuffer"); + api->IsTexture = loadProc("glIsTexture"); + api->DepthRangef = loadProc("glDepthRangef"); + api->EndConditionalRender = oc_glEndConditionalRender_noimpl; + api->BlendFunci = loadProc("glBlendFunci"); + api->GetProgramPipelineiv = loadProc("glGetProgramPipelineiv"); + api->WaitSync = loadProc("glWaitSync"); + api->ProgramUniformMatrix2fv = loadProc("glProgramUniformMatrix2fv"); + api->ProgramUniformMatrix4x3dv = oc_glProgramUniformMatrix4x3dv_noimpl; + api->VertexAttrib1dv = oc_glVertexAttrib1dv_noimpl; + api->SamplerParameteri = loadProc("glSamplerParameteri"); + api->GetVertexAttribIiv = loadProc("glGetVertexAttribIiv"); + api->GetSamplerParameterfv = loadProc("glGetSamplerParameterfv"); + api->VertexAttrib1d = oc_glVertexAttrib1d_noimpl; + api->TexBuffer = loadProc("glTexBuffer"); + api->InvalidateBufferData = oc_glInvalidateBufferData_noimpl; + api->ProgramUniform2i = loadProc("glProgramUniform2i"); + api->Uniform4dv = oc_glUniform4dv_noimpl; + api->UseProgram = loadProc("glUseProgram"); + api->VertexAttribI3iv = oc_glVertexAttribI3iv_noimpl; + api->DrawElementsIndirect = loadProc("glDrawElementsIndirect"); + api->VertexAttrib4uiv = oc_glVertexAttrib4uiv_noimpl; + api->GetQueryObjectiv = oc_glGetQueryObjectiv_noimpl; + api->FramebufferRenderbuffer = loadProc("glFramebufferRenderbuffer"); + api->BlendEquationi = loadProc("glBlendEquationi"); + api->GetActiveSubroutineName = oc_glGetActiveSubroutineName_noimpl; + api->VertexAttrib2s = oc_glVertexAttrib2s_noimpl; + api->VertexAttribL1d = oc_glVertexAttribL1d_noimpl; + api->BindTextures = oc_glBindTextures_noimpl; + api->VertexAttrib3sv = oc_glVertexAttrib3sv_noimpl; + api->GetFloati_v = oc_glGetFloati_v_noimpl; + api->BeginTransformFeedback = loadProc("glBeginTransformFeedback"); + api->ClearStencil = loadProc("glClearStencil"); + api->Uniform3i = loadProc("glUniform3i"); + api->ValidateProgramPipeline = loadProc("glValidateProgramPipeline"); + api->ProgramUniformMatrix4x2fv = loadProc("glProgramUniformMatrix4x2fv"); + api->VertexAttribI4ui = loadProc("glVertexAttribI4ui"); + api->GetShaderiv = loadProc("glGetShaderiv"); + api->ReadnPixels = loadProc("glReadnPixels"); + api->UniformMatrix4x2fv = loadProc("glUniformMatrix4x2fv"); + api->GetShaderPrecisionFormat = loadProc("glGetShaderPrecisionFormat"); + api->ProgramUniformMatrix2x3fv = loadProc("glProgramUniformMatrix2x3fv"); + api->TexSubImage3D = loadProc("glTexSubImage3D"); + api->GetProgramResourceLocationIndex = oc_glGetProgramResourceLocationIndex_noimpl; + api->BlendFunc = loadProc("glBlendFunc"); + api->ProgramUniformMatrix3x4fv = loadProc("glProgramUniformMatrix3x4fv"); + api->Uniform3d = oc_glUniform3d_noimpl; + api->VertexAttrib1sv = oc_glVertexAttrib1sv_noimpl; + api->BindFragDataLocation = oc_glBindFragDataLocation_noimpl; + api->VertexAttrib4bv = oc_glVertexAttrib4bv_noimpl; + api->Uniform4iv = loadProc("glUniform4iv"); + api->ProgramUniform2ui = loadProc("glProgramUniform2ui"); + api->DrawArrays = loadProc("glDrawArrays"); + api->ProgramBinary = loadProc("glProgramBinary"); + api->VertexAttrib4f = loadProc("glVertexAttrib4f"); + api->VertexAttribP2uiv = oc_glVertexAttribP2uiv_noimpl; + api->UniformMatrix3fv = loadProc("glUniformMatrix3fv"); + api->Uniform2i = loadProc("glUniform2i"); + api->GetQueryObjectuiv = loadProc("glGetQueryObjectuiv"); + api->UniformBlockBinding = loadProc("glUniformBlockBinding"); + api->SampleCoverage = loadProc("glSampleCoverage"); + api->VertexAttrib4Nusv = oc_glVertexAttrib4Nusv_noimpl; + api->ProgramUniformMatrix2x4dv = oc_glProgramUniformMatrix2x4dv_noimpl; + api->Uniform3uiv = loadProc("glUniform3uiv"); + api->VertexAttrib1s = oc_glVertexAttrib1s_noimpl; + api->GetVertexAttribPointerv = loadProc("glGetVertexAttribPointerv"); + api->BlendBarrier = loadProc("glBlendBarrier"); + api->DrawRangeElements = loadProc("glDrawRangeElements"); + api->TexStorage3D = loadProc("glTexStorage3D"); + api->GetInternalformati64v = oc_glGetInternalformati64v_noimpl; + api->GetQueryObjecti64v = oc_glGetQueryObjecti64v_noimpl; + api->CompressedTexSubImage1D = oc_glCompressedTexSubImage1D_noimpl; + api->VertexAttrib3dv = oc_glVertexAttrib3dv_noimpl; + api->VertexBindingDivisor = loadProc("glVertexBindingDivisor"); + api->UseProgramStages = loadProc("glUseProgramStages"); + api->VertexAttribBinding = loadProc("glVertexAttribBinding"); + api->DebugMessageInsert = loadProc("glDebugMessageInsert"); + api->GetTexParameteriv = loadProc("glGetTexParameteriv"); + api->MultiDrawArraysIndirect = oc_glMultiDrawArraysIndirect_noimpl; + api->GetTexParameterfv = loadProc("glGetTexParameterfv"); + api->GetProgramPipelineInfoLog = loadProc("glGetProgramPipelineInfoLog"); + api->EndQuery = loadProc("glEndQuery"); + api->GetProgramResourceLocation = loadProc("glGetProgramResourceLocation"); + api->CompressedTexImage2D = loadProc("glCompressedTexImage2D"); + api->VertexAttribP2ui = oc_glVertexAttribP2ui_noimpl; + api->IsEnabledi = loadProc("glIsEnabledi"); + api->GetActiveAtomicCounterBufferiv = oc_glGetActiveAtomicCounterBufferiv_noimpl; + api->IsProgram = loadProc("glIsProgram"); + api->Uniform1dv = oc_glUniform1dv_noimpl; + api->TexParameteriv = loadProc("glTexParameteriv"); + api->Uniform2fv = loadProc("glUniform2fv"); + api->ReleaseShaderCompiler = loadProc("glReleaseShaderCompiler"); + api->CullFace = loadProc("glCullFace"); + api->VertexAttribI4i = loadProc("glVertexAttribI4i"); + api->GetProgramResourceIndex = loadProc("glGetProgramResourceIndex"); + api->ShaderBinary = loadProc("glShaderBinary"); + api->UniformMatrix3x2dv = oc_glUniformMatrix3x2dv_noimpl; + api->InvalidateFramebuffer = loadProc("glInvalidateFramebuffer"); + api->AttachShader = loadProc("glAttachShader"); + api->FlushMappedBufferRange = loadProc("glFlushMappedBufferRange"); + api->VertexAttribP3uiv = oc_glVertexAttribP3uiv_noimpl; + api->GetActiveUniformName = oc_glGetActiveUniformName_noimpl; + api->MapBuffer = oc_glMapBuffer_noimpl; + api->DrawBuffers = loadProc("glDrawBuffers"); + api->GetSynciv = loadProc("glGetSynciv"); + api->CopyTexSubImage2D = loadProc("glCopyTexSubImage2D"); + api->ObjectLabel = loadProc("glObjectLabel"); + api->BufferSubData = loadProc("glBufferSubData"); + api->Uniform2f = loadProc("glUniform2f"); + api->DebugMessageCallback = loadProc("glDebugMessageCallback"); + api->VertexAttribL4dv = oc_glVertexAttribL4dv_noimpl; + api->IsProgramPipeline = loadProc("glIsProgramPipeline"); + api->ResumeTransformFeedback = loadProc("glResumeTransformFeedback"); + api->VertexAttribI4iv = loadProc("glVertexAttribI4iv"); + api->GetShaderInfoLog = loadProc("glGetShaderInfoLog"); + api->GetIntegeri_v = loadProc("glGetIntegeri_v"); + api->BindVertexBuffer = loadProc("glBindVertexBuffer"); + api->BlendEquation = loadProc("glBlendEquation"); + api->VertexAttribL2dv = oc_glVertexAttribL2dv_noimpl; + api->VertexAttribI1ui = oc_glVertexAttribI1ui_noimpl; + api->VertexAttrib4Nsv = oc_glVertexAttrib4Nsv_noimpl; + api->VertexAttribL4d = oc_glVertexAttribL4d_noimpl; + api->CopyImageSubData = loadProc("glCopyImageSubData"); + api->GetFramebufferAttachmentParameteriv = loadProc("glGetFramebufferAttachmentParameteriv"); + api->VertexAttribL2d = oc_glVertexAttribL2d_noimpl; + api->GetSubroutineIndex = oc_glGetSubroutineIndex_noimpl; + api->VertexAttribI3uiv = oc_glVertexAttribI3uiv_noimpl; + api->VertexAttrib4iv = oc_glVertexAttrib4iv_noimpl; + api->BindVertexBuffers = oc_glBindVertexBuffers_noimpl; + api->ProgramUniformMatrix2x3dv = oc_glProgramUniformMatrix2x3dv_noimpl; + api->PrimitiveBoundingBox = loadProc("glPrimitiveBoundingBox"); + api->Scissor = loadProc("glScissor"); + api->ClientWaitSync = loadProc("glClientWaitSync"); + api->Uniform3ui = loadProc("glUniform3ui"); + api->VertexAttribP3ui = oc_glVertexAttribP3ui_noimpl; + api->Enable = loadProc("glEnable"); + api->StencilOpSeparate = loadProc("glStencilOpSeparate"); + api->UniformMatrix2x3dv = oc_glUniformMatrix2x3dv_noimpl; + api->ProgramUniformMatrix3dv = oc_glProgramUniformMatrix3dv_noimpl; + api->TexImage2DMultisample = oc_glTexImage2DMultisample_noimpl; + api->VertexAttrib4Nbv = oc_glVertexAttrib4Nbv_noimpl; + api->GetTexImage = oc_glGetTexImage_noimpl; + api->VertexAttrib4sv = oc_glVertexAttrib4sv_noimpl; + api->PixelStorei = loadProc("glPixelStorei"); + api->DepthMask = loadProc("glDepthMask"); + api->TexStorage2D = loadProc("glTexStorage2D"); + api->Clear = loadProc("glClear"); + api->UniformMatrix3x4dv = oc_glUniformMatrix3x4dv_noimpl; + api->DeleteTransformFeedbacks = loadProc("glDeleteTransformFeedbacks"); + api->MapBufferRange = loadProc("glMapBufferRange"); + api->MemoryBarrier = loadProc("glMemoryBarrier"); + api->ViewportIndexedf = oc_glViewportIndexedf_noimpl; + api->VertexAttrib3fv = loadProc("glVertexAttrib3fv"); + api->ObjectPtrLabel = loadProc("glObjectPtrLabel"); + api->TexStorage1D = oc_glTexStorage1D_noimpl; + api->CompressedTexImage3D = loadProc("glCompressedTexImage3D"); + api->VertexAttrib1fv = loadProc("glVertexAttrib1fv"); + api->VertexAttribPointer = loadProc("glVertexAttribPointer"); + api->GetQueryIndexediv = oc_glGetQueryIndexediv_noimpl; + api->CompileShader = loadProc("glCompileShader"); + api->ProgramUniform1i = loadProc("glProgramUniform1i"); + api->GetQueryiv = loadProc("glGetQueryiv"); + api->VertexAttribI1iv = oc_glVertexAttribI1iv_noimpl; + api->CopyTexImage2D = loadProc("glCopyTexImage2D"); + api->GetQueryObjectui64v = oc_glGetQueryObjectui64v_noimpl; + api->PointSize = oc_glPointSize_noimpl; + api->Disablei = loadProc("glDisablei"); + api->VertexAttribL1dv = oc_glVertexAttribL1dv_noimpl; + api->CreateShader = loadProc("glCreateShader"); + api->GetString = loadProc("glGetString"); + api->ViewportArrayv = oc_glViewportArrayv_noimpl; + api->ProgramUniform3d = oc_glProgramUniform3d_noimpl; + api->VertexAttrib4Nubv = oc_glVertexAttrib4Nubv_noimpl; + api->TexParameteri = loadProc("glTexParameteri"); + api->ProgramUniform4fv = loadProc("glProgramUniform4fv"); + api->GenerateMipmap = loadProc("glGenerateMipmap"); + api->CompressedTexSubImage3D = loadProc("glCompressedTexSubImage3D"); + api->Uniform3f = loadProc("glUniform3f"); + api->GetUniformIndices = loadProc("glGetUniformIndices"); + api->VertexAttribLPointer = oc_glVertexAttribLPointer_noimpl; + api->VertexAttribI2uiv = oc_glVertexAttribI2uiv_noimpl; + api->QueryCounter = oc_glQueryCounter_noimpl; + api->ActiveShaderProgram = loadProc("glActiveShaderProgram"); + api->Uniform1ui = loadProc("glUniform1ui"); + api->VertexAttribI1i = oc_glVertexAttribI1i_noimpl; + api->GetTexParameterIiv = loadProc("glGetTexParameterIiv"); + api->GetUniformfv = loadProc("glGetUniformfv"); + api->ProgramUniform2uiv = loadProc("glProgramUniform2uiv"); + api->GetError = loadProc("glGetError"); + api->GetActiveUniformBlockName = loadProc("glGetActiveUniformBlockName"); + api->TextureView = oc_glTextureView_noimpl; + api->GetnUniformiv = loadProc("glGetnUniformiv"); + api->ProgramUniform4dv = oc_glProgramUniform4dv_noimpl; + api->ViewportIndexedfv = oc_glViewportIndexedfv_noimpl; + api->Hint = loadProc("glHint"); + api->GetShaderSource = loadProc("glGetShaderSource"); + api->ProgramUniformMatrix4x3fv = loadProc("glProgramUniformMatrix4x3fv"); + api->Uniform1iv = loadProc("glUniform1iv"); + api->VertexAttribI4bv = oc_glVertexAttribI4bv_noimpl; + api->UniformMatrix4x2dv = oc_glUniformMatrix4x2dv_noimpl; + api->BufferStorage = oc_glBufferStorage_noimpl; + api->IsRenderbuffer = loadProc("glIsRenderbuffer"); + api->GetActiveSubroutineUniformName = oc_glGetActiveSubroutineUniformName_noimpl; + api->LinkProgram = loadProc("glLinkProgram"); + api->GetActiveUniformsiv = loadProc("glGetActiveUniformsiv"); + api->GetDebugMessageLog = loadProc("glGetDebugMessageLog"); + api->CopyTexSubImage3D = loadProc("glCopyTexSubImage3D"); + api->PointParameteri = oc_glPointParameteri_noimpl; + api->ProgramUniform3dv = oc_glProgramUniform3dv_noimpl; + api->CompressedTexImage1D = oc_glCompressedTexImage1D_noimpl; + api->UniformMatrix3x4fv = loadProc("glUniformMatrix3x4fv"); + api->GenSamplers = loadProc("glGenSamplers"); + api->GetCompressedTexImage = oc_glGetCompressedTexImage_noimpl; + api->DeleteQueries = loadProc("glDeleteQueries"); + api->GenProgramPipelines = loadProc("glGenProgramPipelines"); + api->DispatchComputeIndirect = loadProc("glDispatchComputeIndirect"); + api->VertexAttribIPointer = loadProc("glVertexAttribIPointer"); + api->CreateProgram = loadProc("glCreateProgram"); + api->ClearTexSubImage = oc_glClearTexSubImage_noimpl; + api->VertexAttrib4d = oc_glVertexAttrib4d_noimpl; + api->FrontFace = loadProc("glFrontFace"); + api->BindTransformFeedback = loadProc("glBindTransformFeedback"); + api->GetProgramStageiv = oc_glGetProgramStageiv_noimpl; + api->SamplerParameterIiv = loadProc("glSamplerParameterIiv"); + api->GetInteger64v = loadProc("glGetInteger64v"); + api->CreateShaderProgramv = loadProc("glCreateShaderProgramv"); + api->BindBuffersRange = oc_glBindBuffersRange_noimpl; + api->Uniform3fv = loadProc("glUniform3fv"); + api->ProgramUniformMatrix4fv = loadProc("glProgramUniformMatrix4fv"); + api->BindBuffersBase = oc_glBindBuffersBase_noimpl; + api->ClearBufferfi = loadProc("glClearBufferfi"); + api->FramebufferTexture3D = oc_glFramebufferTexture3D_noimpl; + api->Disable = loadProc("glDisable"); + api->ProgramUniform1iv = loadProc("glProgramUniform1iv"); + api->VertexAttribI2iv = oc_glVertexAttribI2iv_noimpl; + api->DepthRangeIndexed = oc_glDepthRangeIndexed_noimpl; + api->PatchParameteri = loadProc("glPatchParameteri"); + api->GetUniformBlockIndex = loadProc("glGetUniformBlockIndex"); + api->MultiDrawArrays = oc_glMultiDrawArrays_noimpl; + api->VertexAttribI4ubv = oc_glVertexAttribI4ubv_noimpl; + api->BindBuffer = loadProc("glBindBuffer"); + api->VertexAttribI3i = oc_glVertexAttribI3i_noimpl; + api->GetDoublev = oc_glGetDoublev_noimpl; + api->DrawTransformFeedbackStream = oc_glDrawTransformFeedbackStream_noimpl; + api->VertexAttribI4uiv = loadProc("glVertexAttribI4uiv"); + api->RenderbufferStorageMultisample = loadProc("glRenderbufferStorageMultisample"); + api->VertexAttribL3dv = oc_glVertexAttribL3dv_noimpl; + api->StencilMaskSeparate = loadProc("glStencilMaskSeparate"); + api->ProgramUniform1d = oc_glProgramUniform1d_noimpl; + api->Viewport = loadProc("glViewport"); + api->VertexAttribP1ui = oc_glVertexAttribP1ui_noimpl; + api->VertexAttrib4dv = oc_glVertexAttrib4dv_noimpl; + api->GenQueries = loadProc("glGenQueries"); + api->TexParameterIiv = loadProc("glTexParameterIiv"); + api->ProgramUniform2d = oc_glProgramUniform2d_noimpl; + api->ProgramUniform1uiv = loadProc("glProgramUniform1uiv"); + api->VertexAttrib4Nub = oc_glVertexAttrib4Nub_noimpl; + api->IsVertexArray = loadProc("glIsVertexArray"); + api->ProgramUniform3f = loadProc("glProgramUniform3f"); + api->ProgramUniform3iv = loadProc("glProgramUniform3iv"); + api->GetProgramBinary = loadProc("glGetProgramBinary"); + api->BindRenderbuffer = loadProc("glBindRenderbuffer"); + api->BindFragDataLocationIndexed = oc_glBindFragDataLocationIndexed_noimpl; + api->GetSamplerParameterIiv = loadProc("glGetSamplerParameterIiv"); + api->VertexAttribDivisor = loadProc("glVertexAttribDivisor"); + api->ProgramUniformMatrix3x2dv = oc_glProgramUniformMatrix3x2dv_noimpl; + api->FramebufferParameteri = loadProc("glFramebufferParameteri"); + api->GenTransformFeedbacks = loadProc("glGenTransformFeedbacks"); + api->DeleteSync = loadProc("glDeleteSync"); + api->ProgramUniform1ui = loadProc("glProgramUniform1ui"); + api->TexSubImage1D = oc_glTexSubImage1D_noimpl; + api->ClearDepthf = loadProc("glClearDepthf"); + api->ReadPixels = loadProc("glReadPixels"); + api->VertexAttribI2i = oc_glVertexAttribI2i_noimpl; + api->Finish = loadProc("glFinish"); + api->LineWidth = loadProc("glLineWidth"); + api->DeleteShader = loadProc("glDeleteShader"); + api->IsSampler = loadProc("glIsSampler"); + api->ProgramUniformMatrix4dv = oc_glProgramUniformMatrix4dv_noimpl; + api->TransformFeedbackVaryings = loadProc("glTransformFeedbackVaryings"); + api->BeginConditionalRender = oc_glBeginConditionalRender_noimpl; + api->BindSamplers = oc_glBindSamplers_noimpl; + api->DeleteProgramPipelines = loadProc("glDeleteProgramPipelines"); + api->ColorMask = loadProc("glColorMask"); + api->TexParameterfv = loadProc("glTexParameterfv"); + api->PushDebugGroup = loadProc("glPushDebugGroup"); + api->ClearBufferfv = loadProc("glClearBufferfv"); + api->IsEnabled = loadProc("glIsEnabled"); + api->VertexAttrib2f = loadProc("glVertexAttrib2f"); + api->ProgramUniform2f = loadProc("glProgramUniform2f"); + api->GetSamplerParameterIuiv = loadProc("glGetSamplerParameterIuiv"); + api->GetInteger64i_v = loadProc("glGetInteger64i_v"); + api->Uniform2dv = oc_glUniform2dv_noimpl; + api->GetBufferSubData = oc_glGetBufferSubData_noimpl; + api->MultiDrawElementsIndirect = oc_glMultiDrawElementsIndirect_noimpl; + api->ProgramParameteri = loadProc("glProgramParameteri"); + api->VertexAttribP4ui = oc_glVertexAttribP4ui_noimpl; + api->SamplerParameterfv = loadProc("glSamplerParameterfv"); + api->PointParameterf = oc_glPointParameterf_noimpl; + api->UniformMatrix2x4fv = loadProc("glUniformMatrix2x4fv"); + api->GenBuffers = loadProc("glGenBuffers"); + api->ProgramUniform2dv = oc_glProgramUniform2dv_noimpl; + api->VertexAttribFormat = loadProc("glVertexAttribFormat"); + api->TexSubImage2D = loadProc("glTexSubImage2D"); + api->VertexAttrib4ubv = oc_glVertexAttrib4ubv_noimpl; + api->GetGraphicsResetStatus = loadProc("glGetGraphicsResetStatus"); + api->GetProgramInterfaceiv = loadProc("glGetProgramInterfaceiv"); + api->VertexAttribIFormat = loadProc("glVertexAttribIFormat"); + api->GetnUniformfv = loadProc("glGetnUniformfv"); + api->DeleteProgram = loadProc("glDeleteProgram"); + api->ClampColor = oc_glClampColor_noimpl; + api->DrawElementsInstancedBaseVertexBaseInstance = oc_glDrawElementsInstancedBaseVertexBaseInstance_noimpl; + api->DrawElements = loadProc("glDrawElements"); + api->DebugMessageControl = loadProc("glDebugMessageControl"); + api->GetRenderbufferParameteriv = loadProc("glGetRenderbufferParameteriv"); + api->DetachShader = loadProc("glDetachShader"); + api->GenFramebuffers = loadProc("glGenFramebuffers"); + api->ProvokingVertex = oc_glProvokingVertex_noimpl; + api->SampleMaski = loadProc("glSampleMaski"); + api->EndQueryIndexed = oc_glEndQueryIndexed_noimpl; + api->ProgramUniform1f = loadProc("glProgramUniform1f"); + api->BindFramebuffer = loadProc("glBindFramebuffer"); + api->BeginQueryIndexed = oc_glBeginQueryIndexed_noimpl; + api->UniformSubroutinesuiv = oc_glUniformSubroutinesuiv_noimpl; + api->GetUniformiv = loadProc("glGetUniformiv"); + api->FramebufferTexture = loadProc("glFramebufferTexture"); + api->PointParameterfv = oc_glPointParameterfv_noimpl; + api->IsTransformFeedback = loadProc("glIsTransformFeedback"); + api->CheckFramebufferStatus = loadProc("glCheckFramebufferStatus"); + api->ShaderSource = loadProc("glShaderSource"); + api->UniformMatrix2x4dv = oc_glUniformMatrix2x4dv_noimpl; + api->BindImageTextures = oc_glBindImageTextures_noimpl; + api->CopyTexImage1D = oc_glCopyTexImage1D_noimpl; + api->UniformMatrix3dv = oc_glUniformMatrix3dv_noimpl; + api->ProgramUniform1dv = oc_glProgramUniform1dv_noimpl; + api->BlitFramebuffer = loadProc("glBlitFramebuffer"); + api->PopDebugGroup = loadProc("glPopDebugGroup"); + api->TexParameterIuiv = loadProc("glTexParameterIuiv"); + api->VertexAttrib2d = oc_glVertexAttrib2d_noimpl; + api->TexImage1D = oc_glTexImage1D_noimpl; + api->GetObjectPtrLabel = loadProc("glGetObjectPtrLabel"); + api->StencilMask = loadProc("glStencilMask"); + api->BeginQuery = loadProc("glBeginQuery"); + api->UniformMatrix4fv = loadProc("glUniformMatrix4fv"); + api->IsSync = loadProc("glIsSync"); + api->Uniform3dv = oc_glUniform3dv_noimpl; + api->ProgramUniform2fv = loadProc("glProgramUniform2fv"); + api->VertexAttribI4sv = oc_glVertexAttribI4sv_noimpl; + api->ScissorArrayv = oc_glScissorArrayv_noimpl; + api->VertexAttribP1uiv = oc_glVertexAttribP1uiv_noimpl; + api->Uniform2uiv = loadProc("glUniform2uiv"); + api->DeleteBuffers = loadProc("glDeleteBuffers"); + api->ProgramUniform3ui = loadProc("glProgramUniform3ui"); + api->FramebufferTextureLayer = loadProc("glFramebufferTextureLayer"); + api->EndTransformFeedback = loadProc("glEndTransformFeedback"); + api->BlendFuncSeparatei = loadProc("glBlendFuncSeparatei"); + api->DrawTransformFeedbackInstanced = oc_glDrawTransformFeedbackInstanced_noimpl; + api->DrawRangeElementsBaseVertex = loadProc("glDrawRangeElementsBaseVertex"); + api->VertexAttrib1f = loadProc("glVertexAttrib1f"); + api->GetUniformSubroutineuiv = oc_glGetUniformSubroutineuiv_noimpl; + api->DisableVertexAttribArray = loadProc("glDisableVertexAttribArray"); + api->ProgramUniformMatrix3x2fv = loadProc("glProgramUniformMatrix3x2fv"); + api->VertexAttribI4usv = oc_glVertexAttribI4usv_noimpl; + api->GetObjectLabel = loadProc("glGetObjectLabel"); + api->BindAttribLocation = loadProc("glBindAttribLocation"); + api->Uniform1f = loadProc("glUniform1f"); + api->GetUniformdv = oc_glGetUniformdv_noimpl; + api->GetUniformLocation = loadProc("glGetUniformLocation"); + api->GetSubroutineUniformLocation = oc_glGetSubroutineUniformLocation_noimpl; + api->GetTexParameterIuiv = loadProc("glGetTexParameterIuiv"); + api->SamplerParameterf = loadProc("glSamplerParameterf"); + api->VertexAttribL3d = oc_glVertexAttribL3d_noimpl; + api->TexImage3DMultisample = oc_glTexImage3DMultisample_noimpl; + api->TexImage3D = loadProc("glTexImage3D"); + api->RenderbufferStorage = loadProc("glRenderbufferStorage"); + api->EnableVertexAttribArray = loadProc("glEnableVertexAttribArray"); + api->VertexAttribP4uiv = oc_glVertexAttribP4uiv_noimpl; + api->Uniform4d = oc_glUniform4d_noimpl; + api->VertexAttrib4s = oc_glVertexAttrib4s_noimpl; + api->DrawElementsInstancedBaseVertex = loadProc("glDrawElementsInstancedBaseVertex"); + api->VertexAttrib3s = oc_glVertexAttrib3s_noimpl; + api->ProgramUniform2iv = loadProc("glProgramUniform2iv"); + api->StencilFuncSeparate = loadProc("glStencilFuncSeparate"); + api->DeleteFramebuffers = loadProc("glDeleteFramebuffers"); + api->DepthRange = oc_glDepthRange_noimpl; + api->UniformMatrix3x2fv = loadProc("glUniformMatrix3x2fv"); + api->ProgramUniformMatrix2dv = oc_glProgramUniformMatrix2dv_noimpl; + api->ShaderStorageBlockBinding = oc_glShaderStorageBlockBinding_noimpl; + api->ClearDepth = oc_glClearDepth_noimpl; + api->VertexAttrib2dv = oc_glVertexAttrib2dv_noimpl; + api->SamplerParameterIuiv = loadProc("glSamplerParameterIuiv"); + api->GetVertexAttribLdv = oc_glGetVertexAttribLdv_noimpl; + api->ProgramUniformMatrix3x4dv = oc_glProgramUniformMatrix3x4dv_noimpl; + api->DepthRangeArrayv = oc_glDepthRangeArrayv_noimpl; + api->GetActiveUniform = loadProc("glGetActiveUniform"); + api->PatchParameterfv = oc_glPatchParameterfv_noimpl; + api->InvalidateTexImage = oc_glInvalidateTexImage_noimpl; + api->VertexAttrib3f = loadProc("glVertexAttrib3f"); + api->ProgramUniform4iv = loadProc("glProgramUniform4iv"); + api->ProgramUniform4d = oc_glProgramUniform4d_noimpl; + api->IsFramebuffer = loadProc("glIsFramebuffer"); + api->PixelStoref = oc_glPixelStoref_noimpl; + api->ProgramUniform4uiv = loadProc("glProgramUniform4uiv"); + api->ProgramUniformMatrix4x2dv = oc_glProgramUniformMatrix4x2dv_noimpl; + api->FenceSync = loadProc("glFenceSync"); + api->GetBufferParameteri64v = loadProc("glGetBufferParameteri64v"); + api->StencilOp = loadProc("glStencilOp"); + api->ClearBufferData = oc_glClearBufferData_noimpl; + api->GetnUniformuiv = loadProc("glGetnUniformuiv"); + api->GetProgramResourceiv = loadProc("glGetProgramResourceiv"); + api->GetVertexAttribdv = oc_glGetVertexAttribdv_noimpl; + api->GetTransformFeedbackVarying = loadProc("glGetTransformFeedbackVarying"); + api->VertexAttrib2fv = loadProc("glVertexAttrib2fv"); + api->GetBooleani_v = loadProc("glGetBooleani_v"); + api->ColorMaski = loadProc("glColorMaski"); + api->InvalidateBufferSubData = oc_glInvalidateBufferSubData_noimpl; + api->UniformMatrix4dv = oc_glUniformMatrix4dv_noimpl; + api->IsQuery = loadProc("glIsQuery"); + api->Uniform4ui = loadProc("glUniform4ui"); + api->Uniform4i = loadProc("glUniform4i"); + api->GetSamplerParameteriv = loadProc("glGetSamplerParameteriv"); + api->MultiDrawElementsBaseVertex = oc_glMultiDrawElementsBaseVertex_noimpl; + api->VertexAttribI1uiv = oc_glVertexAttribI1uiv_noimpl; + api->GetIntegerv = loadProc("glGetIntegerv"); + api->UniformMatrix2x3fv = loadProc("glUniformMatrix2x3fv"); + api->TexImage2D = loadProc("glTexImage2D"); + api->GetAttachedShaders = loadProc("glGetAttachedShaders"); + api->Uniform2d = oc_glUniform2d_noimpl; + api->MemoryBarrierByRegion = loadProc("glMemoryBarrierByRegion"); + api->UniformMatrix2fv = loadProc("glUniformMatrix2fv"); + api->PrimitiveRestartIndex = oc_glPrimitiveRestartIndex_noimpl; + api->GetVertexAttribiv = loadProc("glGetVertexAttribiv"); + api->GetAttribLocation = loadProc("glGetAttribLocation"); + api->TexStorage2DMultisample = loadProc("glTexStorage2DMultisample"); + api->CompressedTexSubImage2D = loadProc("glCompressedTexSubImage2D"); + api->GetVertexAttribfv = loadProc("glGetVertexAttribfv"); + api->GetBufferParameteriv = loadProc("glGetBufferParameteriv"); + api->TexParameterf = loadProc("glTexParameterf"); + api->FramebufferTexture2D = loadProc("glFramebufferTexture2D"); + api->GetActiveAttrib = loadProc("glGetActiveAttrib"); + api->InvalidateTexSubImage = oc_glInvalidateTexSubImage_noimpl; + api->DeleteVertexArrays = loadProc("glDeleteVertexArrays"); + api->VertexAttribI2ui = oc_glVertexAttribI2ui_noimpl; + api->PointParameteriv = oc_glPointParameteriv_noimpl; + api->GetPointerv = loadProc("glGetPointerv"); + api->Enablei = loadProc("glEnablei"); + api->BindBufferRange = loadProc("glBindBufferRange"); + api->DrawArraysInstanced = loadProc("glDrawArraysInstanced"); + api->DeleteTextures = loadProc("glDeleteTextures"); + api->VertexAttrib4Niv = oc_glVertexAttrib4Niv_noimpl; + api->MultiDrawElements = oc_glMultiDrawElements_noimpl; + api->GetProgramiv = loadProc("glGetProgramiv"); + api->DepthFunc = loadProc("glDepthFunc"); + api->GenTextures = loadProc("glGenTextures"); + api->GetInternalformativ = loadProc("glGetInternalformativ"); + api->ProgramUniform3i = loadProc("glProgramUniform3i"); + api->ScissorIndexed = oc_glScissorIndexed_noimpl; + api->VertexAttrib2sv = oc_glVertexAttrib2sv_noimpl; + api->TexStorage3DMultisample = loadProc("glTexStorage3DMultisample"); + api->Uniform2iv = loadProc("glUniform2iv"); + api->DrawArraysInstancedBaseInstance = oc_glDrawArraysInstancedBaseInstance_noimpl; + api->VertexAttribI3ui = oc_glVertexAttribI3ui_noimpl; + api->DeleteSamplers = loadProc("glDeleteSamplers"); + api->GenVertexArrays = loadProc("glGenVertexArrays"); + api->GetFramebufferParameteriv = loadProc("glGetFramebufferParameteriv"); + api->PolygonMode = oc_glPolygonMode_noimpl; + api->ProgramUniformMatrix2x4fv = loadProc("glProgramUniformMatrix2x4fv"); + api->GetProgramResourceName = loadProc("glGetProgramResourceName"); + api->SamplerParameteriv = loadProc("glSamplerParameteriv"); + api->GetActiveSubroutineUniformiv = oc_glGetActiveSubroutineUniformiv_noimpl; + api->GetStringi = loadProc("glGetStringi"); + api->VertexAttribLFormat = oc_glVertexAttribLFormat_noimpl; + api->VertexAttrib3d = oc_glVertexAttrib3d_noimpl; + api->BindVertexArray = loadProc("glBindVertexArray"); + api->UnmapBuffer = loadProc("glUnmapBuffer"); + api->DrawElementsInstancedBaseInstance = oc_glDrawElementsInstancedBaseInstance_noimpl; + api->Uniform4uiv = loadProc("glUniform4uiv"); + api->FramebufferTexture1D = oc_glFramebufferTexture1D_noimpl; + api->DrawTransformFeedbackStreamInstanced = oc_glDrawTransformFeedbackStreamInstanced_noimpl; + api->StencilFunc = loadProc("glStencilFunc"); + api->ValidateProgram = loadProc("glValidateProgram"); + api->Flush = loadProc("glFlush"); + api->ProgramUniform3uiv = loadProc("glProgramUniform3uiv"); + api->DeleteRenderbuffers = loadProc("glDeleteRenderbuffers"); + api->VertexAttrib4fv = loadProc("glVertexAttrib4fv"); + api->UniformMatrix2dv = oc_glUniformMatrix2dv_noimpl; + api->GetFragDataIndex = oc_glGetFragDataIndex_noimpl; + api->Uniform3iv = loadProc("glUniform3iv"); + api->MinSampleShading = loadProc("glMinSampleShading"); + api->GetBooleanv = loadProc("glGetBooleanv"); + api->GetMultisamplefv = loadProc("glGetMultisamplefv"); + api->GetVertexAttribIuiv = loadProc("glGetVertexAttribIuiv"); + api->GetProgramInfoLog = loadProc("glGetProgramInfoLog"); + api->Uniform4fv = loadProc("glUniform4fv"); + api->DrawBuffer = oc_glDrawBuffer_noimpl; + api->Uniform1i = loadProc("glUniform1i"); + api->ProgramUniform4ui = loadProc("glProgramUniform4ui"); + api->ProgramUniformMatrix3fv = loadProc("glProgramUniformMatrix3fv"); + api->BlendEquationSeparate = loadProc("glBlendEquationSeparate"); + api->BindProgramPipeline = loadProc("glBindProgramPipeline"); + api->GetDoublei_v = oc_glGetDoublei_v_noimpl; + api->BufferData = loadProc("glBufferData"); + api->ClearColor = loadProc("glClearColor"); + api->ProgramUniform4i = loadProc("glProgramUniform4i"); + api->GetTexLevelParameteriv = loadProc("glGetTexLevelParameteriv"); + api->GetActiveUniformBlockiv = loadProc("glGetActiveUniformBlockiv"); + api->ProgramUniform1fv = loadProc("glProgramUniform1fv"); + api->PauseTransformFeedback = loadProc("glPauseTransformFeedback"); + api->GetBufferPointerv = loadProc("glGetBufferPointerv"); + api->InvalidateSubFramebuffer = loadProc("glInvalidateSubFramebuffer"); + api->ScissorIndexedv = oc_glScissorIndexedv_noimpl; + api->Uniform2ui = loadProc("glUniform2ui"); + api->BindTexture = loadProc("glBindTexture"); + api->DrawElementsInstanced = loadProc("glDrawElementsInstanced"); + api->ProgramUniform4f = loadProc("glProgramUniform4f"); + api->BindBufferBase = loadProc("glBindBufferBase"); + api->IsShader = loadProc("glIsShader"); + api->ClearBufferSubData = oc_glClearBufferSubData_noimpl; + api->VertexAttrib4Nuiv = oc_glVertexAttrib4Nuiv_noimpl; + api->DrawArraysIndirect = loadProc("glDrawArraysIndirect"); + api->VertexAttrib4usv = oc_glVertexAttrib4usv_noimpl; + api->Uniform1d = oc_glUniform1d_noimpl; + api->ClearTexImage = oc_glClearTexImage_noimpl; + api->Uniform1uiv = loadProc("glUniform1uiv"); + api->BindSampler = loadProc("glBindSampler"); + api->GetTexLevelParameterfv = loadProc("glGetTexLevelParameterfv"); + api->ClearBufferiv = loadProc("glClearBufferiv"); + api->LogicOp = oc_glLogicOp_noimpl; + api->ActiveTexture = loadProc("glActiveTexture"); + api->GetFragDataLocation = loadProc("glGetFragDataLocation"); + api->BlendColor = loadProc("glBlendColor"); + api->UniformMatrix4x3fv = loadProc("glUniformMatrix4x3fv"); + api->ProgramUniform3fv = loadProc("glProgramUniform3fv"); + api->Uniform1fv = loadProc("glUniform1fv"); + api->DrawElementsBaseVertex = loadProc("glDrawElementsBaseVertex"); + api->Uniform4f = loadProc("glUniform4f"); + api->BlendEquationSeparatei = loadProc("glBlendEquationSeparatei"); + api->BlendFuncSeparate = loadProc("glBlendFuncSeparate"); + api->ClearBufferuiv = loadProc("glClearBufferuiv"); + api->CopyTexSubImage1D = oc_glCopyTexSubImage1D_noimpl; + api->DrawTransformFeedback = oc_glDrawTransformFeedback_noimpl; + api->ReadBuffer = loadProc("glReadBuffer"); + api->CopyBufferSubData = loadProc("glCopyBufferSubData"); + api->GetUniformuiv = loadProc("glGetUniformuiv"); + api->PolygonOffset = loadProc("glPolygonOffset"); + api->DispatchCompute = loadProc("glDispatchCompute"); + api->BindImageTexture = loadProc("glBindImageTexture"); + api->UniformMatrix4x3dv = oc_glUniformMatrix4x3dv_noimpl; + api->GenRenderbuffers = loadProc("glGenRenderbuffers"); +} + +void oc_gl_select_api(oc_gl_api* api){ oc_glAPI = api; } +void oc_gl_deselect_api(){ oc_glAPI = &oc_glNoAPI; } +oc_gl_api* oc_gl_get_api(void) { return(oc_glAPI); } + diff --git a/src/graphics/gl_loader.h b/src/graphics/gl_loader.h index fcd6edc..1e0d5a2 100644 --- a/src/graphics/gl_loader.h +++ b/src/graphics/gl_loader.h @@ -1,23 +1,23 @@ -/******************************************************** -* -* @file: gl_loader.h -* @note: auto-generated by glapi.py from gl.xml -* @date: 11/082023 -* -*********************************************************/ -#ifndef __GL_LOADER_H__ -#define __GL_LOADER_H__ - -#include"gl_api.h" - -typedef void*(*mg_gl_load_proc)(const char* name); - -void mg_gl_load_gl41(mg_gl_api* api, mg_gl_load_proc loadProc); -void mg_gl_load_gl43(mg_gl_api* api, mg_gl_load_proc loadProc); -void mg_gl_load_gl44(mg_gl_api* api, mg_gl_load_proc loadProc); -void mg_gl_load_gles30(mg_gl_api* api, mg_gl_load_proc loadProc); -void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc); - -void mg_gl_select_api(mg_gl_api* api); - -#endif // __GL_LOADER_H__ +/******************************************************** +* +* @file: gl_loader.h +* @note: auto-generated by glapi.py from gl.xml +* @date: 15/082023 +* +*********************************************************/ +#ifndef __GL_LOADER_H__ +#define __GL_LOADER_H__ + +#include"gl_api.h" + +typedef void*(*oc_gl_load_proc)(const char* name); + +void oc_gl_load_gl41(oc_gl_api* api, oc_gl_load_proc loadProc); +void oc_gl_load_gl43(oc_gl_api* api, oc_gl_load_proc loadProc); +void oc_gl_load_gl44(oc_gl_api* api, oc_gl_load_proc loadProc); +void oc_gl_load_gles30(oc_gl_api* api, oc_gl_load_proc loadProc); +void oc_gl_load_gles31(oc_gl_api* api, oc_gl_load_proc loadProc); + +void oc_gl_select_api(oc_gl_api* api); + +#endif // __GL_LOADER_H__ diff --git a/src/graphics/glsl_shaders/backprop.glsl b/src/graphics/glsl_shaders/backprop.glsl index e7df4f4..811e770 100644 --- a/src/graphics/glsl_shaders/backprop.glsl +++ b/src/graphics/glsl_shaders/backprop.glsl @@ -6,12 +6,12 @@ layout(std430) buffer; layout(binding = 0) restrict readonly buffer pathQueueBufferSSBO { - mg_gl_path_queue elements[]; + oc_gl_path_queue elements[]; } pathQueueBuffer; layout(binding = 1) restrict buffer tileQueueBufferSSBO { - mg_gl_tile_queue elements[]; + oc_gl_tile_queue elements[]; } tileQueueBuffer; layout(location = 0) uniform int pathQueueBufferStart; @@ -30,7 +30,7 @@ void main() barrier(); int rowIndex = 0; - mg_gl_path_queue pathQueue = pathQueueBuffer.elements[pathQueueBufferStart + pathIndex]; + oc_gl_path_queue pathQueue = pathQueueBuffer.elements[pathQueueBufferStart + pathIndex]; int tileQueueBase = pathQueue.tileQueues; int rowSize = pathQueue.area.z; int rowCount = pathQueue.area.w; diff --git a/src/graphics/glsl_shaders/balance_workgroups.glsl b/src/graphics/glsl_shaders/balance_workgroups.glsl index 668c634..790805a 100644 --- a/src/graphics/glsl_shaders/balance_workgroups.glsl +++ b/src/graphics/glsl_shaders/balance_workgroups.glsl @@ -11,7 +11,7 @@ layout(binding = 0) coherent restrict readonly buffer screenTilesCountBufferSSBO layout(binding = 1) coherent restrict writeonly buffer dispatchBufferSSBO { - mg_gl_dispatch_indirect_command elements[]; + oc_gl_dispatch_indirect_command elements[]; } dispatchBuffer; diff --git a/src/graphics/glsl_shaders/common.glsl b/src/graphics/glsl_shaders/common.glsl index 49582f8..af916d7 100644 --- a/src/graphics/glsl_shaders/common.glsl +++ b/src/graphics/glsl_shaders/common.glsl @@ -2,32 +2,32 @@ layout(std430) buffer; // command -#define MG_GL_FILL 0 -#define MG_GL_STROKE 1 +#define OC_GL_FILL 0 +#define OC_GL_STROKE 1 // element kind -#define MG_GL_LINE 1 -#define MG_GL_QUADRATIC 2 -#define MG_GL_CUBIC 3 +#define OC_GL_LINE 1 +#define OC_GL_QUADRATIC 2 +#define OC_GL_CUBIC 3 // curve config -#define MG_GL_BL 1 /* curve on bottom left */ -#define MG_GL_BR 2 /* curve on bottom right */ -#define MG_GL_TL 3 /* curve on top left */ -#define MG_GL_TR 4 /* curve on top right */ +#define OC_GL_BL 1 /* curve on bottom left */ +#define OC_GL_BR 2 /* curve on bottom right */ +#define OC_GL_TL 3 /* curve on top left */ +#define OC_GL_TR 4 /* curve on top right */ // Operations -#define MG_GL_OP_FILL 0 -#define MG_GL_OP_CLIP_FILL 1 -#define MG_GL_OP_START 2 -#define MG_GL_OP_END 3 -#define MG_GL_OP_SEGMENT 4 +#define OC_GL_OP_FILL 0 +#define OC_GL_OP_CLIP_FILL 1 +#define OC_GL_OP_START 2 +#define OC_GL_OP_END 3 +#define OC_GL_OP_SEGMENT 4 // MSAA -#define MG_GL_MAX_SAMPLE_COUNT 8 -#define MG_GL_MAX_SRC_SAMPLE_COUNT 4 +#define OC_GL_MAX_SAMPLE_COUNT 8 +#define OC_GL_MAX_SRC_SAMPLE_COUNT 4 -struct mg_gl_path +struct oc_gl_path { mat3 uvTransform; vec4 color; @@ -37,14 +37,14 @@ struct mg_gl_path int textureID; }; -struct mg_gl_path_elt +struct oc_gl_path_elt { vec2 p[4]; int pathIndex; int kind; }; -struct mg_gl_segment +struct oc_gl_segment { int kind; int pathIndex; @@ -56,13 +56,13 @@ struct mg_gl_segment float sign; }; -struct mg_gl_path_queue +struct oc_gl_path_queue { ivec4 area; int tileQueues; }; -struct mg_gl_tile_op +struct oc_gl_tile_op { int kind; int next; @@ -70,20 +70,20 @@ struct mg_gl_tile_op int windingOffsetOrCrossRight; }; -struct mg_gl_tile_queue +struct oc_gl_tile_queue { int windingOffset; int first; int last; }; -struct mg_gl_screen_tile +struct oc_gl_screen_tile { uvec2 tileCoord; int first; }; -struct mg_gl_dispatch_indirect_command +struct oc_gl_dispatch_indirect_command { uint num_groups_x; uint num_groups_y; @@ -95,7 +95,7 @@ float ccw(vec2 a, vec2 b, vec2 c) return((b.x-a.x)*(c.y-a.y) - (b.y-a.y)*(c.x-a.x)); } -int side_of_segment(vec2 p, mg_gl_segment seg) +int side_of_segment(vec2 p, oc_gl_segment seg) { int side = 0; if(p.y > seg.box.w || p.y <= seg.box.y) @@ -104,11 +104,11 @@ int side_of_segment(vec2 p, mg_gl_segment seg) { if(p.y > seg.box.w) { - side = (seg.config == MG_GL_TL || seg.config == MG_GL_BR)? -1 : 1; + side = (seg.config == OC_GL_TL || seg.config == OC_GL_BR)? -1 : 1; } else { - side = (seg.config == MG_GL_TL || seg.config == MG_GL_BR)? 1 : -1; + side = (seg.config == OC_GL_TL || seg.config == OC_GL_BR)? 1 : -1; } } } @@ -125,22 +125,22 @@ int side_of_segment(vec2 p, mg_gl_segment seg) vec2 a, b, c; switch(seg.config) { - case MG_GL_TL: + case OC_GL_TL: a = seg.box.xy; b = seg.box.zw; break; - case MG_GL_BR: + case OC_GL_BR: a = seg.box.zw; b = seg.box.xy; break; - case MG_GL_TR: + case OC_GL_TR: a = seg.box.xw; b = seg.box.zy; break; - case MG_GL_BL: + case OC_GL_BL: a = seg.box.zy; b = seg.box.xw; break; @@ -150,30 +150,30 @@ int side_of_segment(vec2 p, mg_gl_segment seg) if(ccw(a, b, p) < 0) { // other side of the diagonal - side = (seg.config == MG_GL_BR || seg.config == MG_GL_TR) ? -1 : 1; + side = (seg.config == OC_GL_BR || seg.config == OC_GL_TR) ? -1 : 1; } else if(ccw(b, c, p) < 0 || ccw(c, a, p) < 0) { // same side of the diagonal, but outside curve hull - side = (seg.config == MG_GL_BL || seg.config == MG_GL_TL) ? -1 : 1; + side = (seg.config == OC_GL_BL || seg.config == OC_GL_TL) ? -1 : 1; } else { // inside curve hull switch(seg.kind) { - case MG_GL_LINE: + case OC_GL_LINE: side = 1; break; - case MG_GL_QUADRATIC: + case OC_GL_QUADRATIC: { vec3 ph = {p.x, p.y, 1}; vec3 klm = seg.implicitMatrix * ph; side = ((klm.x*klm.x - klm.y)*klm.z < 0)? -1 : 1; } break; - case MG_GL_CUBIC: + case OC_GL_CUBIC: { vec3 ph = {p.x, p.y, 1}; vec3 klm = seg.implicitMatrix * ph; diff --git a/src/graphics/glsl_shaders/merge.glsl b/src/graphics/glsl_shaders/merge.glsl index d0a5494..fa13683 100644 --- a/src/graphics/glsl_shaders/merge.glsl +++ b/src/graphics/glsl_shaders/merge.glsl @@ -6,17 +6,17 @@ layout(std430) buffer; layout(binding = 0) restrict readonly buffer pathBufferSSBO { - mg_gl_path elements[]; + oc_gl_path elements[]; } pathBuffer; layout(binding = 1) restrict readonly buffer pathQueueBufferSSBO { - mg_gl_path_queue elements[]; + oc_gl_path_queue elements[]; } pathQueueBuffer; layout(binding = 2) restrict readonly buffer tileQueueBufferSSBO { - mg_gl_tile_queue elements[]; + oc_gl_tile_queue elements[]; } tileQueueBuffer; layout(binding = 3) coherent restrict buffer tileOpCountBufferSSBO @@ -26,12 +26,12 @@ layout(binding = 3) coherent restrict buffer tileOpCountBufferSSBO layout(binding = 4) restrict buffer tileOpBufferSSBO { - mg_gl_tile_op elements[]; + oc_gl_tile_op elements[]; } tileOpBuffer; layout(binding = 5) restrict writeonly buffer screenTilesBufferSSBO { - mg_gl_screen_tile elements[]; + oc_gl_screen_tile elements[]; } screenTilesBuffer; layout(binding = 6) coherent restrict buffer screenTilesCountBufferSSBO @@ -54,7 +54,7 @@ void main() for(int pathIndex = 0; pathIndex < pathCount; pathIndex++) { - mg_gl_path_queue pathQueue = pathQueueBuffer.elements[pathIndex]; + oc_gl_path_queue pathQueue = pathQueueBuffer.elements[pathIndex]; ivec2 pathTileCoord = tileCoord - pathQueue.area.xy; vec4 pathBox = pathBuffer.elements[pathBufferStart + pathIndex].box; @@ -77,7 +77,7 @@ void main() } int pathTileIndex = pathQueue.tileQueues + pathTileCoord.y * pathQueue.area.z + pathTileCoord.x; - mg_gl_tile_queue tileQueue = tileQueueBuffer.elements[pathTileIndex]; + oc_gl_tile_queue tileQueue = tileQueueBuffer.elements[pathTileIndex]; int windingOffset = tileQueue.windingOffset; int firstOpIndex = tileQueue.first; @@ -107,7 +107,7 @@ void main() return; } - tileOpBuffer.elements[pathOpIndex].kind = MG_GL_OP_CLIP_FILL; + tileOpBuffer.elements[pathOpIndex].kind = OC_GL_OP_CLIP_FILL; tileOpBuffer.elements[pathOpIndex].next = -1; tileOpBuffer.elements[pathOpIndex].index = pathIndex; tileOpBuffer.elements[pathOpIndex].windingOffsetOrCrossRight = windingOffset; @@ -126,7 +126,7 @@ void main() && tileBox.y >= clip.y && tileBox.w < clip.w) { - tileOpBuffer.elements[pathOpIndex].kind = MG_GL_OP_FILL; + tileOpBuffer.elements[pathOpIndex].kind = OC_GL_OP_FILL; if( pathBuffer.elements[pathBufferStart + pathIndex].color.a == 1 && pathBuffer.elements[pathBufferStart + pathIndex].textureID < 0) @@ -147,7 +147,7 @@ void main() return; } - tileOpBuffer.elements[startOpIndex].kind = MG_GL_OP_START; + tileOpBuffer.elements[startOpIndex].kind = OC_GL_OP_START; tileOpBuffer.elements[startOpIndex].next = -1; tileOpBuffer.elements[startOpIndex].index = pathIndex; tileOpBuffer.elements[startOpIndex].windingOffsetOrCrossRight = windingOffset; @@ -173,7 +173,7 @@ void main() return; } - tileOpBuffer.elements[endOpIndex].kind = MG_GL_OP_END; + tileOpBuffer.elements[endOpIndex].kind = OC_GL_OP_END; tileOpBuffer.elements[endOpIndex].next = -1; tileOpBuffer.elements[endOpIndex].index = pathIndex; tileOpBuffer.elements[endOpIndex].windingOffsetOrCrossRight = windingOffset; diff --git a/src/graphics/glsl_shaders/path_setup.glsl b/src/graphics/glsl_shaders/path_setup.glsl index 177247d..01345f6 100644 --- a/src/graphics/glsl_shaders/path_setup.glsl +++ b/src/graphics/glsl_shaders/path_setup.glsl @@ -6,12 +6,12 @@ layout(std430) buffer; layout(binding = 0) restrict readonly buffer pathBufferSSBO { - mg_gl_path elements[]; + oc_gl_path elements[]; } pathBuffer; layout(binding = 1) restrict writeonly buffer pathQueueBufferSSBO { - mg_gl_path_queue elements[]; + oc_gl_path_queue elements[]; } pathQueueBuffer; layout(binding = 2) coherent restrict buffer tileQueueCountBufferSSBO @@ -21,7 +21,7 @@ layout(binding = 2) coherent restrict buffer tileQueueCountBufferSSBO layout(binding = 3) restrict writeonly buffer tileQueueBufferSSBO { - mg_gl_tile_queue elements[]; + oc_gl_tile_queue elements[]; } tileQueueBuffer; layout(location = 0) uniform int tileSize; @@ -32,7 +32,7 @@ layout(location = 3) uniform int pathQueueBufferStart; void main() { uint pathIndex = gl_WorkGroupID.x; - const mg_gl_path path = pathBuffer.elements[pathIndex + pathBufferStart]; + const oc_gl_path path = pathBuffer.elements[pathIndex + pathBufferStart]; //NOTE: we don't clip on the right, since we need those tiles to accurately compute // the prefix sum of winding increments in the backprop pass. diff --git a/src/graphics/glsl_shaders/raster.glsl b/src/graphics/glsl_shaders/raster.glsl index 2b5f32e..8b099c6 100644 --- a/src/graphics/glsl_shaders/raster.glsl +++ b/src/graphics/glsl_shaders/raster.glsl @@ -6,22 +6,22 @@ layout(std430) buffer; layout(binding = 0) restrict readonly buffer pathBufferSSBO { - mg_gl_path elements[]; + oc_gl_path elements[]; } pathBuffer; layout(binding = 1) restrict readonly buffer segmentBufferSSBO { - mg_gl_segment elements[]; + oc_gl_segment elements[]; } segmentBuffer; layout(binding = 2) restrict readonly buffer tileOpBufferSSBO { - mg_gl_tile_op elements[]; + oc_gl_tile_op elements[]; } tileOpBuffer; layout(binding = 3) restrict readonly buffer screenTilesBufferSSBO { - mg_gl_screen_tile elements[]; + oc_gl_screen_tile elements[]; } screenTilesBuffer; layout(binding = 4) restrict readonly buffer screenTilesCountBufferSSBO @@ -67,7 +67,7 @@ void main() return; } */ - vec2 sampleCoords[MG_GL_MAX_SAMPLE_COUNT] = { + vec2 sampleCoords[OC_GL_MAX_SAMPLE_COUNT] = { centerCoord + vec2(1, 3)/16, centerCoord + vec2(-1, -3)/16, centerCoord + vec2(5, -1)/16, @@ -87,14 +87,14 @@ void main() const int srcSampleCount = 2; - vec2 imgSampleCoords[MG_GL_MAX_SRC_SAMPLE_COUNT] = { + vec2 imgSampleCoords[OC_GL_MAX_SRC_SAMPLE_COUNT] = { centerCoord + vec2(-0.25, 0.25), centerCoord + vec2(+0.25, +0.25), centerCoord + vec2(+0.25, -0.25), centerCoord + vec2(-0.25, +0.25)}; vec4 color = vec4(0); - int winding[MG_GL_MAX_SAMPLE_COUNT]; + int winding[OC_GL_MAX_SAMPLE_COUNT]; for(int i=0; i= 0) { - mg_gl_tile_op op = tileOpBuffer.elements[opIndex]; + oc_gl_tile_op op = tileOpBuffer.elements[opIndex]; - if(op.kind == MG_GL_OP_START) + if(op.kind == OC_GL_OP_START) { for(int sampleIndex = 0; sampleIndex seg.box.w)) { winding[sampleIndex] += seg.windingIncrement; } - else if( (seg.config == MG_GL_BL || seg.config == MG_GL_TR) + else if( (seg.config == OC_GL_BL || seg.config == OC_GL_TR) &&(sampleCoord.y > seg.box.y)) { winding[sampleIndex] -= seg.windingIncrement; @@ -202,7 +202,7 @@ void main() nextColor *= texColor; } - if(op.kind == MG_GL_OP_FILL) + if(op.kind == OC_GL_OP_FILL) { color = color*(1-nextColor.a) + nextColor; } @@ -220,10 +220,10 @@ void main() && sampleCoord.y >= clip.y && sampleCoord.y < clip.w) { - bool filled = op.kind == MG_GL_OP_CLIP_FILL - ||(pathBuffer.elements[pathBufferStart + pathIndex].cmd == MG_GL_FILL + bool filled = op.kind == OC_GL_OP_CLIP_FILL + ||(pathBuffer.elements[pathBufferStart + pathIndex].cmd == OC_GL_FILL && ((winding[sampleIndex] & 1) != 0)) - ||(pathBuffer.elements[pathBufferStart + pathIndex].cmd == MG_GL_STROKE + ||(pathBuffer.elements[pathBufferStart + pathIndex].cmd == OC_GL_STROKE && (winding[sampleIndex] != 0)); if(filled) { diff --git a/src/graphics/glsl_shaders/segment_setup.glsl b/src/graphics/glsl_shaders/segment_setup.glsl index 0f39d10..ace7dcd 100644 --- a/src/graphics/glsl_shaders/segment_setup.glsl +++ b/src/graphics/glsl_shaders/segment_setup.glsl @@ -6,7 +6,7 @@ layout(std430) buffer; layout(binding = 0) restrict readonly buffer elementBufferSSBO { - mg_gl_path_elt elements[]; + oc_gl_path_elt elements[]; } elementBuffer; layout(binding = 1) coherent restrict buffer segmentCountBufferSSBO @@ -16,17 +16,17 @@ layout(binding = 1) coherent restrict buffer segmentCountBufferSSBO layout(binding = 2) restrict buffer segmentBufferSSBO { - mg_gl_segment elements[]; + oc_gl_segment elements[]; } segmentBuffer; layout(binding = 3) restrict buffer pathQueueBufferSSBO { - mg_gl_path_queue elements[]; + oc_gl_path_queue elements[]; } pathQueueBuffer; layout(binding = 4) coherent restrict buffer tileQueueBufferSSBO { - mg_gl_tile_queue elements[]; + oc_gl_tile_queue elements[]; } tileQueueBuffer; layout(binding = 5) coherent restrict buffer tileOpCountBufferSSBO @@ -36,7 +36,7 @@ layout(binding = 5) coherent restrict buffer tileOpCountBufferSSBO layout(binding = 6) restrict buffer tileOpBufferSSBO { - mg_gl_tile_op elements[]; + oc_gl_tile_op elements[]; } tileOpBuffer; layout(location = 0) uniform float scale; @@ -46,8 +46,8 @@ layout(location = 2) uniform int elementBufferStart; void bin_to_tiles(int segIndex) { //NOTE: add segment index to the queues of tiles it overlaps with - const mg_gl_segment seg = segmentBuffer.elements[segIndex]; - const mg_gl_path_queue pathQueue = pathQueueBuffer.elements[seg.pathIndex]; + const oc_gl_segment seg = segmentBuffer.elements[segIndex]; + const oc_gl_path_queue pathQueue = pathQueueBuffer.elements[seg.pathIndex]; ivec4 pathArea = pathQueue.area; ivec4 coveredTiles = ivec4(seg.box)/int(tileSize); @@ -81,7 +81,7 @@ void bin_to_tiles(int segIndex) bool crossB = (sbl*sbr < 0); vec2 s0, s1; - if(seg.config == MG_GL_TL||seg.config == MG_GL_BR) + if(seg.config == OC_GL_TL||seg.config == OC_GL_BR) { s0 = seg.box.xy; s1 = seg.box.zw; @@ -107,7 +107,7 @@ void bin_to_tiles(int segIndex) if(tileOpIndex < tileOpBuffer.elements.length()) { - tileOpBuffer.elements[tileOpIndex].kind = MG_GL_OP_SEGMENT; + tileOpBuffer.elements[tileOpIndex].kind = OC_GL_OP_SEGMENT; tileOpBuffer.elements[tileOpIndex].index = segIndex; tileOpBuffer.elements[tileOpIndex].windingOffsetOrCrossRight = 0; tileOpBuffer.elements[tileOpIndex].next = -1; @@ -148,19 +148,19 @@ int push_segment(in vec2 p[4], int kind, int pathIndex) switch(kind) { - case MG_GL_LINE: + case OC_GL_LINE: s = p[0]; c = p[0]; e = p[1]; break; - case MG_GL_QUADRATIC: + case OC_GL_QUADRATIC: s = p[0]; c = p[1]; e = p[2]; break; - case MG_GL_CUBIC: + case OC_GL_CUBIC: { s = p[0]; float sqrNorm0 = dot(p[1]-p[0], p[1]-p[0]); @@ -197,32 +197,32 @@ int push_segment(in vec2 p[4], int kind, int pathIndex) if(goingUp == goingRight) { - if(kind == MG_GL_LINE) + if(kind == OC_GL_LINE) { - segmentBuffer.elements[segIndex].config = MG_GL_BR; + segmentBuffer.elements[segIndex].config = OC_GL_BR; } else if(dy > alpha*dx) { - segmentBuffer.elements[segIndex].config = MG_GL_TL; + segmentBuffer.elements[segIndex].config = OC_GL_TL; } else { - segmentBuffer.elements[segIndex].config = MG_GL_BR; + segmentBuffer.elements[segIndex].config = OC_GL_BR; } } else { - if(kind == MG_GL_LINE) + if(kind == OC_GL_LINE) { - segmentBuffer.elements[segIndex].config = MG_GL_TR; + segmentBuffer.elements[segIndex].config = OC_GL_TR; } else if(dy < ofs - alpha*dx) { - segmentBuffer.elements[segIndex].config = MG_GL_BL; + segmentBuffer.elements[segIndex].config = OC_GL_BL; } else { - segmentBuffer.elements[segIndex].config = MG_GL_TR; + segmentBuffer.elements[segIndex].config = OC_GL_TR; } } } @@ -234,7 +234,7 @@ int push_segment(in vec2 p[4], int kind, int pathIndex) void line_setup(vec2 p[4], int pathIndex) { - int segIndex = push_segment(p, MG_GL_LINE, pathIndex); + int segIndex = push_segment(p, OC_GL_LINE, pathIndex); if(segIndex < segmentBuffer.elements.length()) { segmentBuffer.elements[segIndex].hullVertex = p[0]; @@ -304,7 +304,7 @@ mat3 barycentric_matrix(vec2 v0, vec2 v1, vec2 v2) void quadratic_emit(vec2 p[4], int pathIndex) { - int segIndex = push_segment(p, MG_GL_QUADRATIC, pathIndex); + int segIndex = push_segment(p, OC_GL_QUADRATIC, pathIndex); if(segIndex < segmentBuffer.elements.length()) { @@ -318,8 +318,8 @@ void quadratic_emit(vec2 p[4], int pathIndex) float e = p[1].x - p[0].x; float f = p[0].x*p[1].y - p[1].x*p[0].y; - float flip = ( segmentBuffer.elements[segIndex].config == MG_GL_TL - || segmentBuffer.elements[segIndex].config == MG_GL_BL)? -1 : 1; + float flip = ( segmentBuffer.elements[segIndex].config == OC_GL_TL + || segmentBuffer.elements[segIndex].config == OC_GL_BL)? -1 : 1; float g = flip*(p[2].x*(p[0].y - p[1].y) + p[0].x*(p[1].y - p[2].y) + p[1].x*(p[2].y - p[0].y)); @@ -663,7 +663,7 @@ vec2 select_hull_vertex(vec2 p0, vec2 p1, vec2 p2, vec2 p3) void cubic_emit(cubic_info curve, vec2 p[4], float s0, float s1, vec2 sp[4], int pathIndex) { - int segIndex = push_segment(sp, MG_GL_CUBIC, pathIndex); + int segIndex = push_segment(sp, OC_GL_CUBIC, pathIndex); if(segIndex < segmentBuffer.elements.length()) { @@ -839,23 +839,23 @@ void main() { int eltIndex = int(gl_WorkGroupID.x); - mg_gl_path_elt elt = elementBuffer.elements[elementBufferStart + eltIndex]; + oc_gl_path_elt elt = elementBuffer.elements[elementBufferStart + eltIndex]; switch(elt.kind) { - case MG_GL_LINE: + case OC_GL_LINE: { vec2 p[4] = {elt.p[0]*scale, elt.p[1]*scale, vec2(0), vec2(0)}; line_setup(p, elt.pathIndex); } break; - case MG_GL_QUADRATIC: + case OC_GL_QUADRATIC: { vec2 p[4] = {elt.p[0]*scale, elt.p[1]*scale, elt.p[2]*scale, vec2(0)}; quadratic_setup(p, elt.pathIndex); } break; - case MG_GL_CUBIC: + case OC_GL_CUBIC: { vec2 p[4] = {elt.p[0]*scale, elt.p[1]*scale, elt.p[2]*scale, elt.p[3]*scale}; cubic_setup(p, elt.pathIndex); diff --git a/src/graphics/graphics.h b/src/graphics/graphics.h index c9ad390..f24e622 100644 --- a/src/graphics/graphics.h +++ b/src/graphics/graphics.h @@ -11,126 +11,121 @@ #include"util/typedefs.h" #include"platform/platform.h" -#include"app/mp_app.h" +#include"app/app.h" //------------------------------------------------------------------------------------------ //NOTE(martin): backends selection //------------------------------------------------------------------------------------------ typedef enum { - MG_NONE, - MG_METAL, - MG_GL, - MG_GLES, - MG_CANVAS, - MG_HOST } mg_surface_api; + OC_NONE, + OC_METAL, + OC_GL, + OC_GLES, + OC_CANVAS, + OC_HOST } oc_surface_api; //NOTE: these macros are used to select which backend to include when building milepost // they can be overridden by passing them to the compiler command line -#if PLATFORM_MACOS - #ifndef MG_COMPILE_METAL - #define MG_COMPILE_METAL 1 +#if OC_PLATFORM_MACOS + #ifndef OC_COMPILE_METAL + #define OC_COMPILE_METAL 1 #endif - #ifndef MG_COMPILE_GLES - #define MG_COMPILE_GLES 1 + #ifndef OC_COMPILE_GLES + #define OC_COMPILE_GLES 1 #endif - #ifndef MG_COMPILE_CANVAS - #if !MG_COMPILE_METAL - #error "Canvas surface requires a Metal backend on macOS. Make sure you define MG_COMPILE_METAL to 1." + #ifndef OC_COMPILE_CANVAS + #if !OC_COMPILE_METAL + #error "Canvas surface requires a Metal backend on macOS. Make sure you define OC_COMPILE_METAL to 1." #endif - #define MG_COMPILE_CANVAS 1 + #define OC_COMPILE_CANVAS 1 #endif - #define MG_COMPILE_GL 0 + #define OC_COMPILE_GL 0 -#elif PLATFORM_WINDOWS - #ifndef MG_COMPILE_GL - #define MG_COMPILE_GL 1 +#elif OC_PLATFORM_WINDOWS + #ifndef OC_COMPILE_GL + #define OC_COMPILE_GL 1 #endif - #ifndef MG_COMPILE_GLES - #define MG_COMPILE_GLES 1 + #ifndef OC_COMPILE_GLES + #define OC_COMPILE_GLES 1 #endif - #ifndef MG_COMPILE_CANVAS - #if !MG_COMPILE_GL - #error "Canvas surface requires an OpenGL backend on Windows. Make sure you define MG_COMPILE_GL to 1." + #ifndef OC_COMPILE_CANVAS + #if !OC_COMPILE_GL + #error "Canvas surface requires an OpenGL backend on Windows. Make sure you define OC_COMPILE_GL to 1." #endif - #define MG_COMPILE_CANVAS 1 + #define OC_COMPILE_CANVAS 1 #endif #elif PLATFORM_LINUX - #ifndef MG_COMPILE_GL - #define MG_COMPILE_GL 1 + #ifndef OC_COMPILE_GL + #define OC_COMPILE_GL 1 #endif - #ifndef MG_COMPILE_CANVAS - #if !MG_COMPILE_GL - #error "Canvas surface requires an OpenGL backend on Linux. Make sure you define MG_COMPILE_GL to 1." + #ifndef OC_COMPILE_CANVAS + #if !OC_COMPILE_GL + #error "Canvas surface requires an OpenGL backend on Linux. Make sure you define OC_COMPILE_GL to 1." #endif - #define MG_COMPILE_CANVAS 1 + #define OC_COMPILE_CANVAS 1 #endif #endif //NOTE: these macros are used to select backend-specific APIs to include when using milepost -#ifdef MG_EXPOSE_SURFACE_METAL +#ifdef OC_EXPOSE_SURFACE_METAL #include"mtl_surface.h" #endif -#ifdef MG_EXPOSE_SURFACE_WGL +#ifdef OC_EXPOSE_SURFACE_WGL #include"wgl_surface.h" #endif //TODO: expose nsgl surface when supported, expose egl surface, etc... -//TODO: add MG_INCLUDE_OPENGL/GLES/etc, once we know how we make different gl versions co-exist +//TODO: add OC_INCLUDE_OPENGL/GLES/etc, once we know how we make different gl versions co-exist -MP_API bool mg_is_surface_api_available(mg_surface_api api); +ORCA_API bool oc_is_surface_api_available(oc_surface_api api); //------------------------------------------------------------------------------------------ //NOTE(martin): graphics surface //------------------------------------------------------------------------------------------ -typedef struct mg_surface { u64 h; } mg_surface; +typedef struct oc_surface { u64 h; } oc_surface; -MP_API mg_surface mg_surface_nil(void); -MP_API bool mg_surface_is_nil(mg_surface surface); +ORCA_API oc_surface oc_surface_nil(void); +ORCA_API bool oc_surface_is_nil(oc_surface surface); -MP_API mg_surface mg_surface_create_for_window(mp_window window, mg_surface_api api); -MP_API void mg_surface_destroy(mg_surface surface); +ORCA_API oc_surface oc_surface_create_for_window(oc_window window, oc_surface_api api); +ORCA_API void oc_surface_destroy(oc_surface surface); -MP_API void mg_surface_prepare(mg_surface surface); -MP_API void mg_surface_present(mg_surface surface); -MP_API void mg_surface_deselect(void); +ORCA_API void oc_surface_select(oc_surface surface); +ORCA_API void oc_surface_present(oc_surface surface); +ORCA_API void oc_surface_deselect(void); -MP_API void mg_surface_swap_interval(mg_surface surface, int swap); -MP_API vec2 mg_surface_get_size(mg_surface surface); -MP_API vec2 mg_surface_contents_scaling(mg_surface surface); -MP_API bool mg_surface_get_hidden(mg_surface surface); -MP_API void mg_surface_set_hidden(mg_surface surface, bool hidden); +ORCA_API void oc_surface_swap_interval(oc_surface surface, int swap); +ORCA_API oc_vec2 oc_surface_get_size(oc_surface surface); +ORCA_API oc_vec2 oc_surface_contents_scaling(oc_surface surface); +ORCA_API bool oc_surface_get_hidden(oc_surface surface); +ORCA_API void oc_surface_set_hidden(oc_surface surface, bool hidden); //NOTE(martin): surface sharing -typedef u64 mg_surface_id; +typedef u64 oc_surface_id; -MP_API mg_surface mg_surface_create_remote(u32 width, u32 height, mg_surface_api api); -MP_API mg_surface mg_surface_create_host(mp_window window); -MP_API mg_surface_id mg_surface_remote_id(mg_surface surface); -MP_API void mg_surface_host_connect(mg_surface surface, mg_surface_id remoteId); +ORCA_API oc_surface oc_surface_create_remote(u32 width, u32 height, oc_surface_api api); +ORCA_API oc_surface oc_surface_create_host(oc_window window); +ORCA_API oc_surface_id oc_surface_remote_id(oc_surface surface); +ORCA_API void oc_surface_host_connect(oc_surface surface, oc_surface_id remoteId); //------------------------------------------------------------------------------------------ //NOTE(martin): graphics canvas structs //------------------------------------------------------------------------------------------ -typedef struct mg_canvas { u64 h; } mg_canvas; -typedef struct mg_font { u64 h; } mg_font; -typedef struct mg_image { u64 h; } mg_image; +typedef struct oc_canvas { u64 h; } oc_canvas; +typedef struct oc_font { u64 h; } oc_font; +typedef struct oc_image { u64 h; } oc_image; -typedef struct mg_mat2x3 -{ - f32 m[6]; -} mg_mat2x3; - -typedef struct mg_color +typedef struct oc_color { union { @@ -143,16 +138,16 @@ typedef struct mg_color }; f32 c[4]; }; -} mg_color; +} oc_color; -typedef enum {MG_JOINT_MITER = 0, - MG_JOINT_BEVEL, - MG_JOINT_NONE } mg_joint_type; +typedef enum {OC_JOINT_MITER = 0, + OC_JOINT_BEVEL, + OC_JOINT_NONE } oc_joint_type; -typedef enum {MG_CAP_NONE = 0, - MG_CAP_SQUARE } mg_cap_type; +typedef enum {OC_CAP_NONE = 0, + OC_CAP_SQUARE } oc_cap_type; -typedef struct mg_font_extents +typedef struct oc_font_extents { f32 ascent; // the extent above the baseline (by convention a positive value extends above the baseline) f32 descent; // the extent below the baseline (by convention, positive value extends below the baseline) @@ -161,9 +156,9 @@ typedef struct mg_font_extents f32 capHeight; // height of the upper case letter 'M' f32 width; // maximum width of the font -} mg_font_extents; +} oc_font_extents; -typedef struct mg_text_extents +typedef struct oc_text_extents { f32 xBearing; f32 yBearing; @@ -172,159 +167,159 @@ typedef struct mg_text_extents f32 xAdvance; f32 yAdvance; -} mg_text_extents; +} oc_text_extents; //------------------------------------------------------------------------------------------ //NOTE(martin): graphics canvas //------------------------------------------------------------------------------------------ -MP_API mg_canvas mg_canvas_nil(void); -MP_API bool mg_canvas_is_nil(mg_canvas canvas); +ORCA_API oc_canvas oc_canvas_nil(void); +ORCA_API bool oc_canvas_is_nil(oc_canvas canvas); -MP_API mg_canvas mg_canvas_create(void); -MP_API void mg_canvas_destroy(mg_canvas canvas); -MP_API mg_canvas mg_canvas_set_current(mg_canvas canvas); -MP_API void mg_render(mg_surface surface, mg_canvas canvas); +ORCA_API oc_canvas oc_canvas_create(void); +ORCA_API void oc_canvas_destroy(oc_canvas canvas); +ORCA_API oc_canvas oc_canvas_set_current(oc_canvas canvas); +ORCA_API void oc_render(oc_surface surface, oc_canvas canvas); //------------------------------------------------------------------------------------------ //NOTE(martin): fonts //------------------------------------------------------------------------------------------ -MP_API mg_font mg_font_nil(void); -MP_API mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unicode_range* ranges); -MP_API void mg_font_destroy(mg_font font); +ORCA_API oc_font oc_font_nil(void); +ORCA_API oc_font oc_font_create_from_memory(oc_str8 mem, u32 rangeCount, oc_unicode_range* ranges); +ORCA_API void oc_font_destroy(oc_font font); //NOTE(martin): the following int valued functions return -1 if font is invalid or codepoint is not present in font// //TODO(martin): add enum error codes -MP_API mg_font_extents mg_font_get_extents(mg_font font); -MP_API mg_font_extents mg_font_get_scaled_extents(mg_font font, f32 emSize); -MP_API f32 mg_font_get_scale_for_em_pixels(mg_font font, f32 emSize); +ORCA_API oc_font_extents oc_font_get_extents(oc_font font); +ORCA_API oc_font_extents oc_font_get_scaled_extents(oc_font font, f32 emSize); +ORCA_API f32 oc_font_get_scale_for_em_pixels(oc_font font, f32 emSize); //NOTE(martin): if you need to process more than one codepoint, first convert your codepoints to glyph indices, then use the // glyph index versions of the functions, which can take an array of glyph indices. -MP_API str32 mg_font_get_glyph_indices(mg_font font, str32 codePoints, str32 backing); -MP_API str32 mg_font_push_glyph_indices(mg_font font, mem_arena* arena, str32 codePoints); -MP_API u32 mg_font_get_glyph_index(mg_font font, utf32 codePoint); +ORCA_API oc_str32 oc_font_get_glyph_indices(oc_font font, oc_str32 codePoints, oc_str32 backing); +ORCA_API oc_str32 oc_font_push_glyph_indices(oc_font font, oc_arena* arena, oc_str32 codePoints); +ORCA_API u32 oc_font_get_glyph_index(oc_font font, oc_utf32 codePoint); -MP_API int mg_font_get_codepoint_extents(mg_font font, utf32 codePoint, mg_text_extents* outExtents); +ORCA_API int oc_font_get_codepoint_extents(oc_font font, oc_utf32 codePoint, oc_text_extents* outExtents); -MP_API int mg_font_get_glyph_extents(mg_font font, str32 glyphIndices, mg_text_extents* outExtents); +ORCA_API int oc_font_get_glyph_extents(oc_font font, oc_str32 glyphIndices, oc_text_extents* outExtents); -MP_API mp_rect mg_text_bounding_box_utf32(mg_font font, f32 fontSize, str32 text); -MP_API mp_rect mg_text_bounding_box(mg_font font, f32 fontSize, str8 text); +ORCA_API oc_rect oc_text_bounding_box_utf32(oc_font font, f32 fontSize, oc_str32 text); +ORCA_API oc_rect oc_text_bounding_box(oc_font font, f32 fontSize, oc_str8 text); //------------------------------------------------------------------------------------------ //NOTE(martin): images //------------------------------------------------------------------------------------------ -MP_API mg_image mg_image_nil(void); -MP_API bool mg_image_is_nil(mg_image a); +ORCA_API oc_image oc_image_nil(void); +ORCA_API bool oc_image_is_nil(oc_image a); -MP_API mg_image mg_image_create(mg_surface surface, u32 width, u32 height); -MP_API mg_image mg_image_create_from_rgba8(mg_surface surface, u32 width, u32 height, u8* pixels); -MP_API mg_image mg_image_create_from_data(mg_surface surface, str8 data, bool flip); -MP_API mg_image mg_image_create_from_file(mg_surface surface, str8 path, bool flip); +ORCA_API oc_image oc_image_create(oc_surface surface, u32 width, u32 height); +ORCA_API oc_image oc_image_create_from_rgba8(oc_surface surface, u32 width, u32 height, u8* pixels); +ORCA_API oc_image oc_image_create_from_memory(oc_surface surface, oc_str8 mem, bool flip); +ORCA_API oc_image oc_image_create_from_file(oc_surface surface, oc_str8 path, bool flip); -MP_API void mg_image_destroy(mg_image image); +ORCA_API void oc_image_destroy(oc_image image); -MP_API void mg_image_upload_region_rgba8(mg_image image, mp_rect region, u8* pixels); -MP_API vec2 mg_image_size(mg_image image); +ORCA_API void oc_image_upload_region_rgba8(oc_image image, oc_rect region, u8* pixels); +ORCA_API oc_vec2 oc_image_size(oc_image image); //------------------------------------------------------------------------------------------ //NOTE(martin): atlasing //------------------------------------------------------------------------------------------ //NOTE: rectangle allocator -typedef struct mg_rect_atlas mg_rect_atlas; +typedef struct oc_rect_atlas oc_rect_atlas; -MP_API mg_rect_atlas* mg_rect_atlas_create(mem_arena* arena, i32 width, i32 height); -MP_API mp_rect mg_rect_atlas_alloc(mg_rect_atlas* atlas, i32 width, i32 height); -MP_API void mg_rect_atlas_recycle(mg_rect_atlas* atlas, mp_rect rect); +ORCA_API oc_rect_atlas* oc_rect_atlas_create(oc_arena* arena, i32 width, i32 height); +ORCA_API oc_rect oc_rect_atlas_alloc(oc_rect_atlas* atlas, i32 width, i32 height); +ORCA_API void oc_rect_atlas_recycle(oc_rect_atlas* atlas, oc_rect rect); //NOTE: image atlas helpers -typedef struct mg_image_region +typedef struct oc_image_region { - mg_image image; - mp_rect rect; -} mg_image_region; + oc_image image; + oc_rect rect; +} oc_image_region; -MP_API mg_image_region mg_image_atlas_alloc_from_rgba8(mg_rect_atlas* atlas, mg_image backingImage, u32 width, u32 height, u8* pixels); -MP_API mg_image_region mg_image_atlas_alloc_from_data(mg_rect_atlas* atlas, mg_image backingImage, str8 data, bool flip); -MP_API mg_image_region mg_image_atlas_alloc_from_file(mg_rect_atlas* atlas, mg_image backingImage, str8 path, bool flip); -MP_API void mg_image_atlas_recycle(mg_rect_atlas* atlas, mg_image_region imageRgn); +ORCA_API oc_image_region oc_image_atlas_alloc_from_rgba8(oc_rect_atlas* atlas, oc_image backingImage, u32 width, u32 height, u8* pixels); +ORCA_API oc_image_region oc_image_atlas_alloc_from_data(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 data, bool flip); +ORCA_API oc_image_region oc_image_atlas_alloc_from_file(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 path, bool flip); +ORCA_API void oc_image_atlas_recycle(oc_rect_atlas* atlas, oc_image_region imageRgn); //------------------------------------------------------------------------------------------ //NOTE(martin): transform, viewport and clipping //------------------------------------------------------------------------------------------ -MP_API void mg_viewport(mp_rect viewPort); +ORCA_API void oc_viewport(oc_rect viewPort); -MP_API void mg_matrix_push(mg_mat2x3 matrix); -MP_API void mg_matrix_pop(void); +ORCA_API void oc_matrix_push(oc_mat2x3 matrix); +ORCA_API void oc_matrix_pop(void); -MP_API void mg_clip_push(f32 x, f32 y, f32 w, f32 h); -MP_API void mg_clip_pop(void); +ORCA_API void oc_clip_push(f32 x, f32 y, f32 w, f32 h); +ORCA_API void oc_clip_pop(void); //------------------------------------------------------------------------------------------ //NOTE(martin): graphics attributes setting/getting //------------------------------------------------------------------------------------------ -MP_API void mg_set_color(mg_color color); -MP_API void mg_set_color_rgba(f32 r, f32 g, f32 b, f32 a); -MP_API void mg_set_width(f32 width); -MP_API void mg_set_tolerance(f32 tolerance); -MP_API void mg_set_joint(mg_joint_type joint); -MP_API void mg_set_max_joint_excursion(f32 maxJointExcursion); -MP_API void mg_set_cap(mg_cap_type cap); -MP_API void mg_set_font(mg_font font); -MP_API void mg_set_font_size(f32 size); -MP_API void mg_set_text_flip(bool flip); -MP_API void mg_set_image(mg_image image); -MP_API void mg_set_image_source_region(mp_rect region); +ORCA_API void oc_set_color(oc_color color); +ORCA_API void oc_set_color_rgba(f32 r, f32 g, f32 b, f32 a); +ORCA_API void oc_set_width(f32 width); +ORCA_API void oc_set_tolerance(f32 tolerance); +ORCA_API void oc_set_joint(oc_joint_type joint); +ORCA_API void oc_set_max_joint_excursion(f32 maxJointExcursion); +ORCA_API void oc_set_cap(oc_cap_type cap); +ORCA_API void oc_set_font(oc_font font); +ORCA_API void oc_set_font_size(f32 size); +ORCA_API void oc_set_text_flip(bool flip); +ORCA_API void oc_set_image(oc_image image); +ORCA_API void oc_set_image_source_region(oc_rect region); -MP_API mg_color mg_get_color(void); -MP_API f32 mg_get_width(void); -MP_API f32 mg_get_tolerance(void); -MP_API mg_joint_type mg_get_joint(void); -MP_API f32 mg_get_max_joint_excursion(void); -MP_API mg_cap_type mg_get_cap(void); -MP_API mg_font mg_get_font(void); -MP_API f32 mg_get_font_size(void); -MP_API bool mg_get_text_flip(void); +ORCA_API oc_color oc_get_color(void); +ORCA_API f32 oc_get_width(void); +ORCA_API f32 oc_get_tolerance(void); +ORCA_API oc_joint_type oc_get_joint(void); +ORCA_API f32 oc_get_max_joint_excursion(void); +ORCA_API oc_cap_type oc_get_cap(void); +ORCA_API oc_font oc_get_font(void); +ORCA_API f32 oc_get_font_size(void); +ORCA_API bool oc_get_text_flip(void); //------------------------------------------------------------------------------------------ //NOTE(martin): path construction //------------------------------------------------------------------------------------------ -MP_API vec2 mg_get_position(void); -MP_API void mg_move_to(f32 x, f32 y); -MP_API void mg_line_to(f32 x, f32 y); -MP_API void mg_quadratic_to(f32 x1, f32 y1, f32 x2, f32 y2); -MP_API void mg_cubic_to(f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3); -MP_API void mg_close_path(void); +ORCA_API oc_vec2 oc_get_position(void); +ORCA_API void oc_move_to(f32 x, f32 y); +ORCA_API void oc_line_to(f32 x, f32 y); +ORCA_API void oc_quadratic_to(f32 x1, f32 y1, f32 x2, f32 y2); +ORCA_API void oc_cubic_to(f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3); +ORCA_API void oc_close_path(void); -MP_API mp_rect mg_glyph_outlines(str32 glyphIndices); -MP_API void mg_codepoints_outlines(str32 string); -MP_API void mg_text_outlines(str8 string); +ORCA_API oc_rect oc_glyph_outlines(oc_str32 glyphIndices); +ORCA_API void oc_codepoints_outlines(oc_str32 string); +ORCA_API void oc_text_outlines(oc_str8 string); //------------------------------------------------------------------------------------------ //NOTE(martin): clear/fill/stroke //------------------------------------------------------------------------------------------ -MP_API void mg_clear(void); -MP_API void mg_fill(void); -MP_API void mg_stroke(void); +ORCA_API void oc_clear(void); +ORCA_API void oc_fill(void); +ORCA_API void oc_stroke(void); //------------------------------------------------------------------------------------------ //NOTE(martin): 'fast' shapes primitives //------------------------------------------------------------------------------------------ -MP_API void mg_rectangle_fill(f32 x, f32 y, f32 w, f32 h); -MP_API void mg_rectangle_stroke(f32 x, f32 y, f32 w, f32 h); -MP_API void mg_rounded_rectangle_fill(f32 x, f32 y, f32 w, f32 h, f32 r); -MP_API void mg_rounded_rectangle_stroke(f32 x, f32 y, f32 w, f32 h, f32 r); -MP_API void mg_ellipse_fill(f32 x, f32 y, f32 rx, f32 ry); -MP_API void mg_ellipse_stroke(f32 x, f32 y, f32 rx, f32 ry); -MP_API void mg_circle_fill(f32 x, f32 y, f32 r); -MP_API void mg_circle_stroke(f32 x, f32 y, f32 r); -MP_API void mg_arc(f32 x, f32 y, f32 r, f32 arcAngle, f32 startAngle); +ORCA_API void oc_rectangle_fill(f32 x, f32 y, f32 w, f32 h); +ORCA_API void oc_rectangle_stroke(f32 x, f32 y, f32 w, f32 h); +ORCA_API void oc_rounded_rectangle_fill(f32 x, f32 y, f32 w, f32 h, f32 r); +ORCA_API void oc_rounded_rectangle_stroke(f32 x, f32 y, f32 w, f32 h, f32 r); +ORCA_API void oc_ellipse_fill(f32 x, f32 y, f32 rx, f32 ry); +ORCA_API void oc_ellipse_stroke(f32 x, f32 y, f32 rx, f32 ry); +ORCA_API void oc_circle_fill(f32 x, f32 y, f32 r); +ORCA_API void oc_circle_stroke(f32 x, f32 y, f32 r); +ORCA_API void oc_arc(f32 x, f32 y, f32 r, f32 arcAngle, f32 startAngle); //NOTE: image helpers -MP_API void mg_image_draw(mg_image image, mp_rect rect); -MP_API void mg_image_draw_region(mg_image image, mp_rect srcRegion, mp_rect dstRegion); +ORCA_API void oc_image_draw(oc_image image, oc_rect rect); +ORCA_API void oc_image_draw_region(oc_image image, oc_rect srcRegion, oc_rect dstRegion); #endif //__GRAPHICS_H_ diff --git a/src/graphics/graphics_common.c b/src/graphics/graphics_common.c index f4c9656..3e53dc8 100644 --- a/src/graphics/graphics_common.c +++ b/src/graphics/graphics_common.c @@ -12,7 +12,7 @@ #include"platform/platform.h" #define STB_IMAGE_IMPLEMENTATION -#if PLATFORM_ORCA +#if OC_PLATFORM_ORCA #define STBI_NO_STDIO #define STBI_NO_HDR #endif @@ -23,126 +23,127 @@ #include"platform/platform_debug.h" #include"platform/platform_debug.h" +#include"util/algebra.h" #include"graphics_common.h" -typedef struct mg_glyph_map_entry +typedef struct oc_glyph_map_entry { - unicode_range range; + oc_unicode_range range; u32 firstGlyphIndex; -} mg_glyph_map_entry; +} oc_glyph_map_entry; -typedef struct mg_glyph_data +typedef struct oc_glyph_data { bool exists; - utf32 codePoint; - mg_path_descriptor pathDescriptor; - mg_text_extents extents; + oc_utf32 codePoint; + oc_path_descriptor pathDescriptor; + oc_text_extents extents; //... -} mg_glyph_data; +} oc_glyph_data; enum { - MG_MATRIX_STACK_MAX_DEPTH = 64, - MG_CLIP_STACK_MAX_DEPTH = 64, - MG_MAX_PATH_ELEMENT_COUNT = 2<<20, - MG_MAX_PRIMITIVE_COUNT = 8<<10 + OC_MATRIX_STACK_MAX_DEPTH = 64, + OC_CLIP_STACK_MAX_DEPTH = 64, + OC_MAX_PATH_ELEMENT_COUNT = 2<<20, + OC_MAX_PRIMITIVE_COUNT = 8<<10 }; -typedef struct mg_font_data +typedef struct oc_font_data { - list_elt freeListElt; + oc_list_elt freeListElt; u32 rangeCount; u32 glyphCount; u32 outlineCount; - mg_glyph_map_entry* glyphMap; - mg_glyph_data* glyphs; - mg_path_elt* outlines; + oc_glyph_map_entry* glyphMap; + oc_glyph_data* glyphs; + oc_path_elt* outlines; f32 unitsPerEm; - mg_font_extents extents; + oc_font_extents extents; -} mg_font_data; +} oc_font_data; -typedef struct mg_canvas_data mg_canvas_data; +typedef struct oc_canvas_data oc_canvas_data; -typedef enum mg_handle_kind +typedef enum oc_graphics_handle_kind { - MG_HANDLE_NONE = 0, - MG_HANDLE_SURFACE, - MG_HANDLE_CANVAS, - MG_HANDLE_FONT, - MG_HANDLE_IMAGE, - MG_HANDLE_SURFACE_SERVER, -} mg_handle_kind; + OC_GRAPHICS_HANDLE_NONE = 0, + OC_GRAPHICS_HANDLE_SURFACE, + OC_GRAPHICS_HANDLE_CANVAS, + OC_GRAPHICS_HANDLE_FONT, + OC_GRAPHICS_HANDLE_IMAGE, + OC_GRAPHICS_HANDLE_SURFACE_SERVER, +} oc_graphics_handle_kind; -typedef struct mg_handle_slot +typedef struct oc_graphics_handle_slot { - list_elt freeListElt; + oc_list_elt freeListElt; u32 generation; - mg_handle_kind kind; + oc_graphics_handle_kind kind; void* data; -} mg_handle_slot; +} oc_graphics_handle_slot; -enum { MG_HANDLES_MAX_COUNT = 512 }; +enum { OC_GRAPHICS_HANDLES_MAX_COUNT = 512 }; -typedef struct mg_data +typedef struct oc_graphics_data { bool init; - mg_handle_slot handleArray[MG_HANDLES_MAX_COUNT]; + oc_graphics_handle_slot handleArray[OC_GRAPHICS_HANDLES_MAX_COUNT]; int handleNextIndex; - list_info handleFreeList; + oc_list handleFreeList; - mem_arena resourceArena; - list_info canvasFreeList; - list_info fontFreeList; + oc_arena resourceArena; + oc_list canvasFreeList; + oc_list fontFreeList; -} mg_data; +} oc_graphics_data; -typedef struct mg_canvas_data +typedef struct oc_canvas_data { - list_elt freeListElt; + oc_list_elt freeListElt; - mg_attributes attributes; + oc_attributes attributes; bool textFlip; - mg_path_elt pathElements[MG_MAX_PATH_ELEMENT_COUNT]; - mg_path_descriptor path; - vec2 subPathStartPoint; - vec2 subPathLastPoint; + oc_path_elt pathElements[OC_MAX_PATH_ELEMENT_COUNT]; + oc_path_descriptor path; + oc_vec2 subPathStartPoint; + oc_vec2 subPathLastPoint; - mg_mat2x3 matrixStack[MG_MATRIX_STACK_MAX_DEPTH]; + oc_mat2x3 matrixStack[OC_MATRIX_STACK_MAX_DEPTH]; u32 matrixStackSize; - mp_rect clipStack[MG_CLIP_STACK_MAX_DEPTH]; + oc_rect clipStack[OC_CLIP_STACK_MAX_DEPTH]; u32 clipStackSize; u32 primitiveCount; - mg_primitive primitives[MG_MAX_PRIMITIVE_COUNT]; + oc_primitive primitives[OC_MAX_PRIMITIVE_COUNT]; //NOTE: these are used at render time - mg_color clearColor; + oc_color clearColor; - vec4 shapeExtents; - vec4 shapeScreenExtents; + oc_vec4 shapeExtents; + oc_vec4 shapeScreenExtents; -} mg_canvas_data; +} oc_canvas_data; -static mg_data __mgData = {0}; +static oc_graphics_data oc_graphicsData = {0}; -void mg_init() +void oc_graphics_init() { - if(!__mgData.init) + if(!oc_graphicsData.init) { - __mgData.handleNextIndex = 0; - mem_arena_init(&__mgData.resourceArena); - __mgData.init = true; + oc_graphicsData.handleNextIndex = 0; + oc_arena_init(&oc_graphicsData.resourceArena); + oc_graphicsData.init = true; } } @@ -150,18 +151,18 @@ void mg_init() // handle pools procedures //------------------------------------------------------------------------ -u64 mg_handle_alloc(mg_handle_kind kind, void* data) +u64 oc_graphics_handle_alloc(oc_graphics_handle_kind kind, void* data) { - if(!__mgData.init) + if(!oc_graphicsData.init) { - mg_init(); + oc_graphics_init(); } - mg_handle_slot* slot = list_pop_entry(&__mgData.handleFreeList, mg_handle_slot, freeListElt); - if(!slot && __mgData.handleNextIndex < MG_HANDLES_MAX_COUNT) + oc_graphics_handle_slot* slot = oc_list_pop_entry(&oc_graphicsData.handleFreeList, oc_graphics_handle_slot, freeListElt); + if(!slot && oc_graphicsData.handleNextIndex < OC_GRAPHICS_HANDLES_MAX_COUNT) { - slot = &__mgData.handleArray[__mgData.handleNextIndex]; - __mgData.handleNextIndex++; + slot = &oc_graphicsData.handleArray[oc_graphicsData.handleNextIndex]; + oc_graphicsData.handleNextIndex++; slot->generation = 1; } @@ -171,43 +172,43 @@ u64 mg_handle_alloc(mg_handle_kind kind, void* data) slot->kind = kind; slot->data = data; - h = ((u64)(slot - __mgData.handleArray))<<32 + h = ((u64)(slot - oc_graphicsData.handleArray))<<32 |((u64)(slot->generation)); } return(h); } -void mg_handle_recycle(u64 h) +void oc_graphics_handle_recycle(u64 h) { - DEBUG_ASSERT(__mgData.init); + OC_DEBUG_ASSERT(oc_graphicsData.init); u32 index = h>>32; u32 generation = h & 0xffffffff; - if(index*sizeof(mg_handle_slot) < __mgData.handleNextIndex) + if(index*sizeof(oc_graphics_handle_slot) < oc_graphicsData.handleNextIndex) { - mg_handle_slot* slot = &__mgData.handleArray[index]; + oc_graphics_handle_slot* slot = &oc_graphicsData.handleArray[index]; if(slot->generation == generation) { - DEBUG_ASSERT(slot->generation != UINT32_MAX, "surface slot generation wrap around\n"); + OC_DEBUG_ASSERT(slot->generation != UINT32_MAX, "surface slot generation wrap around\n"); slot->generation++; - list_push(&__mgData.handleFreeList, &slot->freeListElt); + oc_list_push(&oc_graphicsData.handleFreeList, &slot->freeListElt); } } } -void* mg_data_from_handle(mg_handle_kind kind, u64 h) +void* oc_graphics_data_from_handle(oc_graphics_handle_kind kind, u64 h) { - DEBUG_ASSERT(__mgData.init); + OC_DEBUG_ASSERT(oc_graphicsData.init); void* data = 0; u32 index = h>>32; u32 generation = h & 0xffffffff; - if(index < __mgData.handleNextIndex) + if(index < oc_graphicsData.handleNextIndex) { - mg_handle_slot* slot = &__mgData.handleArray[index]; + oc_graphics_handle_slot* slot = &oc_graphicsData.handleArray[index]; if( slot->generation == generation && slot->kind == kind) { @@ -221,68 +222,20 @@ void* mg_data_from_handle(mg_handle_kind kind, u64 h) //NOTE(martin): graphics canvas internal //------------------------------------------------------------------------------------------ -mp_thread_local mg_canvas_data* __mgCurrentCanvas = 0; -mp_thread_local mg_canvas __mgCurrentCanvasHandle = {0}; +oc_thread_local oc_canvas_data* __mgCurrentCanvas = 0; +oc_thread_local oc_canvas __mgCurrentCanvasHandle = {0}; -//TODO put these elsewhere -bool vec2_equal(vec2 v0, vec2 v1) -{ - return(v0.x == v1.x && v0.y == v1.y); -} - -bool vec2_close(vec2 p0, vec2 p1, f32 tolerance) +bool oc_vec2_close(oc_vec2 p0, oc_vec2 p1, f32 tolerance) { f32 norm2 = (p1.x - p0.x)*(p1.x - p0.x) + (p1.y - p0.y)*(p1.y - p0.y); return(fabs(norm2) < tolerance); } -vec2 vec2_mul(f32 f, vec2 v) -{ - return((vec2){f*v.x, f*v.y}); -} - -vec2 vec2_add(vec2 v0, vec2 v1) -{ - return((vec2){v0.x + v1.x, v0.y + v1.y}); -} - -mg_mat2x3 mg_mat2x3_mul_m(mg_mat2x3 lhs, mg_mat2x3 rhs) -{ - mg_mat2x3 res; - res.m[0] = lhs.m[0]*rhs.m[0] + lhs.m[1]*rhs.m[3]; - res.m[1] = lhs.m[0]*rhs.m[1] + lhs.m[1]*rhs.m[4]; - res.m[2] = lhs.m[0]*rhs.m[2] + lhs.m[1]*rhs.m[5] + lhs.m[2]; - res.m[3] = lhs.m[3]*rhs.m[0] + lhs.m[4]*rhs.m[3]; - res.m[4] = lhs.m[3]*rhs.m[1] + lhs.m[4]*rhs.m[4]; - res.m[5] = lhs.m[3]*rhs.m[2] + lhs.m[4]*rhs.m[5] + lhs.m[5]; - - return(res); -} - -mg_mat2x3 mg_mat2x3_inv(mg_mat2x3 x) -{ - mg_mat2x3 res; - res.m[0] = x.m[4]/(x.m[0]*x.m[4] - x.m[1]*x.m[3]); - res.m[1] = x.m[1]/(x.m[1]*x.m[3] - x.m[0]*x.m[4]); - res.m[3] = x.m[3]/(x.m[1]*x.m[3] - x.m[0]*x.m[4]); - res.m[4] = x.m[0]/(x.m[0]*x.m[4] - x.m[1]*x.m[3]); - res.m[2] = -(x.m[2]*res.m[0] + x.m[5]*res.m[1]); - res.m[5] = -(x.m[2]*res.m[3] + x.m[5]*res.m[4]); - return(res); -} - -vec2 mg_mat2x3_mul(mg_mat2x3 m, vec2 p) -{ - f32 x = p.x*m.m[0] + p.y*m.m[1] + m.m[2]; - f32 y = p.x*m.m[3] + p.y*m.m[4] + m.m[5]; - return((vec2){x, y}); -} - -mg_mat2x3 mg_matrix_stack_top(mg_canvas_data* canvas) +oc_mat2x3 oc_matrix_stack_top(oc_canvas_data* canvas) { if(canvas->matrixStackSize == 0) { - return((mg_mat2x3){1, 0, 0, + return((oc_mat2x3){1, 0, 0, 0, 1, 0}); } else @@ -291,11 +244,11 @@ mg_mat2x3 mg_matrix_stack_top(mg_canvas_data* canvas) } } -void mg_matrix_stack_push(mg_canvas_data* canvas, mg_mat2x3 transform) +void oc_matrix_stack_push(oc_canvas_data* canvas, oc_mat2x3 transform) { - if(canvas->matrixStackSize >= MG_MATRIX_STACK_MAX_DEPTH) + if(canvas->matrixStackSize >= OC_MATRIX_STACK_MAX_DEPTH) { - log_error("matrix stack overflow\n"); + oc_log_error("matrix stack overflow\n"); } else { @@ -304,24 +257,24 @@ void mg_matrix_stack_push(mg_canvas_data* canvas, mg_mat2x3 transform) } } -void mg_matrix_stack_pop(mg_canvas_data* canvas) +void oc_matrix_stack_pop(oc_canvas_data* canvas) { if(canvas->matrixStackSize == 0) { - log_error("matrix stack underflow\n"); + oc_log_error("matrix stack underflow\n"); } else { canvas->matrixStackSize--; - mg_matrix_stack_top(canvas); + oc_matrix_stack_top(canvas); } } -mp_rect mg_clip_stack_top(mg_canvas_data* canvas) +oc_rect oc_clip_stack_top(oc_canvas_data* canvas) { if(canvas->clipStackSize == 0) { - return((mp_rect){-FLT_MAX/2, -FLT_MAX/2, FLT_MAX, FLT_MAX}); + return((oc_rect){-FLT_MAX/2, -FLT_MAX/2, FLT_MAX, FLT_MAX}); } else { @@ -329,11 +282,11 @@ mp_rect mg_clip_stack_top(mg_canvas_data* canvas) } } -void mg_clip_stack_push(mg_canvas_data* canvas, mp_rect clip) +void oc_clip_stack_push(oc_canvas_data* canvas, oc_rect clip) { - if(canvas->clipStackSize >= MG_CLIP_STACK_MAX_DEPTH) + if(canvas->clipStackSize >= OC_CLIP_STACK_MAX_DEPTH) { - log_error("clip stack overflow\n"); + oc_log_error("clip stack overflow\n"); } else { @@ -342,11 +295,11 @@ void mg_clip_stack_push(mg_canvas_data* canvas, mp_rect clip) } } -void mg_clip_stack_pop(mg_canvas_data* canvas) +void oc_clip_stack_pop(oc_canvas_data* canvas) { if(canvas->clipStackSize == 0) { - log_error("clip stack underflow\n"); + oc_log_error("clip stack underflow\n"); } else { @@ -354,19 +307,19 @@ void mg_clip_stack_pop(mg_canvas_data* canvas) } } -void mg_push_command(mg_canvas_data* canvas, mg_primitive primitive) +void oc_push_command(oc_canvas_data* canvas, oc_primitive primitive) { //NOTE(martin): push primitive and updates current stream, eventually patching a pending jump. - ASSERT(canvas->primitiveCount < MG_MAX_PRIMITIVE_COUNT); + OC_ASSERT(canvas->primitiveCount < OC_MAX_PRIMITIVE_COUNT); canvas->primitives[canvas->primitiveCount] = primitive; canvas->primitives[canvas->primitiveCount].attributes = canvas->attributes; - canvas->primitives[canvas->primitiveCount].attributes.transform = mg_matrix_stack_top(canvas); - canvas->primitives[canvas->primitiveCount].attributes.clip = mg_clip_stack_top(canvas); + canvas->primitives[canvas->primitiveCount].attributes.transform = oc_matrix_stack_top(canvas); + canvas->primitives[canvas->primitiveCount].attributes.clip = oc_clip_stack_top(canvas); canvas->primitiveCount++; } -void mg_new_path(mg_canvas_data* canvas) +void oc_new_path(oc_canvas_data* canvas) { canvas->path.startIndex += canvas->path.count; canvas->path.count = 0; @@ -374,59 +327,59 @@ void mg_new_path(mg_canvas_data* canvas) canvas->path.startPoint = canvas->subPathStartPoint; } -void mg_path_push_elements(mg_canvas_data* canvas, u32 count, mg_path_elt* elements) +void oc_path_push_elements(oc_canvas_data* canvas, u32 count, oc_path_elt* elements) { - ASSERT(canvas->path.count + canvas->path.startIndex + count < MG_MAX_PATH_ELEMENT_COUNT); - memcpy(canvas->pathElements + canvas->path.startIndex + canvas->path.count, elements, count*sizeof(mg_path_elt)); + OC_ASSERT(canvas->path.count + canvas->path.startIndex + count < OC_MAX_PATH_ELEMENT_COUNT); + memcpy(canvas->pathElements + canvas->path.startIndex + canvas->path.count, elements, count*sizeof(oc_path_elt)); canvas->path.count += count; - ASSERT(canvas->path.count < MG_MAX_PATH_ELEMENT_COUNT); + OC_ASSERT(canvas->path.count < OC_MAX_PATH_ELEMENT_COUNT); } -void mg_path_push_element(mg_canvas_data* canvas, mg_path_elt elt) +void oc_path_push_element(oc_canvas_data* canvas, oc_path_elt elt) { - mg_path_push_elements(canvas, 1, &elt); + oc_path_push_elements(canvas, 1, &elt); } //------------------------------------------------------------------------------------------ //NOTE(martin): fonts //------------------------------------------------------------------------------------------ -mg_font mg_font_nil() { return((mg_font){.h = 0}); } -bool mg_font_is_nil(mg_font font) { return(font.h == 0); } +oc_font oc_font_nil() { return((oc_font){.h = 0}); } +bool oc_font_is_nil(oc_font font) { return(font.h == 0); } -mg_font mg_font_handle_alloc(mg_font_data* font) +oc_font oc_font_handle_alloc(oc_font_data* font) { - mg_font handle = {.h = mg_handle_alloc(MG_HANDLE_FONT, (void*)font) }; + oc_font handle = {.h = oc_graphics_handle_alloc(OC_GRAPHICS_HANDLE_FONT, (void*)font) }; return(handle); } -mg_font_data* mg_font_data_from_handle(mg_font handle) +oc_font_data* oc_font_data_from_handle(oc_font handle) { - mg_font_data* data = mg_data_from_handle(MG_HANDLE_FONT, handle.h); + oc_font_data* data = oc_graphics_data_from_handle(OC_GRAPHICS_HANDLE_FONT, handle.h); return(data); } -mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unicode_range* ranges) +oc_font oc_font_create_from_memory(oc_str8 mem, u32 rangeCount, oc_unicode_range* ranges) { - if(!__mgData.init) + if(!oc_graphicsData.init) { - mg_init(); + oc_graphics_init(); } - mg_font fontHandle = mg_font_nil(); + oc_font fontHandle = oc_font_nil(); - mg_font_data* font = list_pop_entry(&__mgData.fontFreeList, mg_font_data, freeListElt); + oc_font_data* font = oc_list_pop_entry(&oc_graphicsData.fontFreeList, oc_font_data, freeListElt); if(!font) { - font = mem_arena_alloc_type(&__mgData.resourceArena, mg_font_data); + font = oc_arena_push_type(&oc_graphicsData.resourceArena, oc_font_data); } if(font) { - memset(font, 0, sizeof(mg_font_data)); - fontHandle = mg_font_handle_alloc(font); + memset(font, 0, sizeof(oc_font_data)); + fontHandle = oc_font_handle_alloc(font); stbtt_fontinfo stbttFontInfo; - stbtt_InitFont(&stbttFontInfo, buffer, 0); + stbtt_InitFont(&stbttFontInfo, (byte*)mem.ptr, 0); //NOTE(martin): load font metrics data font->unitsPerEm = 1./stbtt_ScaleForMappingEmToPixels(&stbttFontInfo, 1); @@ -448,7 +401,7 @@ mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unico //NOTE(martin): load codepoint ranges font->rangeCount = rangeCount; - font->glyphMap = malloc_array(mg_glyph_map_entry, rangeCount); + font->glyphMap = oc_malloc_array(oc_glyph_map_entry, rangeCount); font->glyphCount = 0; for(int i=0; iglyphCount += ranges[i].count; } - font->glyphs = malloc_array(mg_glyph_data, font->glyphCount); + font->glyphs = oc_malloc_array(oc_glyph_data, font->glyphCount); //NOTE(martin): first do a count of outlines int outlineCount = 0; for(int rangeIndex=0; rangeIndexglyphMap[rangeIndex].range.firstCodePoint; + oc_utf32 codePoint = font->glyphMap[rangeIndex].range.firstCodePoint; u32 firstGlyphIndex = font->glyphMap[rangeIndex].firstGlyphIndex; u32 endGlyphIndex = firstGlyphIndex + font->glyphMap[rangeIndex].range.count; @@ -488,20 +441,20 @@ mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unico } } //NOTE(martin): allocate outlines - font->outlines = malloc_array(mg_path_elt, outlineCount); + font->outlines = oc_malloc_array(oc_path_elt, outlineCount); font->outlineCount = 0; //NOTE(martin): load metrics and outlines for(int rangeIndex=0; rangeIndexglyphMap[rangeIndex].range.firstCodePoint; + oc_utf32 codePoint = font->glyphMap[rangeIndex].range.firstCodePoint; u32 firstGlyphIndex = font->glyphMap[rangeIndex].firstGlyphIndex; u32 endGlyphIndex = firstGlyphIndex + font->glyphMap[rangeIndex].range.count; for(int glyphIndex = firstGlyphIndex; glyphIndex < endGlyphIndex; glyphIndex++) { - mg_glyph_data* glyph = &(font->glyphs[glyphIndex-1]); + oc_glyph_data* glyph = &(font->glyphs[glyphIndex-1]); int stbttGlyphIndex = stbtt_FindGlyphIndex(&stbttFontInfo, codePoint); if(stbttGlyphIndex == 0) @@ -533,13 +486,13 @@ mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unico stbtt_vertex* vertices = 0; int vertexCount = stbtt_GetGlyphShape(&stbttFontInfo, stbttGlyphIndex, &vertices); - glyph->pathDescriptor = (mg_path_descriptor){.startIndex = font->outlineCount, + glyph->pathDescriptor = (oc_path_descriptor){.startIndex = font->outlineCount, .count = vertexCount, .startPoint = {0, 0}}; - mg_path_elt* elements = font->outlines + font->outlineCount; + oc_path_elt* elements = font->outlines + font->outlineCount; font->outlineCount += vertexCount; - vec2 currentPos = {0, 0}; + oc_vec2 currentPos = {0, 0}; for(int vertIndex = 0; vertIndex < vertexCount; vertIndex++) { @@ -553,30 +506,30 @@ mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unico switch(vertices[vertIndex].type) { case STBTT_vmove: - elements[vertIndex].type = MG_PATH_MOVE; - elements[vertIndex].p[0] = (vec2){x, y}; + elements[vertIndex].type = OC_PATH_MOVE; + elements[vertIndex].p[0] = (oc_vec2){x, y}; break; case STBTT_vline: - elements[vertIndex].type = MG_PATH_LINE; - elements[vertIndex].p[0] = (vec2){x, y}; + elements[vertIndex].type = OC_PATH_LINE; + elements[vertIndex].p[0] = (oc_vec2){x, y}; break; case STBTT_vcurve: { - elements[vertIndex].type = MG_PATH_QUADRATIC; - elements[vertIndex].p[0] = (vec2){cx, cy}; - elements[vertIndex].p[1] = (vec2){x, y}; + elements[vertIndex].type = OC_PATH_QUADRATIC; + elements[vertIndex].p[0] = (oc_vec2){cx, cy}; + elements[vertIndex].p[1] = (oc_vec2){x, y}; } break; case STBTT_vcubic: - elements[vertIndex].type = MG_PATH_CUBIC; - elements[vertIndex].p[0] = (vec2){cx, cy}; - elements[vertIndex].p[1] = (vec2){cx1, cy1}; - elements[vertIndex].p[2] = (vec2){x, y}; + elements[vertIndex].type = OC_PATH_CUBIC; + elements[vertIndex].p[0] = (oc_vec2){cx, cy}; + elements[vertIndex].p[1] = (oc_vec2){cx1, cy1}; + elements[vertIndex].p[2] = (oc_vec2){x, y}; break; } - currentPos = (vec2){x, y}; + currentPos = (oc_vec2){x, y}; } stbtt_FreeShape(&stbttFontInfo, vertices); codePoint++; @@ -586,23 +539,23 @@ mg_font mg_font_create_from_memory(u32 size, byte* buffer, u32 rangeCount, unico return(fontHandle); } -void mg_font_destroy(mg_font fontHandle) +void oc_font_destroy(oc_font fontHandle) { - mg_font_data* fontData = mg_font_data_from_handle(fontHandle); + oc_font_data* fontData = oc_font_data_from_handle(fontHandle); if(fontData) { free(fontData->glyphMap); free(fontData->glyphs); free(fontData->outlines); - list_push(&__mgData.fontFreeList, &fontData->freeListElt); - mg_handle_recycle(fontHandle.h); + oc_list_push(&oc_graphicsData.fontFreeList, &fontData->freeListElt); + oc_graphics_handle_recycle(fontHandle.h); } } -str32 mg_font_get_glyph_indices_from_font_data(mg_font_data* fontData, str32 codePoints, str32 backing) +oc_str32 oc_font_get_glyph_indices_from_font_data(oc_font_data* fontData, oc_str32 codePoints, oc_str32 backing) { - u64 count = minimum(codePoints.len, backing.len); + u64 count = oc_min(codePoints.len, backing.len); for(int i = 0; iglyphCount); + OC_DEBUG_ASSERT(glyphIndex); + OC_DEBUG_ASSERT(glyphIndex < fontData->glyphCount); return(&(fontData->glyphs[glyphIndex-1])); } -mg_font_extents mg_font_get_extents(mg_font font) +oc_font_extents oc_font_get_extents(oc_font font) { - mg_font_data* fontData = mg_font_data_from_handle(font); + oc_font_data* fontData = oc_font_data_from_handle(font); if(!fontData) { - return((mg_font_extents){0}); + return((oc_font_extents){0}); } return(fontData->extents); } -mg_font_extents mg_font_get_scaled_extents(mg_font font, f32 emSize) +oc_font_extents oc_font_get_scaled_extents(oc_font font, f32 emSize) { - mg_font_data* fontData = mg_font_data_from_handle(font); + oc_font_data* fontData = oc_font_data_from_handle(font); if(!fontData) { - return((mg_font_extents){0}); + return((oc_font_extents){0}); } f32 scale = emSize/fontData->unitsPerEm; - mg_font_extents extents = fontData->extents; + oc_font_extents extents = fontData->extents; extents.ascent *= scale; extents.descent *= scale; @@ -700,9 +653,9 @@ mg_font_extents mg_font_get_scaled_extents(mg_font font, f32 emSize) } -f32 mg_font_get_scale_for_em_pixels(mg_font font, f32 emSize) +f32 oc_font_get_scale_for_em_pixels(oc_font font, f32 emSize) { - mg_font_data* fontData = mg_font_data_from_handle(font); + oc_font_data* fontData = oc_font_data_from_handle(font); if(!fontData) { return(0); @@ -710,9 +663,9 @@ f32 mg_font_get_scale_for_em_pixels(mg_font font, f32 emSize) return(emSize/fontData->unitsPerEm); } -void mg_font_get_glyph_extents_from_font_data(mg_font_data* fontData, - str32 glyphIndices, - mg_text_extents* outExtents) +void oc_font_get_glyph_extents_from_font_data(oc_font_data* fontData, + oc_str32 glyphIndices, + oc_text_extents* outExtents) { for(int i=0; iextents; } } -int mg_font_get_glyph_extents(mg_font font, str32 glyphIndices, mg_text_extents* outExtents) +int oc_font_get_glyph_extents(oc_font font, oc_str32 glyphIndices, oc_text_extents* outExtents) { - mg_font_data* fontData = mg_font_data_from_handle(font); + oc_font_data* fontData = oc_font_data_from_handle(font); if(!fontData) { return(-1); } - mg_font_get_glyph_extents_from_font_data(fontData, glyphIndices, outExtents); + oc_font_get_glyph_extents_from_font_data(fontData, glyphIndices, outExtents); return(0); } -int mg_font_get_codepoint_extents(mg_font font, utf32 codePoint, mg_text_extents* outExtents) +int oc_font_get_codepoint_extents(oc_font font, oc_utf32 codePoint, oc_text_extents* outExtents) { - mg_font_data* fontData = mg_font_data_from_handle(font); + oc_font_data* fontData = oc_font_data_from_handle(font); if(!fontData) { return(-1); } u32 glyphIndex = 0; - str32 codePoints = {1, &codePoint}; - str32 backing = {1, &glyphIndex}; - str32 glyphs = mg_font_get_glyph_indices_from_font_data(fontData, codePoints, backing); - mg_font_get_glyph_extents_from_font_data(fontData, glyphs, outExtents); + oc_str32 codePoints = {1, &codePoint}; + oc_str32 backing = {1, &glyphIndex}; + oc_str32 glyphs = oc_font_get_glyph_indices_from_font_data(fontData, codePoints, backing); + oc_font_get_glyph_extents_from_font_data(fontData, glyphs, outExtents); return(0); } -mp_rect mg_text_bounding_box_utf32(mg_font font, f32 fontSize, str32 codePoints) +oc_rect oc_text_bounding_box_utf32(oc_font font, f32 fontSize, oc_str32 codePoints) { if(!codePoints.len || !codePoints.ptr) { - return((mp_rect){0}); + return((oc_rect){0}); } - mg_font_data* fontData = mg_font_data_from_handle(font); + oc_font_data* fontData = oc_font_data_from_handle(font); if(!fontData) { - return((mp_rect){0}); + return((oc_rect){0}); } - mem_arena* scratch = mem_scratch(); - str32 glyphIndices = mg_font_push_glyph_indices(font, scratch, codePoints); + oc_arena* scratch = oc_scratch(); + oc_str32 glyphIndices = oc_font_push_glyph_indices(font, scratch, codePoints); //NOTE(martin): find width of missing character //TODO(martin): should cache that at font creation... - mg_text_extents missingGlyphExtents; - u32 missingGlyphIndex = mg_font_get_glyph_index_from_font_data(fontData, 0xfffd); + oc_text_extents missingGlyphExtents; + u32 missingGlyphIndex = oc_font_get_glyph_index_from_font_data(fontData, 0xfffd); if(missingGlyphIndex) { - mg_font_get_glyph_extents_from_font_data(fontData, (str32){1, &missingGlyphIndex}, &missingGlyphExtents); + oc_font_get_glyph_extents_from_font_data(fontData, (oc_str32){1, &missingGlyphIndex}, &missingGlyphExtents); } else { @@ -784,10 +737,10 @@ mp_rect mg_text_bounding_box_utf32(mg_font font, f32 fontSize, str32 codePoints) f32 xBearing = fontData->extents.width * 0.1; f32 xAdvance = fontData->extents.width; - missingGlyphIndex = mg_font_get_glyph_index_from_font_data(fontData, 'x'); + missingGlyphIndex = oc_font_get_glyph_index_from_font_data(fontData, 'x'); if(missingGlyphIndex) { - mg_font_get_glyph_extents_from_font_data(fontData, (str32){1, &missingGlyphIndex}, &missingGlyphExtents); + oc_font_get_glyph_extents_from_font_data(fontData, (oc_str32){1, &missingGlyphIndex}, &missingGlyphExtents); } else { @@ -809,15 +762,15 @@ mp_rect mg_text_bounding_box_utf32(mg_font font, f32 fontSize, str32 codePoints) { //TODO(martin): make it failsafe for fonts that don't have a glyph for the line-feed codepoint ? - mg_glyph_data* glyph = 0; - mg_text_extents extents; + oc_glyph_data* glyph = 0; + oc_text_extents extents; if(!glyphIndices.ptr[i] || glyphIndices.ptr[i] >= fontData->glyphCount) { extents = missingGlyphExtents; } else { - glyph = mg_font_get_glyph_data(fontData, glyphIndices.ptr[i]); + glyph = oc_font_get_glyph_data(fontData, glyphIndices.ptr[i]); extents = glyph->extents; } x += extents.xAdvance; @@ -825,114 +778,114 @@ mp_rect mg_text_bounding_box_utf32(mg_font font, f32 fontSize, str32 codePoints) if(glyph && glyph->codePoint == '\n') { - width = maximum(width, x); + width = oc_max(width, x); x = 0; y += lineHeight + fontData->extents.leading; } } - width = maximum(width, x); + width = oc_max(width, x); - f32 fontScale = mg_font_get_scale_for_em_pixels(font, fontSize); - mp_rect rect = {0, -fontData->extents.ascent * fontScale, width * fontScale, (y + lineHeight) * fontScale }; + f32 fontScale = oc_font_get_scale_for_em_pixels(font, fontSize); + oc_rect rect = {0, -fontData->extents.ascent * fontScale, width * fontScale, (y + lineHeight) * fontScale }; return(rect); } -mp_rect mg_text_bounding_box(mg_font font, f32 fontSize, str8 text) +oc_rect oc_text_bounding_box(oc_font font, f32 fontSize, oc_str8 text) { if(!text.len || !text.ptr) { - return((mp_rect){0}); + return((oc_rect){0}); } - mem_arena* scratch = mem_scratch(); - str32 codePoints = utf8_push_to_codepoints(scratch, text); - return(mg_text_bounding_box_utf32(font, fontSize, codePoints)); + oc_arena* scratch = oc_scratch(); + oc_str32 codePoints = oc_utf8_push_to_codepoints(scratch, text); + return(oc_text_bounding_box_utf32(font, fontSize, codePoints)); } //------------------------------------------------------------------------------------------ //NOTE(martin): graphics canvas API //------------------------------------------------------------------------------------------ -mg_canvas mg_canvas_nil() { return((mg_canvas){.h = 0}); } -bool mg_canvas_is_nil(mg_canvas canvas) { return(canvas.h == 0); } +oc_canvas oc_canvas_nil() { return((oc_canvas){.h = 0}); } +bool oc_canvas_is_nil(oc_canvas canvas) { return(canvas.h == 0); } -mg_canvas mg_canvas_handle_alloc(mg_canvas_data* canvas) +oc_canvas oc_canvas_handle_alloc(oc_canvas_data* canvas) { - mg_canvas handle = {.h = mg_handle_alloc(MG_HANDLE_CANVAS, (void*)canvas) }; + oc_canvas handle = {.h = oc_graphics_handle_alloc(OC_GRAPHICS_HANDLE_CANVAS, (void*)canvas) }; return(handle); } -mg_canvas_data* mg_canvas_data_from_handle(mg_canvas handle) +oc_canvas_data* oc_canvas_data_from_handle(oc_canvas handle) { - mg_canvas_data* data = mg_data_from_handle(MG_HANDLE_CANVAS, handle.h); + oc_canvas_data* data = oc_graphics_data_from_handle(OC_GRAPHICS_HANDLE_CANVAS, handle.h); return(data); } -mg_canvas mg_canvas_create() +oc_canvas oc_canvas_create() { - if(!__mgData.init) + if(!oc_graphicsData.init) { - mg_init(); + oc_graphics_init(); } - mg_canvas canvasHandle = mg_canvas_nil(); - mg_canvas_data* canvas = list_pop_entry(&__mgData.canvasFreeList, mg_canvas_data, freeListElt); + oc_canvas canvasHandle = oc_canvas_nil(); + oc_canvas_data* canvas = oc_list_pop_entry(&oc_graphicsData.canvasFreeList, oc_canvas_data, freeListElt); if(!canvas) { - canvas = mem_arena_alloc_type(&__mgData.resourceArena, mg_canvas_data); + canvas = oc_arena_push_type(&oc_graphicsData.resourceArena, oc_canvas_data); } if(canvas) { canvas->textFlip = false; - canvas->path = (mg_path_descriptor){0}; + canvas->path = (oc_path_descriptor){0}; canvas->matrixStackSize = 0; canvas->clipStackSize = 0; canvas->primitiveCount = 0; - canvas->clearColor = (mg_color){0, 0, 0, 0}; + canvas->clearColor = (oc_color){0, 0, 0, 0}; - canvas->attributes = (mg_attributes){0}; - canvas->attributes.color = (mg_color){0, 0, 0, 1}; + canvas->attributes = (oc_attributes){0}; + canvas->attributes.color = (oc_color){0, 0, 0, 1}; canvas->attributes.tolerance = 1; canvas->attributes.width = 10; - canvas->attributes.clip = (mp_rect){-FLT_MAX/2, -FLT_MAX/2, FLT_MAX, FLT_MAX}; + canvas->attributes.clip = (oc_rect){-FLT_MAX/2, -FLT_MAX/2, FLT_MAX, FLT_MAX}; - canvasHandle = mg_canvas_handle_alloc(canvas); + canvasHandle = oc_canvas_handle_alloc(canvas); - mg_canvas_set_current(canvasHandle); + oc_canvas_set_current(canvasHandle); } return(canvasHandle); } -void mg_canvas_destroy(mg_canvas handle) +void oc_canvas_destroy(oc_canvas handle) { - mg_canvas_data* canvas = mg_canvas_data_from_handle(handle); + oc_canvas_data* canvas = oc_canvas_data_from_handle(handle); if(canvas) { if(__mgCurrentCanvas == canvas) { __mgCurrentCanvas = 0; - __mgCurrentCanvasHandle = mg_canvas_nil(); + __mgCurrentCanvasHandle = oc_canvas_nil(); } - list_push(&__mgData.canvasFreeList, &canvas->freeListElt); - mg_handle_recycle(handle.h); + oc_list_push(&oc_graphicsData.canvasFreeList, &canvas->freeListElt); + oc_graphics_handle_recycle(handle.h); } } -mg_canvas mg_canvas_set_current(mg_canvas canvas) +oc_canvas oc_canvas_set_current(oc_canvas canvas) { - mg_canvas old = __mgCurrentCanvasHandle; + oc_canvas old = __mgCurrentCanvasHandle; __mgCurrentCanvasHandle = canvas; - __mgCurrentCanvas = mg_canvas_data_from_handle(canvas); + __mgCurrentCanvas = oc_canvas_data_from_handle(canvas); return(old); } -void mg_render(mg_surface surface, mg_canvas canvas) +void oc_render(oc_surface surface, oc_canvas canvas) { - mg_canvas_data* canvasData = mg_canvas_data_from_handle(canvas); + oc_canvas_data* canvasData = oc_canvas_data_from_handle(canvas); if(canvasData) { int eltCount = canvasData->path.startIndex + canvasData->path.count; - mg_surface_render_commands(surface, + oc_surface_render_commands(surface, canvasData->clearColor, canvasData->primitiveCount, canvasData->primitives, @@ -949,182 +902,182 @@ void mg_render(mg_surface surface, mg_canvas canvas) //NOTE(martin): transform, viewport and clipping //------------------------------------------------------------------------------------------ -void mg_matrix_push(mg_mat2x3 matrix) +void oc_matrix_push(oc_mat2x3 matrix) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { - mg_mat2x3 transform = mg_matrix_stack_top(canvas); - mg_matrix_stack_push(canvas, mg_mat2x3_mul_m(transform, matrix)); + oc_mat2x3 transform = oc_matrix_stack_top(canvas); + oc_matrix_stack_push(canvas, oc_mat2x3_mul_m(transform, matrix)); } } -void mg_matrix_pop() +void oc_matrix_pop() { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { - mg_matrix_stack_pop(canvas); + oc_matrix_stack_pop(canvas); } } -void mg_clip_push(f32 x, f32 y, f32 w, f32 h) +void oc_clip_push(f32 x, f32 y, f32 w, f32 h) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { - mp_rect clip = {x, y, w, h}; + oc_rect clip = {x, y, w, h}; //NOTE(martin): transform clip - mg_mat2x3 transform = mg_matrix_stack_top(canvas); - vec2 p0 = mg_mat2x3_mul(transform, (vec2){clip.x, clip.y}); - vec2 p1 = mg_mat2x3_mul(transform, (vec2){clip.x + clip.w, clip.y}); - vec2 p2 = mg_mat2x3_mul(transform, (vec2){clip.x + clip.w, clip.y + clip.h}); - vec2 p3 = mg_mat2x3_mul(transform, (vec2){clip.x, clip.y + clip.h}); + oc_mat2x3 transform = oc_matrix_stack_top(canvas); + oc_vec2 p0 = oc_mat2x3_mul(transform, (oc_vec2){clip.x, clip.y}); + oc_vec2 p1 = oc_mat2x3_mul(transform, (oc_vec2){clip.x + clip.w, clip.y}); + oc_vec2 p2 = oc_mat2x3_mul(transform, (oc_vec2){clip.x + clip.w, clip.y + clip.h}); + oc_vec2 p3 = oc_mat2x3_mul(transform, (oc_vec2){clip.x, clip.y + clip.h}); - f32 x0 = minimum(p0.x, minimum(p1.x, minimum(p2.x, p3.x))); - f32 y0 = minimum(p0.y, minimum(p1.y, minimum(p2.y, p3.y))); - f32 x1 = maximum(p0.x, maximum(p1.x, maximum(p2.x, p3.x))); - f32 y1 = maximum(p0.y, maximum(p1.y, maximum(p2.y, p3.y))); + f32 x0 = oc_min(p0.x, oc_min(p1.x, oc_min(p2.x, p3.x))); + f32 y0 = oc_min(p0.y, oc_min(p1.y, oc_min(p2.y, p3.y))); + f32 x1 = oc_max(p0.x, oc_max(p1.x, oc_max(p2.x, p3.x))); + f32 y1 = oc_max(p0.y, oc_max(p1.y, oc_max(p2.y, p3.y))); - mp_rect current = mg_clip_stack_top(canvas); + oc_rect current = oc_clip_stack_top(canvas); //NOTE(martin): intersect with current clip - x0 = maximum(current.x, x0); - y0 = maximum(current.y, y0); - x1 = minimum(current.x + current.w, x1); - y1 = minimum(current.y + current.h, y1); + x0 = oc_max(current.x, x0); + y0 = oc_max(current.y, y0); + x1 = oc_min(current.x + current.w, x1); + y1 = oc_min(current.y + current.h, y1); - mp_rect r = {x0, y0, maximum(0, x1-x0), maximum(0, y1-y0)}; - mg_clip_stack_push(canvas, r); + oc_rect r = {x0, y0, oc_max(0, x1-x0), oc_max(0, y1-y0)}; + oc_clip_stack_push(canvas, r); canvas->attributes.clip = r; } } -void mg_clip_pop() +void oc_clip_pop() { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { - mg_clip_stack_pop(canvas); - canvas->attributes.clip = mg_clip_stack_top(canvas); + oc_clip_stack_pop(canvas); + canvas->attributes.clip = oc_clip_stack_top(canvas); } } //------------------------------------------------------------------------------------------ //NOTE(martin): graphics attributes setting/getting //------------------------------------------------------------------------------------------ -void mg_set_color(mg_color color) +void oc_set_color(oc_color color) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.color = color; } } -void mg_set_color_rgba(f32 r, f32 g, f32 b, f32 a) +void oc_set_color_rgba(f32 r, f32 g, f32 b, f32 a) { - mg_set_color((mg_color){r, g, b, a}); + oc_set_color((oc_color){r, g, b, a}); } -void mg_set_width(f32 width) +void oc_set_width(f32 width) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.width = width; } } -void mg_set_tolerance(f32 tolerance) +void oc_set_tolerance(f32 tolerance) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.tolerance = tolerance; } } -void mg_set_joint(mg_joint_type joint) +void oc_set_joint(oc_joint_type joint) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.joint = joint; } } -void mg_set_max_joint_excursion(f32 maxJointExcursion) +void oc_set_max_joint_excursion(f32 maxJointExcursion) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.maxJointExcursion = maxJointExcursion; } } -void mg_set_cap(mg_cap_type cap) +void oc_set_cap(oc_cap_type cap) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.cap = cap; } } -void mg_set_font(mg_font font) +void oc_set_font(oc_font font) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.font = font; } } -void mg_set_font_size(f32 fontSize) +void oc_set_font_size(f32 fontSize) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.fontSize = fontSize; } } -void mg_set_text_flip(bool flip) +void oc_set_text_flip(bool flip) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->textFlip = flip; } } -void mg_set_image(mg_image image) +void oc_set_image(oc_image image) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.image = image; - vec2 size = mg_image_size(image); - canvas->attributes.srcRegion = (mp_rect){0, 0, size.x, size.y}; + oc_vec2 size = oc_image_size(image); + canvas->attributes.srcRegion = (oc_rect){0, 0, size.x, size.y}; } } -void mg_set_image_source_region(mp_rect region) +void oc_set_image_source_region(oc_rect region) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->attributes.srcRegion = region; } } -mg_color mg_get_color() +oc_color oc_get_color() { - mg_color color = {0}; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_color color = {0}; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { color = canvas->attributes.color; @@ -1132,10 +1085,10 @@ mg_color mg_get_color() return(color); } -f32 mg_get_width() +f32 oc_get_width() { f32 width = 0; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { width = canvas->attributes.width; @@ -1143,10 +1096,10 @@ f32 mg_get_width() return(width); } -f32 mg_get_tolerance() +f32 oc_get_tolerance() { f32 tolerance = 0; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { tolerance = canvas->attributes.tolerance; @@ -1154,10 +1107,10 @@ f32 mg_get_tolerance() return(tolerance); } -mg_joint_type mg_get_joint() +oc_joint_type oc_get_joint() { - mg_joint_type joint = 0; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_joint_type joint = 0; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { joint = canvas->attributes.joint; @@ -1165,10 +1118,10 @@ mg_joint_type mg_get_joint() return(joint); } -f32 mg_get_max_joint_excursion() +f32 oc_get_max_joint_excursion() { f32 maxJointExcursion = 0; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { maxJointExcursion = canvas->attributes.maxJointExcursion; @@ -1176,10 +1129,10 @@ f32 mg_get_max_joint_excursion() return(maxJointExcursion); } -mg_cap_type mg_get_cap() +oc_cap_type oc_get_cap() { - mg_cap_type cap = 0; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_cap_type cap = 0; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { cap = canvas->attributes.cap; @@ -1187,10 +1140,10 @@ mg_cap_type mg_get_cap() return(cap); } -mg_font mg_get_font() +oc_font oc_get_font() { - mg_font font = mg_font_nil(); - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_font font = oc_font_nil(); + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { font = canvas->attributes.font; @@ -1198,10 +1151,10 @@ mg_font mg_get_font() return(font); } -f32 mg_get_font_size() +f32 oc_get_font_size() { f32 fontSize = 0; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { fontSize = canvas->attributes.fontSize; @@ -1209,10 +1162,10 @@ f32 mg_get_font_size() return(fontSize); } -bool mg_get_text_flip() +bool oc_get_text_flip() { bool flip = false; - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { flip = canvas->textFlip; @@ -1223,64 +1176,64 @@ bool mg_get_text_flip() //------------------------------------------------------------------------------------------ //NOTE(martin): path construction //------------------------------------------------------------------------------------------ -vec2 mg_get_position() +oc_vec2 oc_get_position() { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { - return((vec2){0, 0}); + return((oc_vec2){0, 0}); } return(canvas->subPathLastPoint); } -void mg_move_to(f32 x, f32 y) +void oc_move_to(f32 x, f32 y) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { return; } - mg_path_push_element(canvas, ((mg_path_elt){.type = MG_PATH_MOVE, .p[0] = {x, y}})); - canvas->subPathStartPoint = (vec2){x, y}; - canvas->subPathLastPoint = (vec2){x, y}; + oc_path_push_element(canvas, ((oc_path_elt){.type = OC_PATH_MOVE, .p[0] = {x, y}})); + canvas->subPathStartPoint = (oc_vec2){x, y}; + canvas->subPathLastPoint = (oc_vec2){x, y}; } -void mg_line_to(f32 x, f32 y) +void oc_line_to(f32 x, f32 y) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { return; } - mg_path_push_element(canvas, ((mg_path_elt){.type = MG_PATH_LINE, .p[0] = {x, y}})); - canvas->subPathLastPoint = (vec2){x, y}; + oc_path_push_element(canvas, ((oc_path_elt){.type = OC_PATH_LINE, .p[0] = {x, y}})); + canvas->subPathLastPoint = (oc_vec2){x, y}; } -void mg_quadratic_to(f32 x1, f32 y1, f32 x2, f32 y2) +void oc_quadratic_to(f32 x1, f32 y1, f32 x2, f32 y2) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { return; } - mg_path_push_element(canvas, ((mg_path_elt){.type = MG_PATH_QUADRATIC, .p = {{x1, y1}, {x2, y2}}})); - canvas->subPathLastPoint = (vec2){x2, y2}; + oc_path_push_element(canvas, ((oc_path_elt){.type = OC_PATH_QUADRATIC, .p = {{x1, y1}, {x2, y2}}})); + canvas->subPathLastPoint = (oc_vec2){x2, y2}; } -void mg_cubic_to(f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3) +void oc_cubic_to(f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { return; } - mg_path_push_element(canvas, ((mg_path_elt){.type = MG_PATH_CUBIC, .p = {{x1, y1}, {x2, y2}, {x3, y3}}})); - canvas->subPathLastPoint = (vec2){x3, y3}; + oc_path_push_element(canvas, ((oc_path_elt){.type = OC_PATH_CUBIC, .p = {{x1, y1}, {x2, y2}, {x3, y3}}})); + canvas->subPathLastPoint = (oc_vec2){x3, y3}; } -void mg_close_path() +void oc_close_path() { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { return; @@ -1288,14 +1241,14 @@ void mg_close_path() if( canvas->subPathStartPoint.x != canvas->subPathLastPoint.x || canvas->subPathStartPoint.y != canvas->subPathLastPoint.y) { - mg_line_to(canvas->subPathStartPoint.x, canvas->subPathStartPoint.y); + oc_line_to(canvas->subPathStartPoint.x, canvas->subPathStartPoint.y); } canvas->subPathStartPoint = canvas->subPathLastPoint; } -mp_rect mg_glyph_outlines_from_font_data(mg_font_data* fontData, str32 glyphIndices) +oc_rect oc_glyph_outlines_from_font_data(oc_font_data* fontData, oc_str32 glyphIndices) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; f32 startX = canvas->subPathLastPoint.x; f32 startY = canvas->subPathLastPoint.y; @@ -1313,9 +1266,9 @@ mp_rect mg_glyph_outlines_from_font_data(mg_font_data* fontData, str32 glyphIndi if(!glyphIndex || glyphIndex >= fontData->glyphCount) { - log_warning("code point is not present in font ranges\n"); + oc_log_warning("code point is not present in font ranges\n"); //NOTE(martin): try to find the replacement character - glyphIndex = mg_font_get_glyph_index_from_font_data(fontData, 0xfffd); + glyphIndex = oc_font_get_glyph_index_from_font_data(fontData, 0xfffd); if(!glyphIndex) { //NOTE(martin): could not find replacement glyph, try to get an 'x' to get a somewhat correct width @@ -1324,34 +1277,34 @@ mp_rect mg_glyph_outlines_from_font_data(mg_font_data* fontData, str32 glyphIndi f32 xBearing = fontData->extents.width * 0.1; f32 xAdvance = fontData->extents.width; - glyphIndex = mg_font_get_glyph_index_from_font_data(fontData, 'x'); + glyphIndex = oc_font_get_glyph_index_from_font_data(fontData, 'x'); if(glyphIndex) { - mg_glyph_data* glyph = &(fontData->glyphs[glyphIndex]); + oc_glyph_data* glyph = &(fontData->glyphs[glyphIndex]); boxWidth = glyph->extents.width; xBearing = glyph->extents.xBearing; xAdvance = glyph->extents.xAdvance; } f32 oldStrokeWidth = canvas->attributes.width; - mg_set_width(boxWidth*0.005); - mg_rectangle_stroke(xOffset + xBearing * scale, + oc_set_width(boxWidth*0.005); + oc_rectangle_stroke(xOffset + xBearing * scale, yOffset, boxWidth * scale * flip, fontData->extents.capHeight*scale); - mg_set_width(oldStrokeWidth); - mg_move_to(xOffset + xAdvance * scale, yOffset); - maxWidth = maximum(maxWidth, xOffset + xAdvance*scale - startX); + oc_set_width(oldStrokeWidth); + oc_move_to(xOffset + xAdvance * scale, yOffset); + maxWidth = oc_max(maxWidth, xOffset + xAdvance*scale - startX); continue; } } - mg_glyph_data* glyph = mg_font_get_glyph_data(fontData, glyphIndex); + oc_glyph_data* glyph = oc_font_get_glyph_data(fontData, glyphIndex); - mg_path_push_elements(canvas, glyph->pathDescriptor.count, fontData->outlines + glyph->pathDescriptor.startIndex); + oc_path_push_elements(canvas, glyph->pathDescriptor.count, fontData->outlines + glyph->pathDescriptor.startIndex); - mg_path_elt* elements = canvas->pathElements + canvas->path.count + canvas->path.startIndex - glyph->pathDescriptor.count; + oc_path_elt* elements = canvas->pathElements + canvas->path.count + canvas->path.startIndex - glyph->pathDescriptor.count; for(int eltIndex=0; eltIndexpathDescriptor.count; eltIndex++) { for(int pIndex = 0; pIndex < 3; pIndex++) @@ -1360,74 +1313,74 @@ mp_rect mg_glyph_outlines_from_font_data(mg_font_data* fontData, str32 glyphIndi elements[eltIndex].p[pIndex].y = elements[eltIndex].p[pIndex].y * scale * flip + yOffset; } } - mg_move_to(xOffset + scale*glyph->extents.xAdvance, yOffset); + oc_move_to(xOffset + scale*glyph->extents.xAdvance, yOffset); - maxWidth = maximum(maxWidth, xOffset + scale*glyph->extents.xAdvance - startX); + maxWidth = oc_max(maxWidth, xOffset + scale*glyph->extents.xAdvance - startX); } f32 lineHeight = (fontData->extents.ascent + fontData->extents.descent)*scale; - mp_rect box = {startX, startY, maxWidth, canvas->subPathLastPoint.y - startY + lineHeight }; + oc_rect box = {startX, startY, maxWidth, canvas->subPathLastPoint.y - startY + lineHeight }; return(box); } -mp_rect mg_glyph_outlines(str32 glyphIndices) +oc_rect oc_glyph_outlines(oc_str32 glyphIndices) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { - return((mp_rect){0}); + return((oc_rect){0}); } - mg_font_data* fontData = mg_font_data_from_handle(canvas->attributes.font); + oc_font_data* fontData = oc_font_data_from_handle(canvas->attributes.font); if(!fontData) { - return((mp_rect){0}); + return((oc_rect){0}); } - return(mg_glyph_outlines_from_font_data(fontData, glyphIndices)); + return(oc_glyph_outlines_from_font_data(fontData, glyphIndices)); } -void mg_codepoints_outlines(str32 codePoints) +void oc_codepoints_outlines(oc_str32 codePoints) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { return; } - mg_font_data* fontData = mg_font_data_from_handle(canvas->attributes.font); + oc_font_data* fontData = oc_font_data_from_handle(canvas->attributes.font); if(!fontData) { return; } - str32 glyphIndices = mg_font_push_glyph_indices(canvas->attributes.font, mem_scratch(), codePoints); - mg_glyph_outlines_from_font_data(fontData, glyphIndices); + oc_str32 glyphIndices = oc_font_push_glyph_indices(canvas->attributes.font, oc_scratch(), codePoints); + oc_glyph_outlines_from_font_data(fontData, glyphIndices); } -void mg_text_outlines(str8 text) +void oc_text_outlines(oc_str8 text) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(!canvas) { return; } - mg_font_data* fontData = mg_font_data_from_handle(canvas->attributes.font); + oc_font_data* fontData = oc_font_data_from_handle(canvas->attributes.font); if(!fontData) { return; } - mem_arena* scratch = mem_scratch(); - str32 codePoints = utf8_push_to_codepoints(scratch, text); - str32 glyphIndices = mg_font_push_glyph_indices(canvas->attributes.font, scratch, codePoints); + oc_arena* scratch = oc_scratch(); + oc_str32 codePoints = oc_utf8_push_to_codepoints(scratch, text); + oc_str32 glyphIndices = oc_font_push_glyph_indices(canvas->attributes.font, scratch, codePoints); - mg_glyph_outlines_from_font_data(fontData, glyphIndices); + oc_glyph_outlines_from_font_data(fontData, glyphIndices); } //------------------------------------------------------------------------------------------ //NOTE(martin): clear/fill/stroke //------------------------------------------------------------------------------------------ -void mg_clear() +void oc_clear() { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { canvas->primitiveCount = 0; @@ -1435,23 +1388,23 @@ void mg_clear() } } -void mg_fill() +void oc_fill() { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas && canvas->path.count) { - mg_push_command(canvas, (mg_primitive){.cmd = MG_CMD_FILL, .path = canvas->path}); - mg_new_path(canvas); + oc_push_command(canvas, (oc_primitive){.cmd = OC_CMD_FILL, .path = canvas->path}); + oc_new_path(canvas); } } -void mg_stroke() +void oc_stroke() { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas && canvas->path.count) { - mg_push_command(canvas, (mg_primitive){.cmd = MG_CMD_STROKE, .path = canvas->path}); - mg_new_path(canvas); + oc_push_command(canvas, (oc_primitive){.cmd = OC_CMD_STROKE, .path = canvas->path}); + oc_new_path(canvas); } } @@ -1459,120 +1412,120 @@ void mg_stroke() //NOTE(martin): simple shape helpers //------------------------------------------------------------------------------------------ -void mg_rectangle_path(f32 x, f32 y, f32 w, f32 h) +void oc_rectangle_path(f32 x, f32 y, f32 w, f32 h) { - mg_move_to(x, y); - mg_line_to(x+w, y); - mg_line_to(x+w, y+h); - mg_line_to(x, y+h); - mg_close_path(); + oc_move_to(x, y); + oc_line_to(x+w, y); + oc_line_to(x+w, y+h); + oc_line_to(x, y+h); + oc_close_path(); } -void mg_rectangle_fill(f32 x, f32 y, f32 w, f32 h) +void oc_rectangle_fill(f32 x, f32 y, f32 w, f32 h) { - mg_rectangle_path(x, y, w, h); - mg_fill(); + oc_rectangle_path(x, y, w, h); + oc_fill(); } -void mg_rectangle_stroke(f32 x, f32 y, f32 w, f32 h) +void oc_rectangle_stroke(f32 x, f32 y, f32 w, f32 h) { - mg_rectangle_path(x, y, w, h); - mg_stroke(); + oc_rectangle_path(x, y, w, h); + oc_stroke(); } -void mg_rounded_rectangle_path(f32 x, f32 y, f32 w, f32 h, f32 r) +void oc_rounded_rectangle_path(f32 x, f32 y, f32 w, f32 h, f32 r) { f32 c = r*4*(sqrt(2)-1)/3; - mg_move_to(x+r, y); - mg_line_to(x+w-r, y); - mg_cubic_to(x+w-r+c, y, x+w, y+r-c, x+w, y+r); - mg_line_to(x+w, y+h-r); - mg_cubic_to(x+w, y+h-r+c, x+w-r+c, y+h, x+w-r, y+h); - mg_line_to(x+r, y+h); - mg_cubic_to(x+r-c, y+h, x, y+h-r+c, x, y+h-r); - mg_line_to(x, y+r); - mg_cubic_to(x, y+r-c, x+r-c, y, x+r, y); + oc_move_to(x+r, y); + oc_line_to(x+w-r, y); + oc_cubic_to(x+w-r+c, y, x+w, y+r-c, x+w, y+r); + oc_line_to(x+w, y+h-r); + oc_cubic_to(x+w, y+h-r+c, x+w-r+c, y+h, x+w-r, y+h); + oc_line_to(x+r, y+h); + oc_cubic_to(x+r-c, y+h, x, y+h-r+c, x, y+h-r); + oc_line_to(x, y+r); + oc_cubic_to(x, y+r-c, x+r-c, y, x+r, y); } -void mg_rounded_rectangle_fill(f32 x, f32 y, f32 w, f32 h, f32 r) +void oc_rounded_rectangle_fill(f32 x, f32 y, f32 w, f32 h, f32 r) { - mg_rounded_rectangle_path(x, y, w, h, r); - mg_fill(); + oc_rounded_rectangle_path(x, y, w, h, r); + oc_fill(); } -void mg_rounded_rectangle_stroke(f32 x, f32 y, f32 w, f32 h, f32 r) +void oc_rounded_rectangle_stroke(f32 x, f32 y, f32 w, f32 h, f32 r) { - mg_rounded_rectangle_path(x, y, w, h, r); - mg_stroke(); + oc_rounded_rectangle_path(x, y, w, h, r); + oc_stroke(); } -void mg_ellipse_path(f32 x, f32 y, f32 rx, f32 ry) +void oc_ellipse_path(f32 x, f32 y, f32 rx, f32 ry) { f32 cx = rx*4*(sqrt(2)-1)/3; f32 cy = ry*4*(sqrt(2)-1)/3; - mg_move_to(x-rx, y); - mg_cubic_to(x-rx, y+cy, x-cx, y+ry, x, y+ry); - mg_cubic_to(x+cx, y+ry, x+rx, y+cy, x+rx, y); - mg_cubic_to(x+rx, y-cy, x+cx, y-ry, x, y-ry); - mg_cubic_to(x-cx, y-ry, x-rx, y-cy, x-rx, y); + oc_move_to(x-rx, y); + oc_cubic_to(x-rx, y+cy, x-cx, y+ry, x, y+ry); + oc_cubic_to(x+cx, y+ry, x+rx, y+cy, x+rx, y); + oc_cubic_to(x+rx, y-cy, x+cx, y-ry, x, y-ry); + oc_cubic_to(x-cx, y-ry, x-rx, y-cy, x-rx, y); } -void mg_ellipse_fill(f32 x, f32 y, f32 rx, f32 ry) +void oc_ellipse_fill(f32 x, f32 y, f32 rx, f32 ry) { - mg_ellipse_path(x, y, rx, ry); - mg_fill(); + oc_ellipse_path(x, y, rx, ry); + oc_fill(); } -void mg_ellipse_stroke(f32 x, f32 y, f32 rx, f32 ry) +void oc_ellipse_stroke(f32 x, f32 y, f32 rx, f32 ry) { - mg_ellipse_path(x, y, rx, ry); - mg_stroke(); + oc_ellipse_path(x, y, rx, ry); + oc_stroke(); } -void mg_circle_fill(f32 x, f32 y, f32 r) +void oc_circle_fill(f32 x, f32 y, f32 r) { - mg_ellipse_fill(x, y, r, r); + oc_ellipse_fill(x, y, r, r); } -void mg_circle_stroke(f32 x, f32 y, f32 r) +void oc_circle_stroke(f32 x, f32 y, f32 r) { - mg_ellipse_stroke(x, y, r, r); + oc_ellipse_stroke(x, y, r, r); } //TODO: change to arc_to? -void mg_arc(f32 x, f32 y, f32 r, f32 arcAngle, f32 startAngle) +void oc_arc(f32 x, f32 y, f32 r, f32 arcAngle, f32 startAngle) { f32 endAngle = startAngle + arcAngle; while(startAngle < endAngle) { - f32 smallAngle = minimum(endAngle - startAngle, M_PI/4.); + f32 smallAngle = oc_min(endAngle - startAngle, M_PI/4.); if(smallAngle < 0.001) { break; } - vec2 v0 = {cos(smallAngle/2), sin(smallAngle/2)}; - vec2 v1 = {(4-v0.x)/3, (1-v0.x)*(3-v0.x)/(3*v0.y)}; - vec2 v2 = {v1.x, -v1.y}; - vec2 v3 = {v0.x, -v0.y}; + oc_vec2 v0 = {cos(smallAngle/2), sin(smallAngle/2)}; + oc_vec2 v1 = {(4-v0.x)/3, (1-v0.x)*(3-v0.x)/(3*v0.y)}; + oc_vec2 v2 = {v1.x, -v1.y}; + oc_vec2 v3 = {v0.x, -v0.y}; f32 rotAngle = smallAngle/2 + startAngle; f32 rotCos = cos(rotAngle); f32 rotSin = sin(rotAngle); - mg_mat2x3 t = {r*rotCos, -r*rotSin, x, + oc_mat2x3 t = {r*rotCos, -r*rotSin, x, r*rotSin, r*rotCos, y}; - v0 = mg_mat2x3_mul(t, v0); - v1 = mg_mat2x3_mul(t, v1); - v2 = mg_mat2x3_mul(t, v2); - v3 = mg_mat2x3_mul(t, v3); + v0 = oc_mat2x3_mul(t, v0); + v1 = oc_mat2x3_mul(t, v1); + v2 = oc_mat2x3_mul(t, v2); + v3 = oc_mat2x3_mul(t, v3); - mg_move_to(v0.x, v0.y); - mg_cubic_to(v1.x, v1.y, v2.x, v2.y, v3.x, v3.y); + oc_move_to(v0.x, v0.y); + oc_cubic_to(v1.x, v1.y, v2.x, v2.y, v3.x, v3.y); startAngle += smallAngle; } @@ -1582,85 +1535,85 @@ void mg_arc(f32 x, f32 y, f32 r, f32 arcAngle, f32 startAngle) //NOTE(martin): images //------------------------------------------------------------------------------------------ -mg_image mg_image_nil() { return((mg_image){.h = 0}); } -bool mg_image_is_nil(mg_image image) { return(image.h == 0); } +oc_image oc_image_nil() { return((oc_image){.h = 0}); } +bool oc_image_is_nil(oc_image image) { return(image.h == 0); } -mg_image mg_image_create_from_rgba8(mg_surface surface, u32 width, u32 height, u8* pixels) +oc_image oc_image_create_from_rgba8(oc_surface surface, u32 width, u32 height, u8* pixels) { - mg_image image = mg_image_create(surface, width, height); - if(!mg_image_is_nil(image)) + oc_image image = oc_image_create(surface, width, height); + if(!oc_image_is_nil(image)) { - mg_image_upload_region_rgba8(image, (mp_rect){0, 0, width, height}, pixels); + oc_image_upload_region_rgba8(image, (oc_rect){0, 0, width, height}, pixels); } return(image); } -mg_image mg_image_create_from_data(mg_surface surface, str8 data, bool flip) +oc_image oc_image_create_from_memory(oc_surface surface, oc_str8 mem, bool flip) { - mg_image image = mg_image_nil(); + oc_image image = oc_image_nil(); int width, height, channels; stbi_set_flip_vertically_on_load(flip ? 1 : 0); - u8* pixels = stbi_load_from_memory((u8*)data.ptr, data.len, &width, &height, &channels, 4); + u8* pixels = stbi_load_from_memory((u8*)mem.ptr, mem.len, &width, &height, &channels, 4); if(pixels) { - image = mg_image_create_from_rgba8(surface, width, height, pixels); + image = oc_image_create_from_rgba8(surface, width, height, pixels); free(pixels); } else { - log_error("stbi_load_from_memory() failed: %s\n", stbi_failure_reason()); + oc_log_error("stbi_load_from_memory() failed: %s\n", stbi_failure_reason()); } return(image); } -#if !PLATFORM_ORCA +#if !OC_PLATFORM_ORCA -mg_image mg_image_create_from_file(mg_surface surface, str8 path, bool flip) +oc_image oc_image_create_from_file(oc_surface surface, oc_str8 path, bool flip) { - mg_image image = mg_image_nil(); + oc_image image = oc_image_nil(); int width, height, channels; - const char* cpath = str8_to_cstring(mem_scratch(), path); + const char* cpath = oc_str8_to_cstring(oc_scratch(), path); stbi_set_flip_vertically_on_load(flip ? 1 : 0); u8* pixels = stbi_load(cpath, &width, &height, &channels, 4); if(pixels) { - image = mg_image_create_from_rgba8(surface, width, height, pixels); + image = oc_image_create_from_rgba8(surface, width, height, pixels); free(pixels); } else { - log_error("stbi_load() failed: %s\n", stbi_failure_reason()); + oc_log_error("stbi_load() failed: %s\n", stbi_failure_reason()); } return(image); } -#endif // !PLATFORM_ORCA +#endif // !OC_PLATFORM_ORCA -void mg_image_draw_region(mg_image image, mp_rect srcRegion, mp_rect dstRegion) +void oc_image_draw_region(oc_image image, oc_rect srcRegion, oc_rect dstRegion) { - mg_canvas_data* canvas = __mgCurrentCanvas; + oc_canvas_data* canvas = __mgCurrentCanvas; if(canvas) { - mg_image oldImage = canvas->attributes.image; - mp_rect oldSrcRegion = canvas->attributes.srcRegion; - mg_color oldColor = canvas->attributes.color; + oc_image oldImage = canvas->attributes.image; + oc_rect oldSrcRegion = canvas->attributes.srcRegion; + oc_color oldColor = canvas->attributes.color; canvas->attributes.image = image; canvas->attributes.srcRegion = srcRegion; - canvas->attributes.color = (mg_color){1, 1, 1, 1}; + canvas->attributes.color = (oc_color){1, 1, 1, 1}; - mg_move_to(dstRegion.x, dstRegion.y); - mg_line_to(dstRegion.x+dstRegion.w, dstRegion.y); - mg_line_to(dstRegion.x+dstRegion.w, dstRegion.y+dstRegion.h); - mg_line_to(dstRegion.x, dstRegion.y+dstRegion.h); - mg_close_path(); + oc_move_to(dstRegion.x, dstRegion.y); + oc_line_to(dstRegion.x+dstRegion.w, dstRegion.y); + oc_line_to(dstRegion.x+dstRegion.w, dstRegion.y+dstRegion.h); + oc_line_to(dstRegion.x, dstRegion.y+dstRegion.h); + oc_close_path(); - mg_fill(); + oc_fill(); canvas->attributes.image = oldImage; canvas->attributes.srcRegion = oldSrcRegion; @@ -1668,10 +1621,10 @@ void mg_image_draw_region(mg_image image, mp_rect srcRegion, mp_rect dstRegion) } } -void mg_image_draw(mg_image image, mp_rect rect) +void oc_image_draw(oc_image image, oc_rect rect) { - vec2 size = mg_image_size(image); - mg_image_draw_region(image, (mp_rect){0, 0, size.x, size.y}, rect); + oc_vec2 size = oc_image_size(image); + oc_image_draw_region(image, (oc_rect){0, 0, size.x, size.y}, rect); } //------------------------------------------------------------------------------------------ @@ -1679,27 +1632,27 @@ void mg_image_draw(mg_image image, mp_rect rect) //------------------------------------------------------------------------------------------ //NOTE: rectangle allocator -typedef struct mg_rect_atlas +typedef struct oc_rect_atlas { - mem_arena* arena; - ivec2 size; - ivec2 pos; + oc_arena* arena; + oc_vec2i size; + oc_vec2i pos; u32 lineHeight; -} mg_rect_atlas; +} oc_rect_atlas; -mg_rect_atlas* mg_rect_atlas_create(mem_arena* arena, i32 width, i32 height) +oc_rect_atlas* oc_rect_atlas_create(oc_arena* arena, i32 width, i32 height) { - mg_rect_atlas* atlas = mem_arena_alloc_type(arena, mg_rect_atlas); - memset(atlas, 0, sizeof(mg_rect_atlas)); + oc_rect_atlas* atlas = oc_arena_push_type(arena, oc_rect_atlas); + memset(atlas, 0, sizeof(oc_rect_atlas)); atlas->arena = arena; - atlas->size = (ivec2){width, height}; + atlas->size = (oc_vec2i){width, height}; return(atlas); } -mp_rect mg_rect_atlas_alloc(mg_rect_atlas* atlas, i32 width, i32 height) +oc_rect oc_rect_atlas_alloc(oc_rect_atlas* atlas, i32 width, i32 height) { - mp_rect rect = {0, 0, 0, 0}; + oc_rect rect = {0, 0, 0, 0}; if(width > 0 && height > 0) { if(atlas->pos.x + width >= atlas->size.x) @@ -1711,39 +1664,39 @@ mp_rect mg_rect_atlas_alloc(mg_rect_atlas* atlas, i32 width, i32 height) if( atlas->pos.x + width < atlas->size.x && atlas->pos.y + height < atlas->size.y) { - rect = (mp_rect){atlas->pos.x, atlas->pos.y, width, height}; + rect = (oc_rect){atlas->pos.x, atlas->pos.y, width, height}; atlas->pos.x += (width + 1); - atlas->lineHeight = maximum(atlas->lineHeight, height); + atlas->lineHeight = oc_max(atlas->lineHeight, height); } } return(rect); } -void mg_rect_atlas_recycle(mg_rect_atlas* atlas, mp_rect rect) +void oc_rect_atlas_recycle(oc_rect_atlas* atlas, oc_rect rect) { //TODO } -mg_image_region mg_image_atlas_alloc_from_rgba8(mg_rect_atlas* atlas, mg_image backingImage, u32 width, u32 height, u8* pixels) +oc_image_region oc_image_atlas_alloc_from_rgba8(oc_rect_atlas* atlas, oc_image backingImage, u32 width, u32 height, u8* pixels) { - mg_image_region imageRgn = {0}; + oc_image_region imageRgn = {0}; - mp_rect rect = mg_rect_atlas_alloc(atlas, width, height); + oc_rect rect = oc_rect_atlas_alloc(atlas, width, height); if(rect.w == width && rect.h == height) { - mg_image_upload_region_rgba8(backingImage, rect, pixels); + oc_image_upload_region_rgba8(backingImage, rect, pixels); imageRgn.rect = rect; imageRgn.image = backingImage; } return(imageRgn); } -#if !PLATFORM_ORCA +#if !OC_PLATFORM_ORCA -mg_image_region mg_image_atlas_alloc_from_data(mg_rect_atlas* atlas, mg_image backingImage, str8 data, bool flip) +oc_image_region oc_image_atlas_alloc_from_data(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 data, bool flip) { - mg_image_region imageRgn = {0}; + oc_image_region imageRgn = {0}; stbi_set_flip_vertically_on_load(flip ? 1 : 0); @@ -1751,31 +1704,31 @@ mg_image_region mg_image_atlas_alloc_from_data(mg_rect_atlas* atlas, mg_image ba u8* pixels = stbi_load_from_memory((u8*)data.ptr, data.len, &width, &height, &channels, 4); if(pixels) { - imageRgn = mg_image_atlas_alloc_from_rgba8(atlas, backingImage, width, height, pixels); + imageRgn = oc_image_atlas_alloc_from_rgba8(atlas, backingImage, width, height, pixels); free(pixels); } return(imageRgn); } -mg_image_region mg_image_atlas_alloc_from_file(mg_rect_atlas* atlas, mg_image backingImage, str8 path, bool flip) +oc_image_region oc_image_atlas_alloc_from_file(oc_rect_atlas* atlas, oc_image backingImage, oc_str8 path, bool flip) { - mg_image_region imageRgn = {0}; + oc_image_region imageRgn = {0}; stbi_set_flip_vertically_on_load(flip ? 1 : 0); - const char* cpath = str8_to_cstring(mem_scratch(), path); + const char* cpath = oc_str8_to_cstring(oc_scratch(), path); int width, height, channels; u8* pixels = stbi_load(cpath, &width, &height, &channels, 4); if(pixels) { - imageRgn = mg_image_atlas_alloc_from_rgba8(atlas, backingImage, width, height, pixels); + imageRgn = oc_image_atlas_alloc_from_rgba8(atlas, backingImage, width, height, pixels); free(pixels); } return(imageRgn); } -#endif // !PLATFORM_ORCA +#endif // !OC_PLATFORM_ORCA -void mg_image_atlas_recycle(mg_rect_atlas* atlas, mg_image_region imageRgn) +void oc_image_atlas_recycle(oc_rect_atlas* atlas, oc_image_region imageRgn) { - mg_rect_atlas_recycle(atlas, imageRgn.rect); + oc_rect_atlas_recycle(atlas, imageRgn.rect); } diff --git a/src/graphics/graphics_common.h b/src/graphics/graphics_common.h index a29e44b..6e805e3 100644 --- a/src/graphics/graphics_common.h +++ b/src/graphics/graphics_common.h @@ -13,70 +13,70 @@ //------------------------------------------------------------------------ // canvas structs //------------------------------------------------------------------------ -typedef enum { MG_PATH_MOVE, - MG_PATH_LINE, - MG_PATH_QUADRATIC, - MG_PATH_CUBIC } mg_path_elt_type; +typedef enum { OC_PATH_MOVE, + OC_PATH_LINE, + OC_PATH_QUADRATIC, + OC_PATH_CUBIC } oc_path_elt_type; -typedef struct mg_path_elt +typedef struct oc_path_elt { - mg_path_elt_type type; - vec2 p[3]; + oc_path_elt_type type; + oc_vec2 p[3]; -} mg_path_elt; +} oc_path_elt; -typedef struct mg_path_descriptor +typedef struct oc_path_descriptor { u32 startIndex; u32 count; - vec2 startPoint; + oc_vec2 startPoint; -} mg_path_descriptor; +} oc_path_descriptor; -typedef struct mg_attributes +typedef struct oc_attributes { f32 width; f32 tolerance; - mg_color color; - mg_joint_type joint; + oc_color color; + oc_joint_type joint; f32 maxJointExcursion; - mg_cap_type cap; + oc_cap_type cap; - mg_font font; + oc_font font; f32 fontSize; - mg_image image; - mp_rect srcRegion; + oc_image image; + oc_rect srcRegion; - mg_mat2x3 transform; - mp_rect clip; + oc_mat2x3 transform; + oc_rect clip; -} mg_attributes; +} oc_attributes; -typedef enum { MG_CMD_FILL, - MG_CMD_STROKE, - MG_CMD_JUMP - } mg_primitive_cmd; +typedef enum { OC_CMD_FILL, + OC_CMD_STROKE, + OC_CMD_JUMP + } oc_primitive_cmd; -typedef struct mg_primitive +typedef struct oc_primitive { - mg_primitive_cmd cmd; - mg_attributes attributes; + oc_primitive_cmd cmd; + oc_attributes attributes; union { - mg_path_descriptor path; - mp_rect rect; + oc_path_descriptor path; + oc_rect rect; u32 jump; }; -} mg_primitive; +} oc_primitive; -MP_API void mg_surface_render_commands(mg_surface surface, - mg_color clearColor, +ORCA_API void oc_surface_render_commands(oc_surface surface, + oc_color clearColor, u32 primitiveCount, - mg_primitive* primitives, + oc_primitive* primitives, u32 eltCount, - mg_path_elt* elements); + oc_path_elt* elements); #endif //__GRAPHICS_COMMON_H_ diff --git a/src/graphics/graphics_surface.c b/src/graphics/graphics_surface.c index dd120f0..7f32327 100644 --- a/src/graphics/graphics_surface.c +++ b/src/graphics/graphics_surface.c @@ -12,33 +12,33 @@ // per-thread selected surface //--------------------------------------------------------------- -mp_thread_local mg_surface __mgSelectedSurface = {0}; +oc_thread_local oc_surface oc_selectedSurface = {0}; //--------------------------------------------------------------- // typed handles functions //--------------------------------------------------------------- -mg_surface mg_surface_handle_alloc(mg_surface_data* surface) +oc_surface oc_surface_handle_alloc(oc_surface_data* surface) { - mg_surface handle = {.h = mg_handle_alloc(MG_HANDLE_SURFACE, (void*)surface) }; + oc_surface handle = {.h = oc_graphics_handle_alloc(OC_GRAPHICS_HANDLE_SURFACE, (void*)surface) }; return(handle); } -mg_surface_data* mg_surface_data_from_handle(mg_surface handle) +oc_surface_data* oc_surface_data_from_handle(oc_surface handle) { - mg_surface_data* data = mg_data_from_handle(MG_HANDLE_SURFACE, handle.h); + oc_surface_data* data = oc_graphics_data_from_handle(OC_GRAPHICS_HANDLE_SURFACE, handle.h); return(data); } -mg_image mg_image_handle_alloc(mg_image_data* image) +oc_image oc_image_handle_alloc(oc_image_data* image) { - mg_image handle = {.h = mg_handle_alloc(MG_HANDLE_IMAGE, (void*)image) }; + oc_image handle = {.h = oc_graphics_handle_alloc(OC_GRAPHICS_HANDLE_IMAGE, (void*)image) }; return(handle); } -mg_image_data* mg_image_data_from_handle(mg_image handle) +oc_image_data* oc_image_data_from_handle(oc_image handle) { - mg_image_data* data = mg_data_from_handle(MG_HANDLE_IMAGE, handle.h); + oc_image_data* data = oc_graphics_data_from_handle(OC_GRAPHICS_HANDLE_IMAGE, handle.h); return(data); } @@ -46,48 +46,48 @@ mg_image_data* mg_image_data_from_handle(mg_image handle) // surface API //--------------------------------------------------------------- -#if MG_COMPILE_GL - #if PLATFORM_WINDOWS +#if OC_COMPILE_GL + #if OC_PLATFORM_WINDOWS #include"wgl_surface.h" - #define gl_surface_create_for_window mg_wgl_surface_create_for_window + #define oc_gl_surface_create_for_window oc_wgl_surface_create_for_window #endif #endif -#if MG_COMPILE_GLES +#if OC_COMPILE_GLES #include"egl_surface.h" #endif -#if MG_COMPILE_METAL +#if OC_COMPILE_METAL #include"mtl_surface.h" #endif -#if MG_COMPILE_CANVAS - #if PLATFORM_MACOS - mg_surface_data* mtl_canvas_surface_create_for_window(mp_window window); - #elif PLATFORM_WINDOWS - mg_surface_data* gl_canvas_surface_create_for_window(mp_window window); +#if OC_COMPILE_CANVAS + #if OC_PLATFORM_MACOS + oc_surface_data* oc_mtl_canvas_surface_create_for_window(oc_window window); + #elif OC_PLATFORM_WINDOWS + oc_surface_data* oc_gl_canvas_surface_create_for_window(oc_window window); #endif #endif -bool mg_is_surface_backend_available(mg_surface_api api) +bool oc_is_surface_backend_available(oc_surface_api api) { bool result = false; switch(api) { - #if MG_COMPILE_METAL - case MG_METAL: + #if OC_COMPILE_METAL + case OC_METAL: #endif - #if MG_COMPILE_GL - case MG_GL: + #if OC_COMPILE_GL + case OC_GL: #endif - #if MG_COMPILE_GLES - case MG_GLES: + #if OC_COMPILE_GLES + case OC_GLES: #endif - #if MG_COMPILE_CANVAS - case MG_CANVAS: + #if OC_COMPILE_CANVAS + case OC_CANVAS: #endif result = true; break; @@ -98,45 +98,45 @@ bool mg_is_surface_backend_available(mg_surface_api api) return(result); } -mg_surface mg_surface_nil() { return((mg_surface){.h = 0}); } -bool mg_surface_is_nil(mg_surface surface) { return(surface.h == 0); } +oc_surface oc_surface_nil() { return((oc_surface){.h = 0}); } +bool oc_surface_is_nil(oc_surface surface) { return(surface.h == 0); } -mg_surface mg_surface_create_for_window(mp_window window, mg_surface_api api) +oc_surface oc_surface_create_for_window(oc_window window, oc_surface_api api) { - if(__mgData.init) + if(oc_graphicsData.init) { - mg_init(); + oc_graphics_init(); } - mg_surface surfaceHandle = mg_surface_nil(); - mg_surface_data* surface = 0; + oc_surface surfaceHandle = oc_surface_nil(); + oc_surface_data* surface = 0; switch(api) { - #if MG_COMPILE_GL - case MG_GL: - surface = gl_surface_create_for_window(window); + #if OC_COMPILE_GL + case OC_GL: + surface = oc_gl_surface_create_for_window(window); break; #endif - #if MG_COMPILE_GLES - case MG_GLES: - surface = mg_egl_surface_create_for_window(window); + #if OC_COMPILE_GLES + case OC_GLES: + surface = oc_egl_surface_create_for_window(window); break; #endif - #if MG_COMPILE_METAL - case MG_METAL: - surface = mg_mtl_surface_create_for_window(window); + #if OC_COMPILE_METAL + case OC_METAL: + surface = oc_mtl_surface_create_for_window(window); break; #endif - #if MG_COMPILE_CANVAS - case MG_CANVAS: + #if OC_COMPILE_CANVAS + case OC_CANVAS: - #if PLATFORM_MACOS - surface = mtl_canvas_surface_create_for_window(window); - #elif PLATFORM_WINDOWS - surface = gl_canvas_surface_create_for_window(window); + #if OC_PLATFORM_MACOS + surface = oc_mtl_canvas_surface_create_for_window(window); + #elif OC_PLATFORM_WINDOWS + surface = oc_gl_canvas_surface_create_for_window(window); #endif break; #endif @@ -146,26 +146,26 @@ mg_surface mg_surface_create_for_window(mp_window window, mg_surface_api api) } if(surface) { - surfaceHandle = mg_surface_handle_alloc(surface); - mg_surface_prepare(surfaceHandle); + surfaceHandle = oc_surface_handle_alloc(surface); + oc_surface_select(surfaceHandle); } return(surfaceHandle); } -mg_surface mg_surface_create_remote(u32 width, u32 height, mg_surface_api api) +oc_surface oc_surface_create_remote(u32 width, u32 height, oc_surface_api api) { - if(!__mgData.init) + if(!oc_graphicsData.init) { - mg_init(); + oc_graphics_init(); } - mg_surface surfaceHandle = mg_surface_nil(); - mg_surface_data* surface = 0; + oc_surface surfaceHandle = oc_surface_nil(); + oc_surface_data* surface = 0; switch(api) { - #if MG_COMPILE_GLES - case MG_GLES: - surface = mg_egl_surface_create_remote(width, height); + #if OC_COMPILE_GLES + case OC_GLES: + surface = oc_egl_surface_create_remote(width, height); break; #endif @@ -174,42 +174,42 @@ mg_surface mg_surface_create_remote(u32 width, u32 height, mg_surface_api api) } if(surface) { - surfaceHandle = mg_surface_handle_alloc(surface); - mg_surface_prepare(surfaceHandle); + surfaceHandle = oc_surface_handle_alloc(surface); + oc_surface_select(surfaceHandle); } return(surfaceHandle); } -mg_surface mg_surface_create_host(mp_window window) +oc_surface oc_surface_create_host(oc_window window) { - if(!__mgData.init) + if(!oc_graphicsData.init) { - mg_init(); + oc_graphics_init(); } - mg_surface handle = mg_surface_nil(); - mg_surface_data* surface = 0; - #if PLATFORM_MACOS - surface = mg_osx_surface_create_host(window); - #elif PLATFORM_WINDOWS - surface = mg_win32_surface_create_host(window); + oc_surface handle = oc_surface_nil(); + oc_surface_data* surface = 0; + #if OC_PLATFORM_MACOS + surface = oc_osx_surface_create_host(window); + #elif OC_PLATFORM_WINDOWS + surface = oc_win32_surface_create_host(window); #endif if(surface) { - handle = mg_surface_handle_alloc(surface); + handle = oc_surface_handle_alloc(surface); } return(handle); } -void mg_surface_destroy(mg_surface handle) +void oc_surface_destroy(oc_surface handle) { - DEBUG_ASSERT(__mgData.init); - mg_surface_data* surface = mg_surface_data_from_handle(handle); + OC_DEBUG_ASSERT(oc_graphicsData.init); + oc_surface_data* surface = oc_surface_data_from_handle(handle); if(surface) { - if(__mgSelectedSurface.h == handle.h) + if(oc_selectedSurface.h == handle.h) { - mg_surface_deselect(); + oc_surface_deselect(); } if(surface->backend && surface->backend->destroy) @@ -217,64 +217,64 @@ void mg_surface_destroy(mg_surface handle) surface->backend->destroy(surface->backend); } surface->destroy(surface); - mg_handle_recycle(handle.h); + oc_graphics_handle_recycle(handle.h); } } -void mg_surface_deselect() +void oc_surface_deselect() { - DEBUG_ASSERT(__mgData.init); + OC_DEBUG_ASSERT(oc_graphicsData.init); - mg_surface_data* prevSurface = mg_surface_data_from_handle(__mgSelectedSurface); + oc_surface_data* prevSurface = oc_surface_data_from_handle(oc_selectedSurface); if(prevSurface && prevSurface->deselect) { prevSurface->deselect(prevSurface); } - __mgSelectedSurface = mg_surface_nil(); + oc_selectedSurface = oc_surface_nil(); } -void mg_surface_prepare(mg_surface surface) +void oc_surface_select(oc_surface surface) { - DEBUG_ASSERT(__mgData.init); + OC_DEBUG_ASSERT(oc_graphicsData.init); - if(surface.h != __mgSelectedSurface.h) + if(surface.h != oc_selectedSurface.h) { - mg_surface_deselect(); + oc_surface_deselect(); } - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->prepare) { surfaceData->prepare(surfaceData); - __mgSelectedSurface = surface; + oc_selectedSurface = surface; } } -void mg_surface_present(mg_surface surface) +void oc_surface_present(oc_surface surface) { - DEBUG_ASSERT(__mgData.init); - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + OC_DEBUG_ASSERT(oc_graphicsData.init); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->present) { surfaceData->present(surfaceData); } } -void mg_surface_swap_interval(mg_surface surface, int swap) +void oc_surface_swap_interval(oc_surface surface, int swap) { - DEBUG_ASSERT(__mgData.init); - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + OC_DEBUG_ASSERT(oc_graphicsData.init); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->swapInterval) { surfaceData->swapInterval(surfaceData, swap); } } -vec2 mg_surface_get_size(mg_surface surface) +oc_vec2 oc_surface_get_size(oc_surface surface) { - DEBUG_ASSERT(__mgData.init); - vec2 size = {0}; - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + OC_DEBUG_ASSERT(oc_graphicsData.init); + oc_vec2 size = {0}; + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->getSize) { size = surfaceData->getSize(surfaceData); @@ -282,11 +282,11 @@ vec2 mg_surface_get_size(mg_surface surface) return(size); } -vec2 mg_surface_contents_scaling(mg_surface surface) +oc_vec2 oc_surface_contents_scaling(oc_surface surface) { - DEBUG_ASSERT(__mgData.init); - vec2 scaling = {1, 1}; - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + OC_DEBUG_ASSERT(oc_graphicsData.init); + oc_vec2 scaling = {1, 1}; + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->contentsScaling) { scaling = surfaceData->contentsScaling(surfaceData); @@ -294,21 +294,21 @@ vec2 mg_surface_contents_scaling(mg_surface surface) return(scaling); } -void mg_surface_set_hidden(mg_surface surface, bool hidden) +void oc_surface_set_hidden(oc_surface surface, bool hidden) { - DEBUG_ASSERT(__mgData.init); - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + OC_DEBUG_ASSERT(oc_graphicsData.init); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->setHidden) { surfaceData->setHidden(surfaceData, hidden); } } -bool mg_surface_get_hidden(mg_surface surface) +bool oc_surface_get_hidden(oc_surface surface) { - DEBUG_ASSERT(__mgData.init); + OC_DEBUG_ASSERT(oc_graphicsData.init); bool res = false; - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->getHidden) { res = surfaceData->getHidden(surfaceData); @@ -316,10 +316,10 @@ bool mg_surface_get_hidden(mg_surface surface) return(res); } -void* mg_surface_native_layer(mg_surface surface) +void* oc_surface_native_layer(oc_surface surface) { void* res = 0; - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); if(surfaceData && surfaceData->nativeLayer) { res = surfaceData->nativeLayer(surfaceData); @@ -327,10 +327,10 @@ void* mg_surface_native_layer(mg_surface surface) return(res); } -mg_surface_id mg_surface_remote_id(mg_surface handle) +oc_surface_id oc_surface_remote_id(oc_surface handle) { - mg_surface_id remoteId = 0; - mg_surface_data* surface = mg_surface_data_from_handle(handle); + oc_surface_id remoteId = 0; + oc_surface_data* surface = oc_surface_data_from_handle(handle); if(surface && surface->remoteID) { remoteId = surface->remoteID(surface); @@ -338,27 +338,27 @@ mg_surface_id mg_surface_remote_id(mg_surface handle) return(remoteId); } -void mg_surface_host_connect(mg_surface handle, mg_surface_id remoteID) +void oc_surface_host_connect(oc_surface handle, oc_surface_id remoteID) { - mg_surface_data* surface = mg_surface_data_from_handle(handle); + oc_surface_data* surface = oc_surface_data_from_handle(handle); if(surface && surface->hostConnect) { surface->hostConnect(surface, remoteID); } } -void mg_surface_render_commands(mg_surface surface, - mg_color clearColor, +void oc_surface_render_commands(oc_surface surface, + oc_color clearColor, u32 primitiveCount, - mg_primitive* primitives, + oc_primitive* primitives, u32 eltCount, - mg_path_elt* elements) + oc_path_elt* elements) { - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); - if(surface.h != __mgSelectedSurface.h) + if(surface.h != oc_selectedSurface.h) { - log_error("surface is not selected. Make sure to call mg_surface_prepare() before drawing onto a surface.\n"); + oc_log_error("surface is not selected. Make sure to call oc_surface_select() before drawing onto a surface.\n"); } else if(surfaceData && surfaceData->backend) { @@ -375,10 +375,10 @@ void mg_surface_render_commands(mg_surface surface, //NOTE(martin): images //------------------------------------------------------------------------------------------ -vec2 mg_image_size(mg_image image) +oc_vec2 oc_image_size(oc_image image) { - vec2 res = {0}; - mg_image_data* imageData = mg_image_data_from_handle(image); + oc_vec2 res = {0}; + oc_image_data* imageData = oc_image_data_from_handle(image); if(imageData) { res = imageData->size; @@ -386,67 +386,67 @@ vec2 mg_image_size(mg_image image) return(res); } -mg_image mg_image_create(mg_surface surface, u32 width, u32 height) +oc_image oc_image_create(oc_surface surface, u32 width, u32 height) { - mg_image image = mg_image_nil(); - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); + oc_image image = oc_image_nil(); + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); - if(surface.h != __mgSelectedSurface.h) + if(surface.h != oc_selectedSurface.h) { - log_error("surface is not selected. Make sure to call mg_surface_prepare() before modifying graphics resources.\n"); + oc_log_error("surface is not selected. Make sure to call oc_surface_select() before modifying graphics resources.\n"); } else if(surfaceData && surfaceData->backend) { - DEBUG_ASSERT(surfaceData->api == MG_CANVAS); + OC_DEBUG_ASSERT(surfaceData->api == OC_CANVAS); - mg_image_data* imageData = surfaceData->backend->imageCreate(surfaceData->backend, (vec2){width, height}); + oc_image_data* imageData = surfaceData->backend->imageCreate(surfaceData->backend, (oc_vec2){width, height}); if(imageData) { imageData->surface = surface; - image = mg_image_handle_alloc(imageData); + image = oc_image_handle_alloc(imageData); } } return(image); } -void mg_image_destroy(mg_image image) +void oc_image_destroy(oc_image image) { - mg_image_data* imageData = mg_image_data_from_handle(image); + oc_image_data* imageData = oc_image_data_from_handle(image); if(imageData) { - if(imageData->surface.h != __mgSelectedSurface.h) + if(imageData->surface.h != oc_selectedSurface.h) { - log_error("surface is not selected. Make sure to call mg_surface_prepare() before modifying graphics resources.\n"); + oc_log_error("surface is not selected. Make sure to call oc_surface_select() before modifying graphics resources.\n"); } else { - mg_surface_data* surface = mg_surface_data_from_handle(imageData->surface); + oc_surface_data* surface = oc_surface_data_from_handle(imageData->surface); if(surface && surface->backend) { surface->backend->imageDestroy(surface->backend, imageData); - mg_handle_recycle(image.h); + oc_graphics_handle_recycle(image.h); } } } } -void mg_image_upload_region_rgba8(mg_image image, mp_rect region, u8* pixels) +void oc_image_upload_region_rgba8(oc_image image, oc_rect region, u8* pixels) { - mg_image_data* imageData = mg_image_data_from_handle(image); + oc_image_data* imageData = oc_image_data_from_handle(image); if(imageData) { - if(imageData->surface.h != __mgSelectedSurface.h) + if(imageData->surface.h != oc_selectedSurface.h) { - log_error("surface is not selected. Make sure to call mg_surface_prepare() before modifying graphics resources.\n"); + oc_log_error("surface is not selected. Make sure to call oc_surface_select() before modifying graphics resources.\n"); } else { - mg_surface_data* surfaceData = mg_surface_data_from_handle(imageData->surface); + oc_surface_data* surfaceData = oc_surface_data_from_handle(imageData->surface); if(surfaceData) { - DEBUG_ASSERT(surfaceData->backend); + OC_DEBUG_ASSERT(surfaceData->backend); surfaceData->backend->imageUploadRegion(surfaceData->backend, imageData, region, pixels); } } diff --git a/src/graphics/graphics_surface.h b/src/graphics/graphics_surface.h index 8b85f3f..257265f 100644 --- a/src/graphics/graphics_surface.h +++ b/src/graphics/graphics_surface.h @@ -9,7 +9,7 @@ #define __GRAPHICS_SURFACE_H_ #include"graphics_common.h" -#include"app/mp_app_internal.h" +#include"app/app_internal.h" #ifdef __cplusplus extern "C" { @@ -18,92 +18,92 @@ extern "C" { //--------------------------------------------------------------- // surface interface //--------------------------------------------------------------- -typedef struct mg_surface_data mg_surface_data; -typedef struct mg_canvas_backend mg_canvas_backend; +typedef struct oc_surface_data oc_surface_data; +typedef struct oc_canvas_backend oc_canvas_backend; -typedef void (*mg_surface_destroy_proc)(mg_surface_data* surface); -typedef void (*mg_surface_prepare_proc)(mg_surface_data* surface); -typedef void (*mg_surface_deselect_proc)(mg_surface_data* surface); -typedef void (*mg_surface_present_proc)(mg_surface_data* surface); -typedef void (*mg_surface_swap_interval_proc)(mg_surface_data* surface, int swap); -typedef vec2 (*mg_surface_get_size_proc)(mg_surface_data* surface); -typedef vec2 (*mg_surface_contents_scaling_proc)(mg_surface_data* surface); -typedef bool (*mg_surface_get_hidden_proc)(mg_surface_data* surface); -typedef void (*mg_surface_set_hidden_proc)(mg_surface_data* surface, bool hidden); -typedef void* (*mg_surface_native_layer_proc)(mg_surface_data* surface); -typedef mg_surface_id (*mg_surface_remote_id_proc)(mg_surface_data* surface); -typedef void (*mg_surface_host_connect_proc)(mg_surface_data* surface, mg_surface_id remoteId); +typedef void (*oc_surface_destroy_proc)(oc_surface_data* surface); +typedef void (*oc_surface_select_proc)(oc_surface_data* surface); +typedef void (*oc_surface_deselect_proc)(oc_surface_data* surface); +typedef void (*oc_surface_present_proc)(oc_surface_data* surface); +typedef void (*oc_surface_swap_interval_proc)(oc_surface_data* surface, int swap); +typedef oc_vec2 (*oc_surface_get_size_proc)(oc_surface_data* surface); +typedef oc_vec2 (*oc_surface_contents_scaling_proc)(oc_surface_data* surface); +typedef bool (*oc_surface_get_hidden_proc)(oc_surface_data* surface); +typedef void (*oc_surface_set_hidden_proc)(oc_surface_data* surface, bool hidden); +typedef void* (*oc_surface_native_layer_proc)(oc_surface_data* surface); +typedef oc_surface_id (*oc_surface_remote_id_proc)(oc_surface_data* surface); +typedef void (*oc_surface_host_connect_proc)(oc_surface_data* surface, oc_surface_id remoteId); -typedef struct mg_surface_data +typedef struct oc_surface_data { - mg_surface_api api; - mp_layer layer; + oc_surface_api api; + oc_layer layer; - mg_surface_destroy_proc destroy; - mg_surface_prepare_proc prepare; - mg_surface_present_proc present; - mg_surface_deselect_proc deselect; - mg_surface_swap_interval_proc swapInterval; - mg_surface_get_size_proc getSize; - mg_surface_contents_scaling_proc contentsScaling; - mg_surface_get_hidden_proc getHidden; - mg_surface_set_hidden_proc setHidden; - mg_surface_native_layer_proc nativeLayer; - mg_surface_remote_id_proc remoteID; - mg_surface_host_connect_proc hostConnect; + oc_surface_destroy_proc destroy; + oc_surface_select_proc prepare; + oc_surface_present_proc present; + oc_surface_deselect_proc deselect; + oc_surface_swap_interval_proc swapInterval; + oc_surface_get_size_proc getSize; + oc_surface_contents_scaling_proc contentsScaling; + oc_surface_get_hidden_proc getHidden; + oc_surface_set_hidden_proc setHidden; + oc_surface_native_layer_proc nativeLayer; + oc_surface_remote_id_proc remoteID; + oc_surface_host_connect_proc hostConnect; - mg_canvas_backend* backend; + oc_canvas_backend* backend; -} mg_surface_data; +} oc_surface_data; -mg_surface mg_surface_alloc_handle(mg_surface_data* surface); -mg_surface_data* mg_surface_data_from_handle(mg_surface handle); +oc_surface oc_surface_handle_alloc(oc_surface_data* surface); +oc_surface_data* oc_surface_data_from_handle(oc_surface handle); -void mg_surface_init_for_window(mg_surface_data* surface, mp_window_data* window); -void mg_surface_init_remote(mg_surface_data* surface, u32 width, u32 height); -void mg_surface_init_host(mg_surface_data* surface, mp_window_data* window); -void mg_surface_cleanup(mg_surface_data* surface); -void* mg_surface_native_layer(mg_surface surface); +void oc_surface_init_for_window(oc_surface_data* surface, oc_window_data* window); +void oc_surface_init_remote(oc_surface_data* surface, u32 width, u32 height); +void oc_surface_init_host(oc_surface_data* surface, oc_window_data* window); +void oc_surface_cleanup(oc_surface_data* surface); +void* oc_surface_native_layer(oc_surface surface); //--------------------------------------------------------------- // canvas backend interface //--------------------------------------------------------------- -typedef struct mg_image_data +typedef struct oc_image_data { - list_elt listElt; + oc_list_elt listElt; u32 generation; - mg_surface surface; - vec2 size; + oc_surface surface; + oc_vec2 size; -} mg_image_data; +} oc_image_data; -typedef void (*mg_canvas_backend_destroy_proc)(mg_canvas_backend* backend); +typedef void (*oc_canvas_backend_destroy_proc)(oc_canvas_backend* backend); -typedef mg_image_data* (*mg_canvas_backend_image_create_proc)(mg_canvas_backend* backend, vec2 size); -typedef void (*mg_canvas_backend_image_destroy_proc)(mg_canvas_backend* backend, mg_image_data* image); -typedef void (*mg_canvas_backend_image_upload_region_proc)(mg_canvas_backend* backend, - mg_image_data* image, - mp_rect region, +typedef oc_image_data* (*oc_canvas_backend_image_create_proc)(oc_canvas_backend* backend, oc_vec2 size); +typedef void (*oc_canvas_backend_image_destroy_proc)(oc_canvas_backend* backend, oc_image_data* image); +typedef void (*oc_canvas_backend_image_upload_region_proc)(oc_canvas_backend* backend, + oc_image_data* image, + oc_rect region, u8* pixels); -typedef void (*mg_canvas_backend_render_proc)(mg_canvas_backend* backend, - mg_color clearColor, +typedef void (*oc_canvas_backend_render_proc)(oc_canvas_backend* backend, + oc_color clearColor, u32 primitiveCount, - mg_primitive* primitives, + oc_primitive* primitives, u32 eltCount, - mg_path_elt* pathElements); + oc_path_elt* pathElements); -typedef struct mg_canvas_backend +typedef struct oc_canvas_backend { - mg_canvas_backend_destroy_proc destroy; + oc_canvas_backend_destroy_proc destroy; - mg_canvas_backend_image_create_proc imageCreate; - mg_canvas_backend_image_destroy_proc imageDestroy; - mg_canvas_backend_image_upload_region_proc imageUploadRegion; + oc_canvas_backend_image_create_proc imageCreate; + oc_canvas_backend_image_destroy_proc imageDestroy; + oc_canvas_backend_image_upload_region_proc imageUploadRegion; - mg_canvas_backend_render_proc render; + oc_canvas_backend_render_proc render; -} mg_canvas_backend; +} oc_canvas_backend; #ifdef __cplusplus } // extern "C" diff --git a/src/graphics/mtl_renderer.h b/src/graphics/mtl_renderer.h index 287ed4c..e2d6dd1 100644 --- a/src/graphics/mtl_renderer.h +++ b/src/graphics/mtl_renderer.h @@ -12,45 +12,45 @@ #include typedef enum { - MG_MTL_FILL, - MG_MTL_STROKE, -} mg_mtl_cmd; + OC_MTL_FILL, + OC_MTL_STROKE, +} oc_mtl_cmd; -typedef struct mg_mtl_path +typedef struct oc_mtl_path { - mg_mtl_cmd cmd; + oc_mtl_cmd cmd; matrix_float3x3 uvTransform; vector_float4 color; vector_float4 box; vector_float4 clip; int texture; -} mg_mtl_path; +} oc_mtl_path; typedef enum { - MG_MTL_LINE = 1, - MG_MTL_QUADRATIC, - MG_MTL_CUBIC, -} mg_mtl_seg_kind; + OC_MTL_LINE = 1, + OC_MTL_QUADRATIC, + OC_MTL_CUBIC, +} oc_mtl_seg_kind; -typedef struct mg_mtl_path_elt +typedef struct oc_mtl_path_elt { int pathIndex; - mg_mtl_seg_kind kind; + oc_mtl_seg_kind kind; vector_float2 p[4]; -} mg_mtl_path_elt; +} oc_mtl_path_elt; typedef enum { - MG_MTL_BL, // curve on bottom left - MG_MTL_BR, // curve on bottom right - MG_MTL_TL, // curve on top left - MG_MTL_TR // curve on top right -} mg_mtl_seg_config; + OC_MTL_BL, // curve on bottom left + OC_MTL_BR, // curve on bottom right + OC_MTL_TL, // curve on top left + OC_MTL_TR // curve on top right +} oc_mtl_seg_config; -typedef struct mg_mtl_segment +typedef struct oc_mtl_segment { - mg_mtl_seg_kind kind; + oc_mtl_seg_kind kind; int pathIndex; - mg_mtl_seg_config config; //TODO pack these + oc_mtl_seg_config config; //TODO pack these int windingIncrement; vector_float4 box; matrix_float3x3 implicitMatrix; @@ -58,27 +58,27 @@ typedef struct mg_mtl_segment vector_float2 hullVertex; int debugID; -} mg_mtl_segment; +} oc_mtl_segment; -typedef struct mg_mtl_path_queue +typedef struct oc_mtl_path_queue { vector_int4 area; int tileQueues; -} mg_mtl_path_queue; +} oc_mtl_path_queue; #ifdef __METAL_VERSION__ using namespace metal; #endif -typedef enum { MG_MTL_OP_FILL, - MG_MTL_OP_CLIP_FILL, - MG_MTL_OP_START, - MG_MTL_OP_END, - MG_MTL_OP_SEGMENT } mg_mtl_tile_op_kind; +typedef enum { OC_MTL_OP_FILL, + OC_MTL_OP_CLIP_FILL, + OC_MTL_OP_START, + OC_MTL_OP_END, + OC_MTL_OP_SEGMENT } oc_mtl_tile_op_kind; -typedef struct mg_mtl_tile_op +typedef struct oc_mtl_tile_op { - mg_mtl_tile_op_kind kind; + oc_mtl_tile_op_kind kind; int index; int next; union @@ -87,25 +87,25 @@ typedef struct mg_mtl_tile_op int windingOffset; }; -} mg_mtl_tile_op; +} oc_mtl_tile_op; -typedef struct mg_mtl_tile_queue +typedef struct oc_mtl_tile_queue { atomic_int windingOffset; atomic_int first; int last; -} mg_mtl_tile_queue; +} oc_mtl_tile_queue; -typedef struct mg_mtl_screen_tile +typedef struct oc_mtl_screen_tile { vector_uint2 tileCoord; int first; -} mg_mtl_screen_tile; +} oc_mtl_screen_tile; enum { - MG_MTL_MAX_IMAGES_PER_BATCH = 30 + OC_MTL_MAX_IMAGES_PER_BATCH = 30 }; #endif //__MTL_RENDERER_H_ diff --git a/src/graphics/mtl_renderer.m b/src/graphics/mtl_renderer.m index 5aed54c..0a4a908 100644 --- a/src/graphics/mtl_renderer.m +++ b/src/graphics/mtl_renderer.m @@ -11,19 +11,19 @@ #include #include"graphics_surface.h" -#include"util/macro_helpers.h" +#include"util/macros.h" #include"app/osx_app.h" #include"mtl_renderer.h" -const int MG_MTL_INPUT_BUFFERS_COUNT = 3, - MG_MTL_TILE_SIZE = 16, - MG_MTL_MSAA_COUNT = 8; +const int OC_MTL_INPUT_BUFFERS_COUNT = 3, + OC_MTL_TILE_SIZE = 16, + OC_MTL_MSAA_COUNT = 8; -typedef struct mg_mtl_canvas_backend +typedef struct oc_mtl_canvas_backend { - mg_canvas_backend interface; - mg_mtl_surface* surface; + oc_canvas_backend interface; + oc_mtl_surface* surface; id pathPipeline; id segmentPipeline; @@ -37,10 +37,10 @@ typedef struct mg_mtl_canvas_backend int bufferIndex; dispatch_semaphore_t bufferSemaphore; - id pathBuffer[MG_MTL_INPUT_BUFFERS_COUNT]; - id elementBuffer[MG_MTL_INPUT_BUFFERS_COUNT]; - id logBuffer[MG_MTL_INPUT_BUFFERS_COUNT]; - id logOffsetBuffer[MG_MTL_INPUT_BUFFERS_COUNT]; + id pathBuffer[OC_MTL_INPUT_BUFFERS_COUNT]; + id elementBuffer[OC_MTL_INPUT_BUFFERS_COUNT]; + id logBuffer[OC_MTL_INPUT_BUFFERS_COUNT]; + id logOffsetBuffer[OC_MTL_INPUT_BUFFERS_COUNT]; id segmentCountBuffer; id segmentBuffer; @@ -53,7 +53,7 @@ typedef struct mg_mtl_canvas_backend id rasterDispatchBuffer; int msaaCount; - vec2 frameSize; + oc_vec2 frameSize; // encoding context int eltCap; @@ -64,31 +64,31 @@ typedef struct mg_mtl_canvas_backend int pathCount; int pathBatchStart; - mg_primitive* primitive; - vec4 pathScreenExtents; - vec4 pathUserExtents; + oc_primitive* primitive; + oc_vec4 pathScreenExtents; + oc_vec4 pathUserExtents; int maxTileQueueCount; int maxSegmentCount; int currentImageIndex; -} mg_mtl_canvas_backend; +} oc_mtl_canvas_backend; -typedef struct mg_mtl_image_data +typedef struct oc_mtl_image_data { - mg_image_data interface; + oc_image_data interface; id texture; -} mg_mtl_image_data; +} oc_mtl_image_data; -void mg_mtl_print_log(int bufferIndex, id logBuffer, id logOffsetBuffer) +void oc_mtl_print_log(int bufferIndex, id logBuffer, id logOffsetBuffer) { char* log = [logBuffer contents]; int size = *(int*)[logOffsetBuffer contents]; if(size) { - log_info("Log from buffer %i:\n", bufferIndex); + oc_log_info("Log from buffer %i:\n", bufferIndex); int index = 0; while(index < size) @@ -100,15 +100,15 @@ void mg_mtl_print_log(int bufferIndex, id logBuffer, id lo } } -static void mg_update_path_extents(vec4* extents, vec2 p) +static void oc_mtl_update_path_extents(oc_vec4* extents, oc_vec2 p) { - extents->x = minimum(extents->x, p.x); - extents->y = minimum(extents->y, p.y); - extents->z = maximum(extents->z, p.x); - extents->w = maximum(extents->w, p.y); + extents->x = oc_min(extents->x, p.x); + extents->y = oc_min(extents->y, p.y); + extents->z = oc_max(extents->z, p.x); + extents->w = oc_max(extents->w, p.y); } -id mg_mtl_grow_input_buffer(id device, id oldBuffer, int oldCopySize, int newSize) +id oc_mtl_grow_input_buffer(id device, id oldBuffer, int oldCopySize, int newSize) { @autoreleasepool { @@ -124,46 +124,46 @@ id mg_mtl_grow_input_buffer(id device, id oldBu } } -void mg_mtl_canvas_encode_element(mg_mtl_canvas_backend* backend, mg_path_elt_type kind, vec2* p) +void oc_mtl_canvas_encode_element(oc_mtl_canvas_backend* backend, oc_path_elt_type kind, oc_vec2* p) { int bufferIndex = backend->bufferIndex; - int bufferCap = [backend->elementBuffer[bufferIndex] length] / sizeof(mg_mtl_path_elt); + int bufferCap = [backend->elementBuffer[bufferIndex] length] / sizeof(oc_mtl_path_elt); if(backend->eltCount >= bufferCap) { int newBufferCap = (int)(bufferCap * 1.5); - int newBufferSize = newBufferCap * sizeof(mg_mtl_path_elt); + int newBufferSize = newBufferCap * sizeof(oc_mtl_path_elt); - log_info("growing element buffer to %i elements\n", newBufferCap); + oc_log_info("growing element buffer to %i elements\n", newBufferCap); - backend->elementBuffer[bufferIndex] = mg_mtl_grow_input_buffer(backend->surface->device, + backend->elementBuffer[bufferIndex] = oc_mtl_grow_input_buffer(backend->surface->device, backend->elementBuffer[bufferIndex], - backend->eltCount * sizeof(mg_mtl_path_elt), + backend->eltCount * sizeof(oc_mtl_path_elt), newBufferSize); } - mg_mtl_path_elt* elements = (mg_mtl_path_elt*)[backend->elementBuffer[bufferIndex] contents]; - mg_mtl_path_elt* elt = &elements[backend->eltCount]; + oc_mtl_path_elt* elements = (oc_mtl_path_elt*)[backend->elementBuffer[bufferIndex] contents]; + oc_mtl_path_elt* elt = &elements[backend->eltCount]; backend->eltCount++; elt->pathIndex = backend->pathCount - backend->pathBatchStart; int count = 0; switch(kind) { - case MG_PATH_LINE: + case OC_PATH_LINE: backend->maxSegmentCount += 1; - elt->kind = MG_MTL_LINE; + elt->kind = OC_MTL_LINE; count = 2; break; - case MG_PATH_QUADRATIC: + case OC_PATH_QUADRATIC: backend->maxSegmentCount += 3; - elt->kind = MG_MTL_QUADRATIC; + elt->kind = OC_MTL_QUADRATIC; count = 3; break; - case MG_PATH_CUBIC: + case OC_PATH_CUBIC: backend->maxSegmentCount += 7; - elt->kind = MG_MTL_CUBIC; + elt->kind = OC_MTL_CUBIC; count = 4; break; @@ -173,38 +173,38 @@ void mg_mtl_canvas_encode_element(mg_mtl_canvas_backend* backend, mg_path_elt_ty for(int i=0; ipathUserExtents, p[i]); + oc_mtl_update_path_extents(&backend->pathUserExtents, p[i]); - vec2 screenP = mg_mat2x3_mul(backend->primitive->attributes.transform, p[i]); + oc_vec2 screenP = oc_mat2x3_mul(backend->primitive->attributes.transform, p[i]); elt->p[i] = (vector_float2){screenP.x, screenP.y}; - mg_update_path_extents(&backend->pathScreenExtents, screenP); + oc_mtl_update_path_extents(&backend->pathScreenExtents, screenP); } } -void mg_mtl_encode_path(mg_mtl_canvas_backend* backend, mg_primitive* primitive, float scale) +void oc_mtl_encode_path(oc_mtl_canvas_backend* backend, oc_primitive* primitive, float scale) { int bufferIndex = backend->bufferIndex; - int bufferCap = [backend->pathBuffer[bufferIndex] length] / sizeof(mg_mtl_path); + int bufferCap = [backend->pathBuffer[bufferIndex] length] / sizeof(oc_mtl_path); if(backend->pathCount >= bufferCap) { int newBufferCap = (int)(bufferCap * 1.5); - int newBufferSize = newBufferCap * sizeof(mg_mtl_path); + int newBufferSize = newBufferCap * sizeof(oc_mtl_path); - log_info("growing path buffer to %i elements\n", newBufferCap); + oc_log_info("growing path buffer to %i elements\n", newBufferCap); - backend->pathBuffer[bufferIndex] = mg_mtl_grow_input_buffer(backend->surface->device, + backend->pathBuffer[bufferIndex] = oc_mtl_grow_input_buffer(backend->surface->device, backend->pathBuffer[bufferIndex], - backend->eltCount * sizeof(mg_mtl_path), + backend->eltCount * sizeof(oc_mtl_path), newBufferSize); } - mg_mtl_path* pathBufferData = (mg_mtl_path*)[backend->pathBuffer[backend->bufferIndex] contents]; - mg_mtl_path* path = &(pathBufferData[backend->pathCount]); + oc_mtl_path* pathBufferData = (oc_mtl_path*)[backend->pathBuffer[backend->bufferIndex] contents]; + oc_mtl_path* path = &(pathBufferData[backend->pathCount]); backend->pathCount++; - path->cmd = (mg_mtl_cmd)primitive->cmd; + path->cmd = (oc_mtl_cmd)primitive->cmd; path->box = (vector_float4){backend->pathScreenExtents.x, backend->pathScreenExtents.y, @@ -221,32 +221,32 @@ void mg_mtl_encode_path(mg_mtl_canvas_backend* backend, mg_primitive* primitive, primitive->attributes.color.b, primitive->attributes.color.a}; - mp_rect srcRegion = primitive->attributes.srcRegion; + oc_rect srcRegion = primitive->attributes.srcRegion; - mp_rect destRegion = {backend->pathUserExtents.x, + oc_rect destRegion = {backend->pathUserExtents.x, backend->pathUserExtents.y, backend->pathUserExtents.z - backend->pathUserExtents.x, backend->pathUserExtents.w - backend->pathUserExtents.y}; - if(!mg_image_is_nil(primitive->attributes.image)) + if(!oc_image_is_nil(primitive->attributes.image)) { - vec2 texSize = mg_image_size(primitive->attributes.image); + oc_vec2 texSize = oc_image_size(primitive->attributes.image); - mg_mat2x3 srcRegionToImage = {1/texSize.x, 0, srcRegion.x/texSize.x, + oc_mat2x3 srcRegionToImage = {1/texSize.x, 0, srcRegion.x/texSize.x, 0, 1/texSize.y, srcRegion.y/texSize.y}; - mg_mat2x3 destRegionToSrcRegion = {srcRegion.w/destRegion.w, 0, 0, + oc_mat2x3 destRegionToSrcRegion = {srcRegion.w/destRegion.w, 0, 0, 0, srcRegion.h/destRegion.h, 0}; - mg_mat2x3 userToDestRegion = {1, 0, -destRegion.x, + oc_mat2x3 userToDestRegion = {1, 0, -destRegion.x, 0, 1, -destRegion.y}; - mg_mat2x3 screenToUser = mg_mat2x3_inv(primitive->attributes.transform); + oc_mat2x3 screenToUser = oc_mat2x3_inv(primitive->attributes.transform); - mg_mat2x3 uvTransform = srcRegionToImage; - uvTransform = mg_mat2x3_mul_m(uvTransform, destRegionToSrcRegion); - uvTransform = mg_mat2x3_mul_m(uvTransform, userToDestRegion); - uvTransform = mg_mat2x3_mul_m(uvTransform, screenToUser); + oc_mat2x3 uvTransform = srcRegionToImage; + uvTransform = oc_mat2x3_mul_m(uvTransform, destRegionToSrcRegion); + uvTransform = oc_mat2x3_mul_m(uvTransform, userToDestRegion); + uvTransform = oc_mat2x3_mul_m(uvTransform, screenToUser); path->uvTransform = simd_matrix(simd_make_float3(uvTransform.m[0]/scale, uvTransform.m[3]/scale, 0), simd_make_float3(uvTransform.m[1]/scale, uvTransform.m[4]/scale, 0), @@ -255,10 +255,10 @@ void mg_mtl_encode_path(mg_mtl_canvas_backend* backend, mg_primitive* primitive, } path->texture = backend->currentImageIndex; - int firstTileX = path->box.x*scale / MG_MTL_TILE_SIZE; - int firstTileY = path->box.y*scale / MG_MTL_TILE_SIZE; - int lastTileX = path->box.z*scale / MG_MTL_TILE_SIZE; - int lastTileY = path->box.w*scale / MG_MTL_TILE_SIZE; + int firstTileX = path->box.x*scale / OC_MTL_TILE_SIZE; + int firstTileY = path->box.y*scale / OC_MTL_TILE_SIZE; + int lastTileX = path->box.z*scale / OC_MTL_TILE_SIZE; + int lastTileY = path->box.w*scale / OC_MTL_TILE_SIZE; int nTilesX = lastTileX - firstTileX + 1; int nTilesY = lastTileY - firstTileY + 1; @@ -266,7 +266,7 @@ void mg_mtl_encode_path(mg_mtl_canvas_backend* backend, mg_primitive* primitive, backend->maxTileQueueCount += (nTilesX * nTilesY); } -bool mg_intersect_hull_legs(vec2 p0, vec2 p1, vec2 p2, vec2 p3, vec2* intersection) +static bool oc_intersect_hull_legs(oc_vec2 p0, oc_vec2 p1, oc_vec2 p2, oc_vec2 p3, oc_vec2* intersection) { /*NOTE: check intersection of lines (p0-p1) and (p2-p3) @@ -288,26 +288,26 @@ bool mg_intersect_hull_legs(vec2 p0, vec2 p1, vec2 p2, vec2 p3, vec2* intersecti return(found); } -bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) +static bool oc_offset_hull(int count, oc_vec2* p, oc_vec2* result, f32 offset) { //NOTE: we should have no more than two coincident points here. This means the leg between // those two points can't be offset, but we can set a double point at the start of first leg, // end of first leg, or we can join the first and last leg to create a missing middle one - vec2 legs[3][2] = {0}; + oc_vec2 legs[3][2] = {0}; bool valid[3] = {0}; for(int i=0; i= 1e-6) { - n = vec2_mul(offset/norm, n); - legs[i][0] = vec2_add(p[i], n); - legs[i][1] = vec2_add(p[i+1], n); + n = oc_vec2_mul(offset/norm, n); + legs[i][0] = oc_vec2_add(p[i], n); + legs[i][1] = oc_vec2_add(p[i+1], n); valid[i] = true; } } @@ -321,7 +321,7 @@ bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) } else { - ASSERT(valid[1]); + OC_ASSERT(valid[1]); result[0] = legs[1][0]; } @@ -331,17 +331,17 @@ bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) if(!valid[i-1]) { - ASSERT(valid[i]); + OC_ASSERT(valid[i]); result[i] = legs[i][0]; } else if(!valid[i]) { - ASSERT(valid[i-1]); + OC_ASSERT(valid[i-1]); result[i] = legs[i-1][0]; } else { - if(!mg_intersect_hull_legs(legs[i-1][0], legs[i-1][1], legs[i][0], legs[i][1], &result[i])) + if(!oc_intersect_hull_legs(legs[i-1][0], legs[i-1][1], legs[i][0], legs[i][1], &result[i])) { // legs don't intersect. return(false); @@ -355,20 +355,20 @@ bool mg_offset_hull(int count, vec2* p, vec2* result, f32 offset) } else { - ASSERT(valid[count-3]); + OC_ASSERT(valid[count-3]); result[count-1] = legs[count-3][1]; } return(true); } -vec2 mg_quadratic_get_point(vec2 p[3], f32 t) +static oc_vec2 oc_quadratic_get_point(oc_vec2 p[3], f32 t) { - vec2 r; + oc_vec2 r; f32 oneMt = 1-t; - f32 oneMt2 = Square(oneMt); - f32 t2 = Square(t); + f32 oneMt2 = oc_square(oneMt); + f32 t2 = oc_square(t); r.x = oneMt2*p[0].x + 2*oneMt*t*p[1].x + t2*p[2].x; r.y = oneMt2*p[0].y + 2*oneMt*t*p[1].y + t2*p[2].y; @@ -376,7 +376,7 @@ vec2 mg_quadratic_get_point(vec2 p[3], f32 t) return(r); } -void mg_quadratic_split(vec2 p[3], f32 t, vec2 outLeft[3], vec2 outRight[3]) +static void oc_quadratic_split(oc_vec2 p[3], f32 t, oc_vec2 outLeft[3], oc_vec2 outRight[3]) { //NOTE(martin): split bezier curve p at parameter t, using De Casteljau's algorithm // the q_n are the points along the hull's segments at parameter t @@ -384,13 +384,13 @@ void mg_quadratic_split(vec2 p[3], f32 t, vec2 outLeft[3], vec2 outRight[3]) f32 oneMt = 1-t; - vec2 q0 = {oneMt*p[0].x + t*p[1].x, + oc_vec2 q0 = {oneMt*p[0].x + t*p[1].x, oneMt*p[0].y + t*p[1].y}; - vec2 q1 = {oneMt*p[1].x + t*p[2].x, + oc_vec2 q1 = {oneMt*p[1].x + t*p[2].x, oneMt*p[1].y + t*p[2].y}; - vec2 s = {oneMt*q0.x + t*q1.x, + oc_vec2 s = {oneMt*q0.x + t*q1.x, oneMt*q0.y + t*q1.y}; outLeft[0] = p[0]; @@ -402,14 +402,14 @@ void mg_quadratic_split(vec2 p[3], f32 t, vec2 outLeft[3], vec2 outRight[3]) outRight[2] = p[2]; } -vec2 mg_cubic_get_point(vec2 p[4], f32 t) +static oc_vec2 oc_cubic_get_point(oc_vec2 p[4], f32 t) { - vec2 r; + oc_vec2 r; f32 oneMt = 1-t; - f32 oneMt2 = Square(oneMt); + f32 oneMt2 = oc_square(oneMt); f32 oneMt3 = oneMt2*oneMt; - f32 t2 = Square(t); + f32 t2 = oc_square(t); f32 t3 = t2*t; r.x = oneMt3*p[0].x + 3*oneMt2*t*p[1].x + 3*oneMt*t2*p[2].x + t3*p[3].x; @@ -418,29 +418,29 @@ vec2 mg_cubic_get_point(vec2 p[4], f32 t) return(r); } -void mg_cubic_split(vec2 p[4], f32 t, vec2 outLeft[4], vec2 outRight[4]) +static void oc_cubic_split(oc_vec2 p[4], f32 t, oc_vec2 outLeft[4], oc_vec2 outRight[4]) { //NOTE(martin): split bezier curve p at parameter t, using De Casteljau's algorithm // the q_n are the points along the hull's segments at parameter t // the r_n are the points along the (q_n, q_n+1) segments at parameter t // s is the split point. - vec2 q0 = {(1-t)*p[0].x + t*p[1].x, + oc_vec2 q0 = {(1-t)*p[0].x + t*p[1].x, (1-t)*p[0].y + t*p[1].y}; - vec2 q1 = {(1-t)*p[1].x + t*p[2].x, + oc_vec2 q1 = {(1-t)*p[1].x + t*p[2].x, (1-t)*p[1].y + t*p[2].y}; - vec2 q2 = {(1-t)*p[2].x + t*p[3].x, + oc_vec2 q2 = {(1-t)*p[2].x + t*p[3].x, (1-t)*p[2].y + t*p[3].y}; - vec2 r0 = {(1-t)*q0.x + t*q1.x, + oc_vec2 r0 = {(1-t)*q0.x + t*q1.x, (1-t)*q0.y + t*q1.y}; - vec2 r1 = {(1-t)*q1.x + t*q2.x, + oc_vec2 r1 = {(1-t)*q1.x + t*q2.x, (1-t)*q1.y + t*q2.y}; - vec2 s = {(1-t)*r0.x + t*r1.x, + oc_vec2 s = {(1-t)*r0.x + t*r1.x, (1-t)*r0.y + t*r1.y};; outLeft[0] = p[0]; @@ -454,65 +454,65 @@ void mg_cubic_split(vec2 p[4], f32 t, vec2 outLeft[4], vec2 outRight[4]) outRight[3] = p[3]; } -void mg_mtl_render_stroke_line(mg_mtl_canvas_backend* backend, vec2* p) +void oc_mtl_render_stroke_line(oc_mtl_canvas_backend* backend, oc_vec2* p) { f32 width = backend->primitive->attributes.width; - vec2 v = {p[1].x-p[0].x, p[1].y-p[0].y}; - vec2 n = {v.y, -v.x}; + oc_vec2 v = {p[1].x-p[0].x, p[1].y-p[0].y}; + oc_vec2 n = {v.y, -v.x}; f32 norm = sqrt(n.x*n.x + n.y*n.y); - vec2 offset = vec2_mul(0.5*width/norm, n); + oc_vec2 offset = oc_vec2_mul(0.5*width/norm, n); - vec2 left[2] = {vec2_add(p[0], offset), vec2_add(p[1], offset)}; - vec2 right[2] = {vec2_add(p[1], vec2_mul(-1, offset)), vec2_add(p[0], vec2_mul(-1, offset))}; - vec2 joint0[2] = {vec2_add(p[0], vec2_mul(-1, offset)), vec2_add(p[0], offset)}; - vec2 joint1[2] = {vec2_add(p[1], offset), vec2_add(p[1], vec2_mul(-1, offset))}; + oc_vec2 left[2] = {oc_vec2_add(p[0], offset), oc_vec2_add(p[1], offset)}; + oc_vec2 right[2] = {oc_vec2_add(p[1], oc_vec2_mul(-1, offset)), oc_vec2_add(p[0], oc_vec2_mul(-1, offset))}; + oc_vec2 joint0[2] = {oc_vec2_add(p[0], oc_vec2_mul(-1, offset)), oc_vec2_add(p[0], offset)}; + oc_vec2 joint1[2] = {oc_vec2_add(p[1], offset), oc_vec2_add(p[1], oc_vec2_mul(-1, offset))}; - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, right); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, left); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, joint0); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, joint1); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, right); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, left); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, joint0); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, joint1); } -void mg_mtl_render_stroke_quadratic(mg_mtl_canvas_backend* backend, vec2* p) +void oc_mtl_render_stroke_quadratic(oc_mtl_canvas_backend* backend, oc_vec2* p) { f32 width = backend->primitive->attributes.width; - f32 tolerance = minimum(backend->primitive->attributes.tolerance, 0.5 * width); + f32 tolerance = oc_min(backend->primitive->attributes.tolerance, 0.5 * width); //NOTE: check for degenerate line case const f32 equalEps = 1e-3; - if(vec2_close(p[0], p[1], equalEps)) + if(oc_vec2_close(p[0], p[1], equalEps)) { - mg_mtl_render_stroke_line(backend, p+1); + oc_mtl_render_stroke_line(backend, p+1); return; } - else if(vec2_close(p[1], p[2], equalEps)) + else if(oc_vec2_close(p[1], p[2], equalEps)) { - mg_mtl_render_stroke_line(backend, p); + oc_mtl_render_stroke_line(backend, p); return; } - vec2 leftHull[3]; - vec2 rightHull[3]; + oc_vec2 leftHull[3]; + oc_vec2 rightHull[3]; - if( !mg_offset_hull(3, p, leftHull, width/2) - || !mg_offset_hull(3, p, rightHull, -width/2)) + if( !oc_offset_hull(3, p, leftHull, width/2) + || !oc_offset_hull(3, p, rightHull, -width/2)) { //TODO split and recurse //NOTE: offsetting the hull failed, split the curve - vec2 splitLeft[3]; - vec2 splitRight[3]; - mg_quadratic_split(p, 0.5, splitLeft, splitRight); - mg_mtl_render_stroke_quadratic(backend, splitLeft); - mg_mtl_render_stroke_quadratic(backend, splitRight); + oc_vec2 splitLeft[3]; + oc_vec2 splitRight[3]; + oc_quadratic_split(p, 0.5, splitLeft, splitRight); + oc_mtl_render_stroke_quadratic(backend, splitLeft); + oc_mtl_render_stroke_quadratic(backend, splitRight); } else { const int CHECK_SAMPLE_COUNT = 5; f32 checkSamples[CHECK_SAMPLE_COUNT] = {1./6, 2./6, 3./6, 4./6, 5./6}; - f32 d2LowBound = Square(0.5 * width - tolerance); - f32 d2HighBound = Square(0.5 * width + tolerance); + f32 d2LowBound = oc_square(0.5 * width - tolerance); + f32 d2HighBound = oc_square(0.5 * width + tolerance); f32 maxOvershoot = 0; f32 maxOvershootParameter = 0; @@ -521,17 +521,17 @@ void mg_mtl_render_stroke_quadratic(mg_mtl_canvas_backend* backend, vec2* p) { f32 t = checkSamples[i]; - vec2 c = mg_quadratic_get_point(p, t); - vec2 cp = mg_quadratic_get_point(leftHull, t); - vec2 cn = mg_quadratic_get_point(rightHull, t); + oc_vec2 c = oc_quadratic_get_point(p, t); + oc_vec2 cp = oc_quadratic_get_point(leftHull, t); + oc_vec2 cn = oc_quadratic_get_point(rightHull, t); - f32 positiveDistSquare = Square(c.x - cp.x) + Square(c.y - cp.y); - f32 negativeDistSquare = Square(c.x - cn.x) + Square(c.y - cn.y); + f32 positiveDistSquare = oc_square(c.x - cp.x) + oc_square(c.y - cp.y); + f32 negativeDistSquare = oc_square(c.x - cn.x) + oc_square(c.y - cn.y); - f32 positiveOvershoot = maximum(positiveDistSquare - d2HighBound, d2LowBound - positiveDistSquare); - f32 negativeOvershoot = maximum(negativeDistSquare - d2HighBound, d2LowBound - negativeDistSquare); + f32 positiveOvershoot = oc_max(positiveDistSquare - d2HighBound, d2LowBound - positiveDistSquare); + f32 negativeOvershoot = oc_max(negativeDistSquare - d2HighBound, d2LowBound - negativeDistSquare); - f32 overshoot = maximum(positiveOvershoot, negativeOvershoot); + f32 overshoot = oc_max(positiveOvershoot, negativeOvershoot); if(overshoot > maxOvershoot) { @@ -542,79 +542,79 @@ void mg_mtl_render_stroke_quadratic(mg_mtl_canvas_backend* backend, vec2* p) if(maxOvershoot > 0) { - vec2 splitLeft[3]; - vec2 splitRight[3]; - mg_quadratic_split(p, maxOvershootParameter, splitLeft, splitRight); - mg_mtl_render_stroke_quadratic(backend, splitLeft); - mg_mtl_render_stroke_quadratic(backend, splitRight); + oc_vec2 splitLeft[3]; + oc_vec2 splitRight[3]; + oc_quadratic_split(p, maxOvershootParameter, splitLeft, splitRight); + oc_mtl_render_stroke_quadratic(backend, splitLeft); + oc_mtl_render_stroke_quadratic(backend, splitRight); } else { - vec2 tmp = leftHull[0]; + oc_vec2 tmp = leftHull[0]; leftHull[0] = leftHull[2]; leftHull[2] = tmp; - mg_mtl_canvas_encode_element(backend, MG_PATH_QUADRATIC, rightHull); - mg_mtl_canvas_encode_element(backend, MG_PATH_QUADRATIC, leftHull); + oc_mtl_canvas_encode_element(backend, OC_PATH_QUADRATIC, rightHull); + oc_mtl_canvas_encode_element(backend, OC_PATH_QUADRATIC, leftHull); - vec2 joint0[2] = {rightHull[2], leftHull[0]}; - vec2 joint1[2] = {leftHull[2], rightHull[0]}; - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, joint0); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, joint1); + oc_vec2 joint0[2] = {rightHull[2], leftHull[0]}; + oc_vec2 joint1[2] = {leftHull[2], rightHull[0]}; + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, joint0); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, joint1); } } } -void mg_mtl_render_stroke_cubic(mg_mtl_canvas_backend* backend, vec2* p) +void oc_mtl_render_stroke_cubic(oc_mtl_canvas_backend* backend, oc_vec2* p) { f32 width = backend->primitive->attributes.width; - f32 tolerance = minimum(backend->primitive->attributes.tolerance, 0.5 * width); + f32 tolerance = oc_min(backend->primitive->attributes.tolerance, 0.5 * width); //NOTE: check degenerate line cases f32 equalEps = 1e-3; - if( (vec2_close(p[0], p[1], equalEps) && vec2_close(p[2], p[3], equalEps)) - ||(vec2_close(p[0], p[1], equalEps) && vec2_close(p[1], p[2], equalEps)) - ||(vec2_close(p[1], p[2], equalEps) && vec2_close(p[2], p[3], equalEps))) + if( (oc_vec2_close(p[0], p[1], equalEps) && oc_vec2_close(p[2], p[3], equalEps)) + ||(oc_vec2_close(p[0], p[1], equalEps) && oc_vec2_close(p[1], p[2], equalEps)) + ||(oc_vec2_close(p[1], p[2], equalEps) && oc_vec2_close(p[2], p[3], equalEps))) { - vec2 line[2] = {p[0], p[3]}; - mg_mtl_render_stroke_line(backend, line); + oc_vec2 line[2] = {p[0], p[3]}; + oc_mtl_render_stroke_line(backend, line); return; } - else if(vec2_close(p[0], p[1], equalEps) && vec2_close(p[1], p[3], equalEps)) + else if(oc_vec2_close(p[0], p[1], equalEps) && oc_vec2_close(p[1], p[3], equalEps)) { - vec2 line[2] = {p[0], vec2_add(vec2_mul(5./9, p[0]), vec2_mul(4./9, p[2]))}; - mg_mtl_render_stroke_line(backend, line); + oc_vec2 line[2] = {p[0], oc_vec2_add(oc_vec2_mul(5./9, p[0]), oc_vec2_mul(4./9, p[2]))}; + oc_mtl_render_stroke_line(backend, line); return; } - else if(vec2_close(p[0], p[2], equalEps) && vec2_close(p[2], p[3], equalEps)) + else if(oc_vec2_close(p[0], p[2], equalEps) && oc_vec2_close(p[2], p[3], equalEps)) { - vec2 line[2] = {p[0], vec2_add(vec2_mul(5./9, p[0]), vec2_mul(4./9, p[1]))}; - mg_mtl_render_stroke_line(backend, line); + oc_vec2 line[2] = {p[0], oc_vec2_add(oc_vec2_mul(5./9, p[0]), oc_vec2_mul(4./9, p[1]))}; + oc_mtl_render_stroke_line(backend, line); return; } - vec2 leftHull[4]; - vec2 rightHull[4]; + oc_vec2 leftHull[4]; + oc_vec2 rightHull[4]; - if( !mg_offset_hull(4, p, leftHull, width/2) - || !mg_offset_hull(4, p, rightHull, -width/2)) + if( !oc_offset_hull(4, p, leftHull, width/2) + || !oc_offset_hull(4, p, rightHull, -width/2)) { //TODO split and recurse //NOTE: offsetting the hull failed, split the curve - vec2 splitLeft[4]; - vec2 splitRight[4]; - mg_cubic_split(p, 0.5, splitLeft, splitRight); - mg_mtl_render_stroke_cubic(backend, splitLeft); - mg_mtl_render_stroke_cubic(backend, splitRight); + oc_vec2 splitLeft[4]; + oc_vec2 splitRight[4]; + oc_cubic_split(p, 0.5, splitLeft, splitRight); + oc_mtl_render_stroke_cubic(backend, splitLeft); + oc_mtl_render_stroke_cubic(backend, splitRight); } else { const int CHECK_SAMPLE_COUNT = 5; f32 checkSamples[CHECK_SAMPLE_COUNT] = {1./6, 2./6, 3./6, 4./6, 5./6}; - f32 d2LowBound = Square(0.5 * width - tolerance); - f32 d2HighBound = Square(0.5 * width + tolerance); + f32 d2LowBound = oc_square(0.5 * width - tolerance); + f32 d2HighBound = oc_square(0.5 * width + tolerance); f32 maxOvershoot = 0; f32 maxOvershootParameter = 0; @@ -623,17 +623,17 @@ void mg_mtl_render_stroke_cubic(mg_mtl_canvas_backend* backend, vec2* p) { f32 t = checkSamples[i]; - vec2 c = mg_cubic_get_point(p, t); - vec2 cp = mg_cubic_get_point(leftHull, t); - vec2 cn = mg_cubic_get_point(rightHull, t); + oc_vec2 c = oc_cubic_get_point(p, t); + oc_vec2 cp = oc_cubic_get_point(leftHull, t); + oc_vec2 cn = oc_cubic_get_point(rightHull, t); - f32 positiveDistSquare = Square(c.x - cp.x) + Square(c.y - cp.y); - f32 negativeDistSquare = Square(c.x - cn.x) + Square(c.y - cn.y); + f32 positiveDistSquare = oc_square(c.x - cp.x) + oc_square(c.y - cp.y); + f32 negativeDistSquare = oc_square(c.x - cn.x) + oc_square(c.y - cn.y); - f32 positiveOvershoot = maximum(positiveDistSquare - d2HighBound, d2LowBound - positiveDistSquare); - f32 negativeOvershoot = maximum(negativeDistSquare - d2HighBound, d2LowBound - negativeDistSquare); + f32 positiveOvershoot = oc_max(positiveDistSquare - d2HighBound, d2LowBound - positiveDistSquare); + f32 negativeOvershoot = oc_max(negativeDistSquare - d2HighBound, d2LowBound - negativeDistSquare); - f32 overshoot = maximum(positiveOvershoot, negativeOvershoot); + f32 overshoot = oc_max(positiveOvershoot, negativeOvershoot); if(overshoot > maxOvershoot) { @@ -644,61 +644,61 @@ void mg_mtl_render_stroke_cubic(mg_mtl_canvas_backend* backend, vec2* p) if(maxOvershoot > 0) { - vec2 splitLeft[4]; - vec2 splitRight[4]; - mg_cubic_split(p, maxOvershootParameter, splitLeft, splitRight); - mg_mtl_render_stroke_cubic(backend, splitLeft); - mg_mtl_render_stroke_cubic(backend, splitRight); + oc_vec2 splitLeft[4]; + oc_vec2 splitRight[4]; + oc_cubic_split(p, maxOvershootParameter, splitLeft, splitRight); + oc_mtl_render_stroke_cubic(backend, splitLeft); + oc_mtl_render_stroke_cubic(backend, splitRight); } else { - vec2 tmp = leftHull[0]; + oc_vec2 tmp = leftHull[0]; leftHull[0] = leftHull[3]; leftHull[3] = tmp; tmp = leftHull[1]; leftHull[1] = leftHull[2]; leftHull[2] = tmp; - mg_mtl_canvas_encode_element(backend, MG_PATH_CUBIC, rightHull); - mg_mtl_canvas_encode_element(backend, MG_PATH_CUBIC, leftHull); + oc_mtl_canvas_encode_element(backend, OC_PATH_CUBIC, rightHull); + oc_mtl_canvas_encode_element(backend, OC_PATH_CUBIC, leftHull); - vec2 joint0[2] = {rightHull[3], leftHull[0]}; - vec2 joint1[2] = {leftHull[3], rightHull[0]}; - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, joint0); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, joint1); + oc_vec2 joint0[2] = {rightHull[3], leftHull[0]}; + oc_vec2 joint1[2] = {leftHull[3], rightHull[0]}; + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, joint0); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, joint1); } } } -void mg_mtl_render_stroke_element(mg_mtl_canvas_backend* backend, - mg_path_elt* element, - vec2 currentPoint, - vec2* startTangent, - vec2* endTangent, - vec2* endPoint) +void oc_mtl_render_stroke_element(oc_mtl_canvas_backend* backend, + oc_path_elt* element, + oc_vec2 currentPoint, + oc_vec2* startTangent, + oc_vec2* endTangent, + oc_vec2* endPoint) { - vec2 controlPoints[4] = {currentPoint, element->p[0], element->p[1], element->p[2]}; + oc_vec2 controlPoints[4] = {currentPoint, element->p[0], element->p[1], element->p[2]}; int endPointIndex = 0; switch(element->type) { - case MG_PATH_LINE: - mg_mtl_render_stroke_line(backend, controlPoints); + case OC_PATH_LINE: + oc_mtl_render_stroke_line(backend, controlPoints); endPointIndex = 1; break; - case MG_PATH_QUADRATIC: - mg_mtl_render_stroke_quadratic(backend, controlPoints); + case OC_PATH_QUADRATIC: + oc_mtl_render_stroke_quadratic(backend, controlPoints); endPointIndex = 2; break; - case MG_PATH_CUBIC: - mg_mtl_render_stroke_cubic(backend, controlPoints); + case OC_PATH_CUBIC: + oc_mtl_render_stroke_cubic(backend, controlPoints); endPointIndex = 3; break; - case MG_PATH_MOVE: - ASSERT(0, "should be unreachable"); + case OC_PATH_MOVE: + OC_ASSERT(0, "should be unreachable"); break; } @@ -710,7 +710,7 @@ void mg_mtl_render_stroke_element(mg_mtl_canvas_backend* backend, if( controlPoints[i].x != controlPoints[0].x || controlPoints[i].y != controlPoints[0].y) { - *startTangent = (vec2){.x = controlPoints[i].x - controlPoints[0].x, + *startTangent = (oc_vec2){.x = controlPoints[i].x - controlPoints[0].x, .y = controlPoints[i].y - controlPoints[0].y}; break; } @@ -722,58 +722,58 @@ void mg_mtl_render_stroke_element(mg_mtl_canvas_backend* backend, if( controlPoints[i].x != endPoint->x || controlPoints[i].y != endPoint->y) { - *endTangent = (vec2){.x = endPoint->x - controlPoints[i].x, + *endTangent = (oc_vec2){.x = endPoint->x - controlPoints[i].x, .y = endPoint->y - controlPoints[i].y}; break; } } - DEBUG_ASSERT(startTangent->x != 0 || startTangent->y != 0); + OC_DEBUG_ASSERT(startTangent->x != 0 || startTangent->y != 0); } -void mg_mtl_stroke_cap(mg_mtl_canvas_backend* backend, - vec2 p0, - vec2 direction) +void oc_mtl_stroke_cap(oc_mtl_canvas_backend* backend, + oc_vec2 p0, + oc_vec2 direction) { - mg_attributes* attributes = &backend->primitive->attributes; + oc_attributes* attributes = &backend->primitive->attributes; //NOTE(martin): compute the tangent and normal vectors (multiplied by half width) at the cap point - f32 dn = sqrt(Square(direction.x) + Square(direction.y)); + f32 dn = sqrt(oc_square(direction.x) + oc_square(direction.y)); f32 alpha = 0.5 * attributes->width/dn; - vec2 n0 = {-alpha*direction.y, + oc_vec2 n0 = {-alpha*direction.y, alpha*direction.x}; - vec2 m0 = {alpha*direction.x, + oc_vec2 m0 = {alpha*direction.x, alpha*direction.y}; - vec2 points[] = {{p0.x + n0.x, p0.y + n0.y}, + oc_vec2 points[] = {{p0.x + n0.x, p0.y + n0.y}, {p0.x + n0.x + m0.x, p0.y + n0.y + m0.y}, {p0.x - n0.x + m0.x, p0.y - n0.y + m0.y}, {p0.x - n0.x, p0.y - n0.y}, {p0.x + n0.x, p0.y + n0.y}}; - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+1); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+2); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+3); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+1); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+2); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+3); } -void mg_mtl_stroke_joint(mg_mtl_canvas_backend* backend, - vec2 p0, - vec2 t0, - vec2 t1) +void oc_mtl_stroke_joint(oc_mtl_canvas_backend* backend, + oc_vec2 p0, + oc_vec2 t0, + oc_vec2 t1) { - mg_attributes* attributes = &backend->primitive->attributes; + oc_attributes* attributes = &backend->primitive->attributes; //NOTE(martin): compute the normals at the joint point - f32 norm_t0 = sqrt(Square(t0.x) + Square(t0.y)); - f32 norm_t1 = sqrt(Square(t1.x) + Square(t1.y)); + f32 norm_t0 = sqrt(oc_square(t0.x) + oc_square(t0.y)); + f32 norm_t1 = sqrt(oc_square(t1.x) + oc_square(t1.y)); - vec2 n0 = {-t0.y, t0.x}; + oc_vec2 n0 = {-t0.y, t0.x}; n0.x /= norm_t0; n0.y /= norm_t0; - vec2 n1 = {-t1.y, t1.x}; + oc_vec2 n1 = {-t1.y, t1.x}; n1.x /= norm_t1; n1.y /= norm_t1; @@ -794,60 +794,60 @@ void mg_mtl_stroke_joint(mg_mtl_canvas_backend* backend, (this can be derived from writing the pythagoras theorems in the triangles of the joint) */ f32 halfW = 0.5 * attributes->width; - vec2 u = {n0.x + n1.x, n0.y + n1.y}; + oc_vec2 u = {n0.x + n1.x, n0.y + n1.y}; f32 uNormSquare = u.x*u.x + u.y*u.y; f32 alpha = attributes->width / uNormSquare; - vec2 v = {u.x * alpha, u.y * alpha}; + oc_vec2 v = {u.x * alpha, u.y * alpha}; - f32 excursionSquare = uNormSquare * Square(alpha - attributes->width/4); + f32 excursionSquare = uNormSquare * oc_square(alpha - attributes->width/4); - if( attributes->joint == MG_JOINT_MITER - && excursionSquare <= Square(attributes->maxJointExcursion)) + if( attributes->joint == OC_JOINT_MITER + && excursionSquare <= oc_square(attributes->maxJointExcursion)) { //NOTE(martin): add a mitter joint - vec2 points[] = {p0, + oc_vec2 points[] = {p0, {p0.x + n0.x*halfW, p0.y + n0.y*halfW}, {p0.x + v.x, p0.y + v.y}, {p0.x + n1.x*halfW, p0.y + n1.y*halfW}, p0}; - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+1); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+2); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+3); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+1); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+2); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+3); } else { //NOTE(martin): add a bevel joint - vec2 points[] = {p0, + oc_vec2 points[] = {p0, {p0.x + n0.x*halfW, p0.y + n0.y*halfW}, {p0.x + n1.x*halfW, p0.y + n1.y*halfW}, p0}; - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+1); - mg_mtl_canvas_encode_element(backend, MG_PATH_LINE, points+2); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+1); + oc_mtl_canvas_encode_element(backend, OC_PATH_LINE, points+2); } } -u32 mg_mtl_render_stroke_subpath(mg_mtl_canvas_backend* backend, - mg_path_elt* elements, - mg_path_descriptor* path, +u32 oc_mtl_render_stroke_subpath(oc_mtl_canvas_backend* backend, + oc_path_elt* elements, + oc_path_descriptor* path, u32 startIndex, - vec2 startPoint) + oc_vec2 startPoint) { u32 eltCount = path->count; - DEBUG_ASSERT(startIndex < eltCount); + OC_DEBUG_ASSERT(startIndex < eltCount); - vec2 currentPoint = startPoint; - vec2 endPoint = {0, 0}; - vec2 previousEndTangent = {0, 0}; - vec2 firstTangent = {0, 0}; - vec2 startTangent = {0, 0}; - vec2 endTangent = {0, 0}; + oc_vec2 currentPoint = startPoint; + oc_vec2 endPoint = {0, 0}; + oc_vec2 previousEndTangent = {0, 0}; + oc_vec2 firstTangent = {0, 0}; + oc_vec2 startTangent = {0, 0}; + oc_vec2 endTangent = {0, 0}; //NOTE(martin): render first element and compute first tangent - mg_mtl_render_stroke_element(backend, elements + startIndex, currentPoint, &startTangent, &endTangent, &endPoint); + oc_mtl_render_stroke_element(backend, elements + startIndex, currentPoint, &startTangent, &endTangent, &endPoint); firstTangent = startTangent; previousEndTangent = endTangent; @@ -855,18 +855,18 @@ u32 mg_mtl_render_stroke_subpath(mg_mtl_canvas_backend* backend, //NOTE(martin): render subsequent elements along with their joints - mg_attributes* attributes = &backend->primitive->attributes; + oc_attributes* attributes = &backend->primitive->attributes; u32 eltIndex = startIndex + 1; for(; - eltIndexjoint != MG_JOINT_NONE) + if(attributes->joint != OC_JOINT_NONE) { - mg_mtl_stroke_joint(backend, currentPoint, previousEndTangent, startTangent); + oc_mtl_stroke_joint(backend, currentPoint, previousEndTangent, startTangent); } previousEndTangent = endTangent; currentPoint = endPoint; @@ -878,48 +878,48 @@ u32 mg_mtl_render_stroke_subpath(mg_mtl_canvas_backend* backend, && startPoint.x == endPoint.x && startPoint.y == endPoint.y) { - if(attributes->joint != MG_JOINT_NONE) + if(attributes->joint != OC_JOINT_NONE) { //NOTE(martin): add a closing joint if the path is closed - mg_mtl_stroke_joint(backend, endPoint, endTangent, firstTangent); + oc_mtl_stroke_joint(backend, endPoint, endTangent, firstTangent); } } - else if(attributes->cap == MG_CAP_SQUARE) + else if(attributes->cap == OC_CAP_SQUARE) { //NOTE(martin): add start and end cap - mg_mtl_stroke_cap(backend, startPoint, (vec2){-startTangent.x, -startTangent.y}); - mg_mtl_stroke_cap(backend, endPoint, endTangent); + oc_mtl_stroke_cap(backend, startPoint, (oc_vec2){-startTangent.x, -startTangent.y}); + oc_mtl_stroke_cap(backend, endPoint, endTangent); } return(eltIndex); } -void mg_mtl_render_stroke(mg_mtl_canvas_backend* backend, - mg_path_elt* elements, - mg_path_descriptor* path) +void oc_mtl_render_stroke(oc_mtl_canvas_backend* backend, + oc_path_elt* elements, + oc_path_descriptor* path) { u32 eltCount = path->count; - DEBUG_ASSERT(eltCount); + OC_DEBUG_ASSERT(eltCount); - vec2 startPoint = path->startPoint; + oc_vec2 startPoint = path->startPoint; u32 startIndex = 0; while(startIndex < eltCount) { //NOTE(martin): eliminate leading moves - while(startIndex < eltCount && elements[startIndex].type == MG_PATH_MOVE) + while(startIndex < eltCount && elements[startIndex].type == OC_PATH_MOVE) { startPoint = elements[startIndex].p[0]; startIndex++; } if(startIndex < eltCount) { - startIndex = mg_mtl_render_stroke_subpath(backend, elements, path, startIndex, startPoint); + startIndex = oc_mtl_render_stroke_subpath(backend, elements, path, startIndex, startPoint); } } } -void mg_mtl_grow_buffer_if_needed(mg_mtl_canvas_backend* backend, id* buffer, u64 wantedSize) +void oc_mtl_grow_buffer_if_needed(oc_mtl_canvas_backend* backend, id* buffer, u64 wantedSize) { u64 bufferSize = [(*buffer) length]; if(bufferSize < wantedSize) @@ -940,27 +940,27 @@ void mg_mtl_grow_buffer_if_needed(mg_mtl_canvas_backend* backend, id* } } -void mg_mtl_render_batch(mg_mtl_canvas_backend* backend, - mg_mtl_surface* surface, - mg_image* images, +void oc_mtl_render_batch(oc_mtl_canvas_backend* backend, + oc_mtl_surface* surface, + oc_image* images, int tileSize, int nTilesX, int nTilesY, - vec2 viewportSize, + oc_vec2 viewportSize, f32 scale) { - int pathBufferOffset = backend->pathBatchStart * sizeof(mg_mtl_path); - int elementBufferOffset = backend->eltBatchStart * sizeof(mg_mtl_path_elt); + int pathBufferOffset = backend->pathBatchStart * sizeof(oc_mtl_path); + int elementBufferOffset = backend->eltBatchStart * sizeof(oc_mtl_path_elt); int pathCount = backend->pathCount - backend->pathBatchStart; int eltCount = backend->eltCount - backend->eltBatchStart; //NOTE: update intermediate buffers sizes if needed - mg_mtl_grow_buffer_if_needed(backend, &backend->pathQueueBuffer, pathCount * sizeof(mg_mtl_path_queue)); - mg_mtl_grow_buffer_if_needed(backend, &backend->tileQueueBuffer, backend->maxTileQueueCount * sizeof(mg_mtl_tile_queue)); - mg_mtl_grow_buffer_if_needed(backend, &backend->segmentBuffer, backend->maxSegmentCount * sizeof(mg_mtl_segment)); - mg_mtl_grow_buffer_if_needed(backend, &backend->screenTilesBuffer, nTilesX * nTilesY * sizeof(mg_mtl_screen_tile)); - mg_mtl_grow_buffer_if_needed(backend, &backend->tileOpBuffer, backend->maxSegmentCount * 30 * sizeof(mg_mtl_tile_op)); + oc_mtl_grow_buffer_if_needed(backend, &backend->pathQueueBuffer, pathCount * sizeof(oc_mtl_path_queue)); + oc_mtl_grow_buffer_if_needed(backend, &backend->tileQueueBuffer, backend->maxTileQueueCount * sizeof(oc_mtl_tile_queue)); + oc_mtl_grow_buffer_if_needed(backend, &backend->segmentBuffer, backend->maxSegmentCount * sizeof(oc_mtl_segment)); + oc_mtl_grow_buffer_if_needed(backend, &backend->screenTilesBuffer, nTilesX * nTilesY * sizeof(oc_mtl_screen_tile)); + oc_mtl_grow_buffer_if_needed(backend, &backend->tileOpBuffer, backend->maxSegmentCount * 30 * sizeof(oc_mtl_tile_op)); //NOTE: encode GPU commands @autoreleasepool @@ -990,7 +990,7 @@ void mg_mtl_render_batch(mg_mtl_canvas_backend* backend, pathEncoder.label = @"path pass"; [pathEncoder setComputePipelineState: backend->pathPipeline]; - int tileQueueMax = [backend->tileQueueBuffer length] / sizeof(mg_mtl_tile_queue); + int tileQueueMax = [backend->tileQueueBuffer length] / sizeof(oc_mtl_tile_queue); [pathEncoder setBytes:&pathCount length:sizeof(int) atIndex:0]; [pathEncoder setBuffer:backend->pathBuffer[backend->bufferIndex] offset:pathBufferOffset atIndex:1]; @@ -1012,8 +1012,8 @@ void mg_mtl_render_batch(mg_mtl_canvas_backend* backend, segmentEncoder.label = @"segment pass"; [segmentEncoder setComputePipelineState: backend->segmentPipeline]; - int tileOpMax = [backend->tileOpBuffer length] / sizeof(mg_mtl_tile_op); - int segmentMax = [backend->segmentBuffer length] / sizeof(mg_mtl_segment); + int tileOpMax = [backend->tileOpBuffer length] / sizeof(oc_mtl_tile_op); + int segmentMax = [backend->segmentBuffer length] / sizeof(oc_mtl_segment); [segmentEncoder setBytes:&eltCount length:sizeof(int) atIndex:0]; [segmentEncoder setBuffer:backend->elementBuffer[backend->bufferIndex] offset:elementBufferOffset atIndex:1]; @@ -1072,7 +1072,7 @@ void mg_mtl_render_batch(mg_mtl_canvas_backend* backend, [mergeEncoder setBuffer:backend->logOffsetBuffer[backend->bufferIndex] offset:0 atIndex:12]; MTLSize mergeGridSize = MTLSizeMake(nTilesX, nTilesY, 1); - MTLSize mergeGroupSize = MTLSizeMake(MG_MTL_TILE_SIZE, MG_MTL_TILE_SIZE, 1); + MTLSize mergeGroupSize = MTLSizeMake(OC_MTL_TILE_SIZE, OC_MTL_TILE_SIZE, 1); [mergeEncoder dispatchThreads: mergeGridSize threadsPerThreadgroup: mergeGroupSize]; [mergeEncoder endEncoding]; @@ -1094,11 +1094,11 @@ void mg_mtl_render_batch(mg_mtl_canvas_backend* backend, [rasterEncoder setTexture:backend->outTexture atIndex:0]; - for(int i=0; itexture atIndex: 1+i]; @@ -1107,7 +1107,7 @@ void mg_mtl_render_batch(mg_mtl_canvas_backend* backend, } MTLSize rasterGridSize = MTLSizeMake(viewportSize.x, viewportSize.y, 1); - MTLSize rasterGroupSize = MTLSizeMake(MG_MTL_TILE_SIZE, MG_MTL_TILE_SIZE, 1); + MTLSize rasterGroupSize = MTLSizeMake(OC_MTL_TILE_SIZE, OC_MTL_TILE_SIZE, 1); [rasterEncoder dispatchThreadgroupsWithIndirectBuffer: backend->rasterDispatchBuffer indirectBufferOffset: 0 @@ -1141,7 +1141,7 @@ void mg_mtl_render_batch(mg_mtl_canvas_backend* backend, backend->maxTileQueueCount = 0; } -void mg_mtl_canvas_resize(mg_mtl_canvas_backend* backend, vec2 size) +void oc_mtl_canvas_resize(oc_mtl_canvas_backend* backend, oc_vec2 size) { @autoreleasepool { @@ -1150,11 +1150,11 @@ void mg_mtl_canvas_resize(mg_mtl_canvas_backend* backend, vec2 size) [backend->screenTilesBuffer release]; backend->screenTilesBuffer = nil; } - int tileSize = MG_MTL_TILE_SIZE; + int tileSize = OC_MTL_TILE_SIZE; int nTilesX = (int)(size.x + tileSize - 1)/tileSize; int nTilesY = (int)(size.y + tileSize - 1)/tileSize; MTLResourceOptions bufferOptions = MTLResourceStorageModePrivate; - backend->screenTilesBuffer = [backend->surface->device newBufferWithLength: nTilesX*nTilesY*sizeof(mg_mtl_screen_tile) + backend->screenTilesBuffer = [backend->surface->device newBufferWithLength: nTilesX*nTilesY*sizeof(oc_mtl_screen_tile) options: bufferOptions]; if(backend->outTexture) @@ -1178,38 +1178,38 @@ void mg_mtl_canvas_resize(mg_mtl_canvas_backend* backend, vec2 size) } } -void mg_mtl_canvas_render(mg_canvas_backend* interface, - mg_color clearColor, +void oc_mtl_canvas_render(oc_canvas_backend* interface, + oc_color clearColor, u32 primitiveCount, - mg_primitive* primitives, + oc_primitive* primitives, u32 eltCount, - mg_path_elt* pathElements) + oc_path_elt* pathElements) { - mg_mtl_canvas_backend* backend = (mg_mtl_canvas_backend*)interface; + oc_mtl_canvas_backend* backend = (oc_mtl_canvas_backend*)interface; //NOTE: update rolling input buffers dispatch_semaphore_wait(backend->bufferSemaphore, DISPATCH_TIME_FOREVER); - backend->bufferIndex = (backend->bufferIndex + 1) % MG_MTL_INPUT_BUFFERS_COUNT; + backend->bufferIndex = (backend->bufferIndex + 1) % OC_MTL_INPUT_BUFFERS_COUNT; //NOTE: ensure screen tiles buffer is correct size - mg_mtl_surface* surface = backend->surface; + oc_mtl_surface* surface = backend->surface; - vec2 frameSize = surface->interface.getSize((mg_surface_data*)surface); + oc_vec2 frameSize = surface->interface.getSize((oc_surface_data*)surface); f32 scale = surface->mtlLayer.contentsScale; - vec2 viewportSize = {frameSize.x * scale, frameSize.y * scale}; - int tileSize = MG_MTL_TILE_SIZE; + oc_vec2 viewportSize = {frameSize.x * scale, frameSize.y * scale}; + int tileSize = OC_MTL_TILE_SIZE; int nTilesX = (int)(viewportSize.x * scale + tileSize - 1)/tileSize; int nTilesY = (int)(viewportSize.y * scale + tileSize - 1)/tileSize; if(viewportSize.x != backend->frameSize.x || viewportSize.y != backend->frameSize.y) { - mg_mtl_canvas_resize(backend, viewportSize); + oc_mtl_canvas_resize(backend, viewportSize); } //NOTE: acquire metal resources for rendering - mg_mtl_surface_acquire_command_buffer(surface); - mg_mtl_surface_acquire_drawable(surface); + oc_mtl_surface_acquire_command_buffer(surface); + oc_mtl_surface_acquire_drawable(surface); @autoreleasepool { @@ -1238,13 +1238,13 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface, backend->maxTileQueueCount = 0; //NOTE: encode and render batches - vec2 currentPos = {0}; - mg_image images[MG_MTL_MAX_IMAGES_PER_BATCH] = {0}; + oc_vec2 currentPos = {0}; + oc_image images[OC_MTL_MAX_IMAGES_PER_BATCH] = {0}; int imageCount = 0; for(int primitiveIndex = 0; primitiveIndex < primitiveCount; primitiveIndex++) { - mg_primitive* primitive = &primitives[primitiveIndex]; + oc_primitive* primitive = &primitives[primitiveIndex]; if(primitive->attributes.image.h != 0) { @@ -1258,7 +1258,7 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface, } if(backend->currentImageIndex <= 0) { - if(imageCountattributes.image; backend->currentImageIndex = imageCount; @@ -1266,7 +1266,7 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface, } else { - mg_mtl_render_batch(backend, + oc_mtl_render_batch(backend, surface, images, tileSize, @@ -1289,12 +1289,12 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface, if(primitive->path.count) { backend->primitive = primitive; - backend->pathScreenExtents = (vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; - backend->pathUserExtents = (vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; + backend->pathScreenExtents = (oc_vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; + backend->pathUserExtents = (oc_vec4){FLT_MAX, FLT_MAX, -FLT_MAX, -FLT_MAX}; - if(primitive->cmd == MG_CMD_STROKE) + if(primitive->cmd == OC_CMD_STROKE) { - mg_mtl_render_stroke(backend, pathElements + primitive->path.startIndex, &primitive->path); + oc_mtl_render_stroke(backend, pathElements + primitive->path.startIndex, &primitive->path); } else { @@ -1302,39 +1302,39 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface, (eltIndex < primitive->path.count) && (primitive->path.startIndex + eltIndex < eltCount); eltIndex++) { - mg_path_elt* elt = &pathElements[primitive->path.startIndex + eltIndex]; + oc_path_elt* elt = &pathElements[primitive->path.startIndex + eltIndex]; - if(elt->type != MG_PATH_MOVE) + if(elt->type != OC_PATH_MOVE) { - vec2 p[4] = {currentPos, elt->p[0], elt->p[1], elt->p[2]}; - mg_mtl_canvas_encode_element(backend, elt->type, p); + oc_vec2 p[4] = {currentPos, elt->p[0], elt->p[1], elt->p[2]}; + oc_mtl_canvas_encode_element(backend, elt->type, p); } switch(elt->type) { - case MG_PATH_MOVE: + case OC_PATH_MOVE: currentPos = elt->p[0]; break; - case MG_PATH_LINE: + case OC_PATH_LINE: currentPos = elt->p[0]; break; - case MG_PATH_QUADRATIC: + case OC_PATH_QUADRATIC: currentPos = elt->p[1]; break; - case MG_PATH_CUBIC: + case OC_PATH_CUBIC: currentPos = elt->p[2]; break; } } } //NOTE: encode path - mg_mtl_encode_path(backend, primitive, scale); + oc_mtl_encode_path(backend, primitive, scale); } } - mg_mtl_render_batch(backend, + oc_mtl_render_batch(backend, surface, images, tileSize, @@ -1348,15 +1348,15 @@ void mg_mtl_canvas_render(mg_canvas_backend* interface, //NOTE: finalize [surface->commandBuffer addCompletedHandler:^(id commandBuffer) { - mg_mtl_print_log(backend->bufferIndex, backend->logBuffer[backend->bufferIndex], backend->logOffsetBuffer[backend->bufferIndex]); + oc_mtl_print_log(backend->bufferIndex, backend->logBuffer[backend->bufferIndex], backend->logOffsetBuffer[backend->bufferIndex]); dispatch_semaphore_signal(backend->bufferSemaphore); }]; } } -void mg_mtl_canvas_destroy(mg_canvas_backend* interface) +void oc_mtl_canvas_destroy(oc_canvas_backend* interface) { - mg_mtl_canvas_backend* backend = (mg_mtl_canvas_backend*)interface; + oc_mtl_canvas_backend* backend = (oc_mtl_canvas_backend*)interface; @autoreleasepool { @@ -1367,7 +1367,7 @@ void mg_mtl_canvas_destroy(mg_canvas_backend* interface) [backend->rasterPipeline release]; [backend->blitPipeline release]; - for(int i=0; ipathBuffer[i] release]; [backend->elementBuffer[i] release]; @@ -1386,15 +1386,15 @@ void mg_mtl_canvas_destroy(mg_canvas_backend* interface) free(backend); } -mg_image_data* mg_mtl_canvas_image_create(mg_canvas_backend* interface, vec2 size) +oc_image_data* oc_mtl_canvas_image_create(oc_canvas_backend* interface, oc_vec2 size) { - mg_mtl_image_data* image = 0; - mg_mtl_canvas_backend* backend = (mg_mtl_canvas_backend*)interface; - mg_mtl_surface* surface = backend->surface; + oc_mtl_image_data* image = 0; + oc_mtl_canvas_backend* backend = (oc_mtl_canvas_backend*)interface; + oc_mtl_surface* surface = backend->surface; @autoreleasepool { - image = malloc_type(mg_mtl_image_data); + image = oc_malloc_type(oc_mtl_image_data); if(image) { MTLTextureDescriptor* texDesc = [[MTLTextureDescriptor alloc] init]; @@ -1418,12 +1418,12 @@ mg_image_data* mg_mtl_canvas_image_create(mg_canvas_backend* interface, vec2 siz } } } - return((mg_image_data*)image); + return((oc_image_data*)image); } -void mg_mtl_canvas_image_destroy(mg_canvas_backend* backendInterface, mg_image_data* imageInterface) +void oc_mtl_canvas_image_destroy(oc_canvas_backend* backendInterface, oc_image_data* imageInterface) { - mg_mtl_image_data* image = (mg_mtl_image_data*)imageInterface; + oc_mtl_image_data* image = (oc_mtl_image_data*)imageInterface; @autoreleasepool { [image->texture release]; @@ -1431,9 +1431,9 @@ void mg_mtl_canvas_image_destroy(mg_canvas_backend* backendInterface, mg_image_d } } -void mg_mtl_canvas_image_upload_region(mg_canvas_backend* backendInterface, mg_image_data* imageInterface, mp_rect region, u8* pixels) +void oc_mtl_canvas_image_upload_region(oc_canvas_backend* backendInterface, oc_image_data* imageInterface, oc_rect region, u8* pixels) {@autoreleasepool{ - mg_mtl_image_data* image = (mg_mtl_image_data*)imageInterface; + oc_mtl_image_data* image = (oc_mtl_image_data*)imageInterface; MTLRegion mtlRegion = MTLRegionMake2D(region.x, region.y, region.w, region.h); [image->texture replaceRegion:mtlRegion mipmapLevel:0 @@ -1441,41 +1441,41 @@ void mg_mtl_canvas_image_upload_region(mg_canvas_backend* backendInterface, mg_i bytesPerRow: 4 * region.w]; }} -const u32 MG_MTL_DEFAULT_PATH_BUFFER_LEN = (4<<10), - MG_MTL_DEFAULT_ELT_BUFFER_LEN = (4<<10), +const u32 OC_MTL_DEFAULT_PATH_BUFFER_LEN = (4<<10), + OC_MTL_DEFAULT_ELT_BUFFER_LEN = (4<<10), - MG_MTL_DEFAULT_SEGMENT_BUFFER_LEN = (4<<10), - MG_MTL_DEFAULT_PATH_QUEUE_BUFFER_LEN = (4<<10), - MG_MTL_DEFAULT_TILE_QUEUE_BUFFER_LEN = (4<<10), - MG_MTL_DEFAULT_TILE_OP_BUFFER_LEN = (4<<20); + OC_MTL_DEFAULT_SEGMENT_BUFFER_LEN = (4<<10), + OC_MTL_DEFAULT_PATH_QUEUE_BUFFER_LEN = (4<<10), + OC_MTL_DEFAULT_TILE_QUEUE_BUFFER_LEN = (4<<10), + OC_MTL_DEFAULT_TILE_OP_BUFFER_LEN = (4<<20); -mg_canvas_backend* mtl_canvas_backend_create(mg_mtl_surface* surface) +oc_canvas_backend* oc_mtl_canvas_backend_create(oc_mtl_surface* surface) { - mg_mtl_canvas_backend* backend = 0; + oc_mtl_canvas_backend* backend = 0; - backend = malloc_type(mg_mtl_canvas_backend); - memset(backend, 0, sizeof(mg_mtl_canvas_backend)); + backend = oc_malloc_type(oc_mtl_canvas_backend); + memset(backend, 0, sizeof(oc_mtl_canvas_backend)); - backend->msaaCount = MG_MTL_MSAA_COUNT; + backend->msaaCount = OC_MTL_MSAA_COUNT; backend->surface = surface; //NOTE(martin): setup interface functions - backend->interface.destroy = mg_mtl_canvas_destroy; - backend->interface.render = mg_mtl_canvas_render; - backend->interface.imageCreate = mg_mtl_canvas_image_create; - backend->interface.imageDestroy = mg_mtl_canvas_image_destroy; - backend->interface.imageUploadRegion = mg_mtl_canvas_image_upload_region; + backend->interface.destroy = oc_mtl_canvas_destroy; + backend->interface.render = oc_mtl_canvas_render; + backend->interface.imageCreate = oc_mtl_canvas_image_create; + backend->interface.imageDestroy = oc_mtl_canvas_image_destroy; + backend->interface.imageUploadRegion = oc_mtl_canvas_image_upload_region; @autoreleasepool{ //NOTE: load metal library - str8 shaderPath = path_executable_relative(mem_scratch(), STR8("mtl_renderer.metallib")); + oc_str8 shaderPath = oc_path_executable_relative(oc_scratch(), OC_STR8("mtl_renderer.metallib")); NSString* metalFileName = [[NSString alloc] initWithBytes: shaderPath.ptr length:shaderPath.len encoding: NSUTF8StringEncoding]; NSError* err = 0; id library = [surface->device newLibraryWithFile: metalFileName error:&err]; if(err != nil) { const char* errStr = [[err localizedDescription] UTF8String]; - log_error("error : %s\n", errStr); + oc_log_error("error : %s\n", errStr); return(0); } id pathFunction = [library newFunctionWithName:@"mtl_path_setup"]; @@ -1520,10 +1520,10 @@ mg_canvas_backend* mtl_canvas_backend_create(mg_mtl_surface* surface) backend->blitPipeline = [surface->device newRenderPipelineStateWithDescriptor: pipelineStateDescriptor error:&err]; //NOTE: create textures - vec2 size = surface->interface.getSize((mg_surface_data*)surface); + oc_vec2 size = surface->interface.getSize((oc_surface_data*)surface); f32 scale = surface->mtlLayer.contentsScale; - backend->frameSize = (vec2){size.x*scale, size.y*scale}; + backend->frameSize = (oc_vec2){size.x*scale, size.y*scale}; MTLTextureDescriptor* texDesc = [[MTLTextureDescriptor alloc] init]; texDesc.textureType = MTLTextureType2D; @@ -1537,38 +1537,38 @@ mg_canvas_backend* mtl_canvas_backend_create(mg_mtl_surface* surface) //NOTE: create buffers - backend->bufferSemaphore = dispatch_semaphore_create(MG_MTL_INPUT_BUFFERS_COUNT); + backend->bufferSemaphore = dispatch_semaphore_create(OC_MTL_INPUT_BUFFERS_COUNT); backend->bufferIndex = 0; MTLResourceOptions bufferOptions = MTLResourceCPUCacheModeWriteCombined | MTLResourceStorageModeShared; - for(int i=0; ipathBuffer[i] = [surface->device newBufferWithLength: MG_MTL_DEFAULT_PATH_BUFFER_LEN * sizeof(mg_mtl_path) + backend->pathBuffer[i] = [surface->device newBufferWithLength: OC_MTL_DEFAULT_PATH_BUFFER_LEN * sizeof(oc_mtl_path) options: bufferOptions]; - backend->elementBuffer[i] = [surface->device newBufferWithLength: MG_MTL_DEFAULT_ELT_BUFFER_LEN * sizeof(mg_mtl_path_elt) + backend->elementBuffer[i] = [surface->device newBufferWithLength: OC_MTL_DEFAULT_ELT_BUFFER_LEN * sizeof(oc_mtl_path_elt) options: bufferOptions]; } bufferOptions = MTLResourceStorageModePrivate; - backend->segmentBuffer = [surface->device newBufferWithLength: MG_MTL_DEFAULT_SEGMENT_BUFFER_LEN * sizeof(mg_mtl_segment) + backend->segmentBuffer = [surface->device newBufferWithLength: OC_MTL_DEFAULT_SEGMENT_BUFFER_LEN * sizeof(oc_mtl_segment) options: bufferOptions]; backend->segmentCountBuffer = [surface->device newBufferWithLength: sizeof(int) options: bufferOptions]; - backend->pathQueueBuffer = [surface->device newBufferWithLength: MG_MTL_DEFAULT_PATH_QUEUE_BUFFER_LEN * sizeof(mg_mtl_path_queue) + backend->pathQueueBuffer = [surface->device newBufferWithLength: OC_MTL_DEFAULT_PATH_QUEUE_BUFFER_LEN * sizeof(oc_mtl_path_queue) options: bufferOptions]; - backend->tileQueueBuffer = [surface->device newBufferWithLength: MG_MTL_DEFAULT_TILE_QUEUE_BUFFER_LEN * sizeof(mg_mtl_tile_queue) + backend->tileQueueBuffer = [surface->device newBufferWithLength: OC_MTL_DEFAULT_TILE_QUEUE_BUFFER_LEN * sizeof(oc_mtl_tile_queue) options: bufferOptions]; backend->tileQueueCountBuffer = [surface->device newBufferWithLength: sizeof(int) options: bufferOptions]; - backend->tileOpBuffer = [surface->device newBufferWithLength: MG_MTL_DEFAULT_TILE_OP_BUFFER_LEN * sizeof(mg_mtl_tile_op) + backend->tileOpBuffer = [surface->device newBufferWithLength: OC_MTL_DEFAULT_TILE_OP_BUFFER_LEN * sizeof(oc_mtl_tile_op) options: bufferOptions]; backend->tileOpCountBuffer = [surface->device newBufferWithLength: sizeof(int) @@ -1577,14 +1577,14 @@ mg_canvas_backend* mtl_canvas_backend_create(mg_mtl_surface* surface) backend->rasterDispatchBuffer = [surface->device newBufferWithLength: sizeof(MTLDispatchThreadgroupsIndirectArguments) options: bufferOptions]; - int tileSize = MG_MTL_TILE_SIZE; + int tileSize = OC_MTL_TILE_SIZE; int nTilesX = (int)(backend->frameSize.x + tileSize - 1)/tileSize; int nTilesY = (int)(backend->frameSize.y + tileSize - 1)/tileSize; - backend->screenTilesBuffer = [surface->device newBufferWithLength: nTilesX*nTilesY*sizeof(mg_mtl_screen_tile) + backend->screenTilesBuffer = [surface->device newBufferWithLength: nTilesX*nTilesY*sizeof(oc_mtl_screen_tile) options: bufferOptions]; bufferOptions = MTLResourceStorageModeShared; - for(int i=0; ilogBuffer[i] = [surface->device newBufferWithLength: 1<<20 options: bufferOptions]; @@ -1593,25 +1593,25 @@ mg_canvas_backend* mtl_canvas_backend_create(mg_mtl_surface* surface) options: bufferOptions]; } } - return((mg_canvas_backend*)backend); + return((oc_canvas_backend*)backend); } -mg_surface_data* mtl_canvas_surface_create_for_window(mp_window window) +oc_surface_data* oc_mtl_canvas_surface_create_for_window(oc_window window) { - mg_mtl_surface* surface = (mg_mtl_surface*)mg_mtl_surface_create_for_window(window); + oc_mtl_surface* surface = (oc_mtl_surface*)oc_mtl_surface_create_for_window(window); if(surface) { - surface->interface.backend = mtl_canvas_backend_create(surface); + surface->interface.backend = oc_mtl_canvas_backend_create(surface); if(surface->interface.backend) { - surface->interface.api = MG_CANVAS; + surface->interface.api = OC_CANVAS; } else { - surface->interface.destroy((mg_surface_data*)surface); + surface->interface.destroy((oc_surface_data*)surface); surface = 0; } } - return((mg_surface_data*)surface); + return((oc_surface_data*)surface); } diff --git a/src/graphics/mtl_renderer.metal b/src/graphics/mtl_renderer.metal index 55c9179..9ec1e95 100644 --- a/src/graphics/mtl_renderer.metal +++ b/src/graphics/mtl_renderer.metal @@ -227,16 +227,16 @@ void log_cubic_bezier(thread float2* p, mtl_log_context logCtx) } kernel void mtl_path_setup(constant int* pathCount [[buffer(0)]], - const device mg_mtl_path* pathBuffer [[buffer(1)]], - device mg_mtl_path_queue* pathQueueBuffer [[buffer(2)]], - device mg_mtl_tile_queue* tileQueueBuffer [[buffer(3)]], + const device oc_mtl_path* pathBuffer [[buffer(1)]], + device oc_mtl_path_queue* pathQueueBuffer [[buffer(2)]], + device oc_mtl_tile_queue* tileQueueBuffer [[buffer(3)]], device atomic_int* tileQueueCount [[buffer(4)]], constant int* tileQueueMax [[buffer(5)]], constant int* tileSize [[buffer(6)]], constant float* scale [[buffer(7)]], uint pathIndex [[thread_position_in_grid]]) { - const device mg_mtl_path* path = &pathBuffer[pathIndex]; + const device oc_mtl_path* path = &pathBuffer[pathIndex]; //NOTE: we don't clip on the right, since we need those tiles to accurately compute @@ -265,7 +265,7 @@ kernel void mtl_path_setup(constant int* pathCount [[buffer(0)]], pathQueueBuffer[pathIndex].area = int4(firstTile.x, firstTile.y, nTilesX, nTilesY); pathQueueBuffer[pathIndex].tileQueues = tileQueuesIndex; - device mg_mtl_tile_queue* tileQueues = &tileQueueBuffer[tileQueuesIndex]; + device oc_mtl_tile_queue* tileQueues = &tileQueueBuffer[tileQueuesIndex]; for(int i=0; i seg->box.w || p.y <= seg->box.y) @@ -290,11 +290,11 @@ int mtl_side_of_segment(float2 p, const device mg_mtl_segment* seg, mtl_log_cont { if(p.y > seg->box.w) { - side = (seg->config == MG_MTL_TL || seg->config == MG_MTL_BR)? -1 : 1; + side = (seg->config == OC_MTL_TL || seg->config == OC_MTL_BR)? -1 : 1; } else { - side = (seg->config == MG_MTL_TL || seg->config == MG_MTL_BR)? 1 : -1; + side = (seg->config == OC_MTL_TL || seg->config == OC_MTL_BR)? 1 : -1; } } } @@ -311,22 +311,22 @@ int mtl_side_of_segment(float2 p, const device mg_mtl_segment* seg, mtl_log_cont float2 a, b, c; switch(seg->config) { - case MG_MTL_TL: + case OC_MTL_TL: a = seg->box.xy; b = seg->box.zw; break; - case MG_MTL_BR: + case OC_MTL_BR: a = seg->box.zw; b = seg->box.xy; break; - case MG_MTL_TR: + case OC_MTL_TR: a = seg->box.xw; b = seg->box.zy; break; - case MG_MTL_BL: + case OC_MTL_BL: a = seg->box.zy; b = seg->box.xw; break; @@ -336,30 +336,30 @@ int mtl_side_of_segment(float2 p, const device mg_mtl_segment* seg, mtl_log_cont if(ccw(a, b, p) < 0) { // other side of the diagonal - side = (seg->config == MG_MTL_BR || seg->config == MG_MTL_TR) ? -1 : 1; + side = (seg->config == OC_MTL_BR || seg->config == OC_MTL_TR) ? -1 : 1; } else if(ccw(b, c, p) < 0 || ccw(c, a, p) < 0) { // same side of the diagonal, but outside curve hull - side = (seg->config == MG_MTL_BL || seg->config == MG_MTL_TL) ? -1 : 1; + side = (seg->config == OC_MTL_BL || seg->config == OC_MTL_TL) ? -1 : 1; } else { // inside curve hull switch(seg->kind) { - case MG_MTL_LINE: + case OC_MTL_LINE: side = 1; break; - case MG_MTL_QUADRATIC: + case OC_MTL_QUADRATIC: { float3 ph = {p.x, p.y, 1}; float3 klm = seg->implicitMatrix * ph; side = ((klm.x*klm.x - klm.y)*klm.z < 0)? -1 : 1; } break; - case MG_MTL_CUBIC: + case OC_MTL_CUBIC: { float3 ph = {p.x, p.y, 1}; float3 klm = seg->implicitMatrix * ph; @@ -375,10 +375,10 @@ int mtl_side_of_segment(float2 p, const device mg_mtl_segment* seg, mtl_log_cont typedef struct mtl_segment_setup_context { device atomic_int* segmentCount; - device mg_mtl_segment* segmentBuffer; - const device mg_mtl_path_queue* pathQueue; - device mg_mtl_tile_queue* tileQueues; - device mg_mtl_tile_op* tileOpBuffer; + device oc_mtl_segment* segmentBuffer; + const device oc_mtl_path_queue* pathQueue; + device oc_mtl_tile_queue* tileQueues; + device oc_mtl_tile_op* tileOpBuffer; device atomic_int* tileOpCount; int tileSize; mtl_log_context log; @@ -390,7 +390,7 @@ typedef struct mtl_segment_setup_context } mtl_segment_setup_context; -void mtl_segment_bin_to_tiles(thread mtl_segment_setup_context* context, device mg_mtl_segment* seg) +void mtl_segment_bin_to_tiles(thread mtl_segment_setup_context* context, device oc_mtl_segment* seg) { //NOTE: add segment index to the queues of tiles it overlaps with int segIndex = seg - context->segmentBuffer; @@ -428,7 +428,7 @@ void mtl_segment_bin_to_tiles(thread mtl_segment_setup_context* context, device bool crossB = (sbl*sbr < 0); float2 s0, s1; - if(seg->config == MG_MTL_TL||seg->config == MG_MTL_BR) + if(seg->config == OC_MTL_TL||seg->config == OC_MTL_BR) { s0 = seg->box.xy; s1 = seg->box.zw; @@ -454,15 +454,15 @@ void mtl_segment_bin_to_tiles(thread mtl_segment_setup_context* context, device if(tileOpIndex < context->tileOpMax) { - device mg_mtl_tile_op* op = &context->tileOpBuffer[tileOpIndex]; + device oc_mtl_tile_op* op = &context->tileOpBuffer[tileOpIndex]; - op->kind = MG_MTL_OP_SEGMENT; + op->kind = OC_MTL_OP_SEGMENT; op->index = segIndex; op->crossRight = false; op->next = -1; int tileIndex = y*pathArea.z + x; - device mg_mtl_tile_queue* tile = &context->tileQueues[tileIndex]; + device oc_mtl_tile_queue* tile = &context->tileQueues[tileIndex]; op->next = atomic_exchange_explicit(&tile->first, tileOpIndex, memory_order_relaxed); if(op->next == -1) { @@ -489,25 +489,25 @@ void mtl_segment_bin_to_tiles(thread mtl_segment_setup_context* context, device } } -device mg_mtl_segment* mtl_segment_push(thread mtl_segment_setup_context* context, float2 p[4], mg_mtl_seg_kind kind) +device oc_mtl_segment* mtl_segment_push(thread mtl_segment_setup_context* context, float2 p[4], oc_mtl_seg_kind kind) { float2 s, e, c; switch(kind) { - case MG_MTL_LINE: + case OC_MTL_LINE: s = p[0]; c = p[0]; e = p[1]; break; - case MG_MTL_QUADRATIC: + case OC_MTL_QUADRATIC: s = p[0]; c = p[1]; e = p[2]; break; - case MG_MTL_CUBIC: + case OC_MTL_CUBIC: { s = p[0]; float sqrNorm0 = length_squared(p[1]-p[0]); @@ -524,7 +524,7 @@ device mg_mtl_segment* mtl_segment_push(thread mtl_segment_setup_context* contex } break; } - device mg_mtl_segment* seg = 0; + device oc_mtl_segment* seg = 0; int segIndex = atomic_fetch_add_explicit(context->segmentCount, 1, memory_order_relaxed); @@ -551,32 +551,32 @@ device mg_mtl_segment* mtl_segment_push(thread mtl_segment_setup_context* contex if(goingUp == goingRight) { - if(seg->kind == MG_MTL_LINE) + if(seg->kind == OC_MTL_LINE) { - seg->config = MG_MTL_BR; + seg->config = OC_MTL_BR; } else if(dy > alpha*dx) { - seg->config = MG_MTL_TL; + seg->config = OC_MTL_TL; } else { - seg->config = MG_MTL_BR; + seg->config = OC_MTL_BR; } } else { - if(seg->kind == MG_MTL_LINE) + if(seg->kind == OC_MTL_LINE) { - seg->config = MG_MTL_TR; + seg->config = OC_MTL_TR; } else if(dy < ofs - alpha*dx) { - seg->config = MG_MTL_BL; + seg->config = OC_MTL_BL; } else { - seg->config = MG_MTL_TR; + seg->config = OC_MTL_TR; } } } @@ -588,7 +588,7 @@ device mg_mtl_segment* mtl_segment_push(thread mtl_segment_setup_context* contex void mtl_line_setup(thread mtl_segment_setup_context* context, float2 p[2]) { - device mg_mtl_segment* seg = mtl_segment_push(context, p, MG_MTL_LINE); + device oc_mtl_segment* seg = mtl_segment_push(context, p, OC_MTL_LINE); if(seg) { seg->hullVertex = p[0]; @@ -659,7 +659,7 @@ matrix_float3x3 mtl_barycentric_matrix(float2 v0, float2 v1, float2 v2) void mtl_quadratic_emit(thread mtl_segment_setup_context* context, thread float2* p) { - device mg_mtl_segment* seg = mtl_segment_push(context, p, MG_MTL_QUADRATIC); + device oc_mtl_segment* seg = mtl_segment_push(context, p, OC_MTL_QUADRATIC); if(seg) { @@ -673,7 +673,7 @@ void mtl_quadratic_emit(thread mtl_segment_setup_context* context, float e = p[1].x - p[0].x; float f = p[0].x*p[1].y - p[1].x*p[0].y; - float flip = (seg->config == MG_MTL_TL || seg->config == MG_MTL_BL)? -1 : 1; + float flip = (seg->config == OC_MTL_TL || seg->config == OC_MTL_BL)? -1 : 1; float g = flip*(p[2].x*(p[0].y - p[1].y) + p[0].x*(p[1].y - p[2].y) + p[1].x*(p[2].y - p[0].y)); seg->implicitMatrix = (1/det)*matrix_float3x3({a, d, 0.}, @@ -1070,7 +1070,7 @@ float2 mtl_select_hull_vertex(float2 p0, float2 p1, float2 p2, float2 p3, mtl_lo void mtl_cubic_emit(thread mtl_segment_setup_context* context, mtl_cubic_info curve, float2 p[4], float s0, float s1, float2 sp[4]) { - device mg_mtl_segment* seg = mtl_segment_push(context, sp, MG_MTL_CUBIC); + device oc_mtl_segment* seg = mtl_segment_push(context, sp, OC_MTL_CUBIC); if(seg) { @@ -1253,12 +1253,12 @@ void mtl_cubic_setup(thread mtl_segment_setup_context* context, float2 p[4]) } kernel void mtl_segment_setup(constant int* elementCount [[buffer(0)]], - const device mg_mtl_path_elt* elementBuffer [[buffer(1)]], + const device oc_mtl_path_elt* elementBuffer [[buffer(1)]], device atomic_int* segmentCount [[buffer(2)]], - device mg_mtl_segment* segmentBuffer [[buffer(3)]], - const device mg_mtl_path_queue* pathQueueBuffer [[buffer(4)]], - device mg_mtl_tile_queue* tileQueueBuffer [[buffer(5)]], - device mg_mtl_tile_op* tileOpBuffer [[buffer(6)]], + device oc_mtl_segment* segmentBuffer [[buffer(3)]], + const device oc_mtl_path_queue* pathQueueBuffer [[buffer(4)]], + device oc_mtl_tile_queue* tileQueueBuffer [[buffer(5)]], + device oc_mtl_tile_op* tileOpBuffer [[buffer(6)]], device atomic_int* tileOpCount [[buffer(7)]], constant int* segmentMax [[buffer(8)]], constant int* tileOpMax [[buffer(9)]], @@ -1269,9 +1269,9 @@ kernel void mtl_segment_setup(constant int* elementCount [[buffer(0)]], device atomic_int* logOffsetBuffer [[buffer(13)]], uint eltIndex [[thread_position_in_grid]]) { - const device mg_mtl_path_elt* elt = &elementBuffer[eltIndex]; - const device mg_mtl_path_queue* pathQueue = &pathQueueBuffer[elt->pathIndex]; - device mg_mtl_tile_queue* tileQueues = &tileQueueBuffer[pathQueue->tileQueues]; + const device oc_mtl_path_elt* elt = &elementBuffer[eltIndex]; + const device oc_mtl_path_queue* pathQueue = &pathQueueBuffer[elt->pathIndex]; + device oc_mtl_tile_queue* tileQueues = &tileQueueBuffer[pathQueue->tileQueues]; mtl_segment_setup_context setupCtx = {.pathIndex = elt->pathIndex, .segmentCount = segmentCount, @@ -1289,7 +1289,7 @@ kernel void mtl_segment_setup(constant int* elementCount [[buffer(0)]], switch(elt->kind) { - case MG_MTL_LINE: + case OC_MTL_LINE: { float2 p[2] = {elt->p[0]*scale[0], elt->p[1]*scale[0]}; mtl_log(setupCtx.log, "line: "); @@ -1297,7 +1297,7 @@ kernel void mtl_segment_setup(constant int* elementCount [[buffer(0)]], mtl_line_setup(&setupCtx, p); } break; - case MG_MTL_QUADRATIC: + case OC_MTL_QUADRATIC: { float2 p[3] = {elt->p[0]*scale[0], elt->p[1]*scale[0], elt->p[2]*scale[0]}; mtl_log(setupCtx.log, "quadratic: "); @@ -1305,7 +1305,7 @@ kernel void mtl_segment_setup(constant int* elementCount [[buffer(0)]], mtl_quadratic_setup(&setupCtx, p); } break; - case MG_MTL_CUBIC: + case OC_MTL_CUBIC: { float2 p[4] = {elt->p[0]*scale[0], elt->p[1]*scale[0], elt->p[2]*scale[0], elt->p[3]*scale[0]}; mtl_log(setupCtx.log, "cubic: "); @@ -1316,8 +1316,8 @@ kernel void mtl_segment_setup(constant int* elementCount [[buffer(0)]], } } -kernel void mtl_backprop(const device mg_mtl_path_queue* pathQueueBuffer [[buffer(0)]], - device mg_mtl_tile_queue* tileQueueBuffer [[buffer(1)]], +kernel void mtl_backprop(const device oc_mtl_path_queue* pathQueueBuffer [[buffer(0)]], + device oc_mtl_tile_queue* tileQueueBuffer [[buffer(1)]], device char* logBuffer [[buffer(2)]], device atomic_int* logOffsetBuffer [[buffer(3)]], uint pathIndex [[threadgroup_position_in_grid]], @@ -1333,19 +1333,19 @@ kernel void mtl_backprop(const device mg_mtl_path_queue* pathQueueBuffer [[buffe threadgroup_barrier(mem_flags::mem_threadgroup); int rowIndex = 0; - const device mg_mtl_path_queue* pathQueue = &pathQueueBuffer[pathIndex]; - device mg_mtl_tile_queue* tiles = &tileQueueBuffer[pathQueue->tileQueues]; + const device oc_mtl_path_queue* pathQueue = &pathQueueBuffer[pathIndex]; + device oc_mtl_tile_queue* tiles = &tileQueueBuffer[pathQueue->tileQueues]; int rowSize = pathQueue->area.z; int rowCount = pathQueue->area.w; rowIndex = atomic_fetch_add_explicit(&nextRowIndex, 1, memory_order_relaxed); while(rowIndex < rowCount) { - device mg_mtl_tile_queue* row = &tiles[rowIndex * rowSize]; + device oc_mtl_tile_queue* row = &tiles[rowIndex * rowSize]; int sum = 0; for(int x = rowSize-1; x >= 0; x--) { - device mg_mtl_tile_queue* tile = &row[x]; + device oc_mtl_tile_queue* tile = &row[x]; int offset = *(device int*)&tile->windingOffset; *(device int*)(&tile->windingOffset) = sum; sum += offset; @@ -1355,13 +1355,13 @@ kernel void mtl_backprop(const device mg_mtl_path_queue* pathQueueBuffer [[buffe } kernel void mtl_merge(constant int* pathCount [[buffer(0)]], - const device mg_mtl_path* pathBuffer [[buffer(1)]], - const device mg_mtl_path_queue* pathQueueBuffer [[buffer(2)]], - const device mg_mtl_tile_queue* tileQueueBuffer [[buffer(3)]], - device mg_mtl_tile_op* tileOpBuffer [[buffer(4)]], + const device oc_mtl_path* pathBuffer [[buffer(1)]], + const device oc_mtl_path_queue* pathQueueBuffer [[buffer(2)]], + const device oc_mtl_tile_queue* tileQueueBuffer [[buffer(3)]], + device oc_mtl_tile_op* tileOpBuffer [[buffer(4)]], device atomic_int* tileOpCount [[buffer(5)]], device MTLDispatchThreadgroupsIndirectArguments* dispatchBuffer [[buffer(6)]], - device mg_mtl_screen_tile* screenTilesBuffer [[buffer(7)]], + device oc_mtl_screen_tile* screenTilesBuffer [[buffer(7)]], constant int* tileOpMax [[buffer(8)]], constant int* tileSize [[buffer(9)]], constant float* scale [[buffer(10)]], @@ -1384,10 +1384,10 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], for(int pathIndex = 0; pathIndex < pathCount[0]; pathIndex++) { - const device mg_mtl_path_queue* pathQueue = &pathQueueBuffer[pathIndex]; + const device oc_mtl_path_queue* pathQueue = &pathQueueBuffer[pathIndex]; int2 pathTileCoord = tileCoord - pathQueue->area.xy; - const device mg_mtl_path* path = &pathBuffer[pathIndex]; + const device oc_mtl_path* path = &pathBuffer[pathIndex]; float xMax = min(path->box.z, path->clip.z); int tileMaxX = xMax * scale[0] / tileSize[0]; int pathTileMaxX = tileMaxX - pathQueue->area.x; @@ -1406,7 +1406,7 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], } int pathTileIndex = pathTileCoord.y * pathQueue->area.z + pathTileCoord.x; - const device mg_mtl_tile_queue* tileQueue = &tileQueueBuffer[pathQueue->tileQueues + pathTileIndex]; + const device oc_mtl_tile_queue* tileQueue = &tileQueueBuffer[pathQueue->tileQueues + pathTileIndex]; int windingOffset = atomic_load_explicit(&tileQueue->windingOffset, memory_order_relaxed); int firstOpIndex = atomic_load_explicit(&tileQueue->first, memory_order_relaxed); @@ -1435,8 +1435,8 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], return; } - device mg_mtl_tile_op* pathOp = &tileOpBuffer[pathOpIndex]; - pathOp->kind = MG_MTL_OP_CLIP_FILL; + device oc_mtl_tile_op* pathOp = &tileOpBuffer[pathOpIndex]; + pathOp->kind = OC_MTL_OP_CLIP_FILL; pathOp->next = -1; pathOp->index = pathIndex; pathOp->windingOffset = windingOffset; @@ -1448,7 +1448,7 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], && tileBox.y >= clip.y && tileBox.w < clip.w) { - pathOp->kind = MG_MTL_OP_FILL; + pathOp->kind = OC_MTL_OP_FILL; if(pathBuffer[pathIndex].color.a == 1 && pathBuffer[pathIndex].texture < 0) { @@ -1468,8 +1468,8 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], return; } - device mg_mtl_tile_op* startOp = &tileOpBuffer[startOpIndex]; - startOp->kind = MG_MTL_OP_START; + device oc_mtl_tile_op* startOp = &tileOpBuffer[startOpIndex]; + startOp->kind = OC_MTL_OP_START; startOp->next = -1; startOp->index = pathIndex; startOp->windingOffset = windingOffset; @@ -1479,7 +1479,7 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], //NOTE: chain remaining path ops to end of tile list int lastOpIndex = tileQueue->last; - device mg_mtl_tile_op* lastOp = &tileOpBuffer[lastOpIndex]; + device oc_mtl_tile_op* lastOp = &tileOpBuffer[lastOpIndex]; *nextLink = firstOpIndex; nextLink = &lastOp->next; @@ -1491,8 +1491,8 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], return; } - device mg_mtl_tile_op* endOp = &tileOpBuffer[endOpIndex]; - endOp->kind = MG_MTL_OP_END; + device oc_mtl_tile_op* endOp = &tileOpBuffer[endOpIndex]; + endOp->kind = OC_MTL_OP_END; endOp->next = -1; endOp->index = pathIndex; @@ -1503,17 +1503,17 @@ kernel void mtl_merge(constant int* pathCount [[buffer(0)]], } } -kernel void mtl_raster(const device mg_mtl_screen_tile* screenTilesBuffer [[buffer(0)]], - const device mg_mtl_tile_op* tileOpBuffer [[buffer(1)]], - const device mg_mtl_path* pathBuffer [[buffer(2)]], - const device mg_mtl_segment* segmentBuffer [[buffer(3)]], +kernel void mtl_raster(const device oc_mtl_screen_tile* screenTilesBuffer [[buffer(0)]], + const device oc_mtl_tile_op* tileOpBuffer [[buffer(1)]], + const device oc_mtl_path* pathBuffer [[buffer(2)]], + const device oc_mtl_segment* segmentBuffer [[buffer(3)]], constant int* tileSize [[buffer(4)]], constant float* scale [[buffer(5)]], constant int* sampleCountBuffer [[buffer(6)]], device char* logBuffer [[buffer(7)]], device atomic_int* logOffsetBuffer [[buffer(8)]], texture2d outTexture [[texture(0)]], - array, MG_MTL_MAX_IMAGES_PER_BATCH> srcTextures [[texture(1)]], + array, OC_MTL_MAX_IMAGES_PER_BATCH> srcTextures [[texture(1)]], uint2 threadGroupCoord [[threadgroup_position_in_grid]], uint2 localCoord [[thread_position_in_threadgroup]]) { @@ -1528,8 +1528,8 @@ kernel void mtl_raster(const device mg_mtl_screen_tile* screenTilesBuffer [[buff int opIndex = screenTilesBuffer[tileIndex].first; - const int MG_MTL_MAX_SAMPLE_COUNT = 8; - float2 sampleCoords[MG_MTL_MAX_SAMPLE_COUNT]; + const int OC_MTL_MAX_SAMPLE_COUNT = 8; + float2 sampleCoords[OC_MTL_MAX_SAMPLE_COUNT]; int sampleCount = sampleCountBuffer[0]; float2 centerCoord = float2(pixelCoord) + float2(0.5, 0.5); @@ -1551,33 +1551,33 @@ kernel void mtl_raster(const device mg_mtl_screen_tile* screenTilesBuffer [[buff sampleCoords[0] = centerCoord; } - const int MG_MTL_MAX_SRC_SAMPLE_COUNT = 4; + const int OC_MTL_MAX_SRC_SAMPLE_COUNT = 4; const int srcSampleCount = 2; - const float2 imgSampleCoords[MG_MTL_MAX_SRC_SAMPLE_COUNT] = { + const float2 imgSampleCoords[OC_MTL_MAX_SRC_SAMPLE_COUNT] = { centerCoord + float2(-0.25, 0.25), centerCoord + float2(+0.25, +0.25), centerCoord + float2(+0.25, -0.25), centerCoord + float2(-0.25, +0.25)}; float4 color = {0}; - int winding[MG_MTL_MAX_SAMPLE_COUNT] = {0}; + int winding[OC_MTL_MAX_SAMPLE_COUNT] = {0}; while(opIndex != -1) { - const device mg_mtl_tile_op* op = &tileOpBuffer[opIndex]; + const device oc_mtl_tile_op* op = &tileOpBuffer[opIndex]; int pathIndex = op->index; - if(op->kind == MG_MTL_OP_START) + if(op->kind == OC_MTL_OP_START) { for(int sampleIndex=0; sampleIndexwindingOffset; } } - else if(op->kind == MG_MTL_OP_SEGMENT) + else if(op->kind == OC_MTL_OP_SEGMENT) { - const device mg_mtl_segment* seg = &segmentBuffer[op->index]; + const device oc_mtl_segment* seg = &segmentBuffer[op->index]; for(int sampleIndex=0; sampleIndexcrossRight) { - if( (seg->config == MG_MTL_BR || seg->config == MG_MTL_TL) + if( (seg->config == OC_MTL_BR || seg->config == OC_MTL_TL) &&(sampleCoord.y > seg->box.w)) { winding[sampleIndex] += seg->windingIncrement; } - else if( (seg->config == MG_MTL_BL || seg->config == MG_MTL_TR) + else if( (seg->config == OC_MTL_BL || seg->config == OC_MTL_TR) &&(sampleCoord.y > seg->box.y)) { winding[sampleIndex] -= seg->windingIncrement; @@ -1611,7 +1611,7 @@ kernel void mtl_raster(const device mg_mtl_screen_tile* screenTilesBuffer [[buff nextColor.rgb *= nextColor.a; int textureIndex = pathBuffer[pathIndex].texture; - if(textureIndex >= 0 && textureIndex < MG_MTL_MAX_IMAGES_PER_BATCH) + if(textureIndex >= 0 && textureIndex < OC_MTL_MAX_IMAGES_PER_BATCH) { constexpr sampler smp(mip_filter::nearest, mag_filter::linear, min_filter::linear); @@ -1629,7 +1629,7 @@ kernel void mtl_raster(const device mg_mtl_screen_tile* screenTilesBuffer [[buff nextColor *= texColor; } - if(op->kind == MG_MTL_OP_FILL) + if(op->kind == OC_MTL_OP_FILL) { color = color*(1-nextColor.a) + nextColor; } @@ -1647,9 +1647,9 @@ kernel void mtl_raster(const device mg_mtl_screen_tile* screenTilesBuffer [[buff && sampleCoord.y >= clip.y && sampleCoord.y < clip.w) { - bool filled = op->kind == MG_MTL_OP_CLIP_FILL - ||(pathBuffer[pathIndex].cmd == MG_MTL_FILL && (winding[sampleIndex] & 1)) - ||(pathBuffer[pathIndex].cmd == MG_MTL_STROKE && (winding[sampleIndex] != 0)); + bool filled = op->kind == OC_MTL_OP_CLIP_FILL + ||(pathBuffer[pathIndex].cmd == OC_MTL_FILL && (winding[sampleIndex] & 1)) + ||(pathBuffer[pathIndex].cmd == OC_MTL_STROKE && (winding[sampleIndex] != 0)); if(filled) { coverage++; diff --git a/src/graphics/mtl_surface.h b/src/graphics/mtl_surface.h index ac11907..337fab7 100644 --- a/src/graphics/mtl_surface.h +++ b/src/graphics/mtl_surface.h @@ -15,12 +15,12 @@ #import #endif -mg_surface_data* mg_mtl_surface_create_for_window(mp_window window); +oc_surface_data* oc_mtl_surface_create_for_window(oc_window window); -void* mg_mtl_surface_render_encoder(mg_surface surface); -void* mg_mtl_surface_compute_encoder(mg_surface surface); -void* mg_mtl_surface_layer(mg_surface surface); -void* mg_mtl_surface_drawable(mg_surface surface); -void* mg_mtl_surface_command_buffer(mg_surface surface); +void* oc_mtl_surface_render_encoder(oc_surface surface); +void* oc_mtl_surface_compute_encoder(oc_surface surface); +void* oc_mtl_surface_layer(oc_surface surface); +void* oc_mtl_surface_drawable(oc_surface surface); +void* oc_mtl_surface_command_buffer(oc_surface surface); #endif //__MTL_SURFACE_H_ diff --git a/src/graphics/mtl_surface.m b/src/graphics/mtl_surface.m index 9b3d14c..33ef730 100644 --- a/src/graphics/mtl_surface.m +++ b/src/graphics/mtl_surface.m @@ -12,12 +12,12 @@ #include #include"graphics_surface.h" -#include"util/macro_helpers.h" +#include"util/macros.h" #include"app/osx_app.h" -typedef struct mg_mtl_surface +typedef struct oc_mtl_surface { - mg_surface_data interface; + oc_surface_data interface; // permanent mtl resources id device; @@ -28,11 +28,11 @@ typedef struct mg_mtl_surface id drawable; id commandBuffer; -} mg_mtl_surface; +} oc_mtl_surface; -void mg_mtl_surface_destroy(mg_surface_data* interface) +void oc_mtl_surface_destroy(oc_surface_data* interface) { - mg_mtl_surface* surface = (mg_mtl_surface*)interface; + oc_mtl_surface* surface = (oc_mtl_surface*)interface; @autoreleasepool { @@ -48,10 +48,10 @@ void mg_mtl_surface_destroy(mg_surface_data* interface) [surface->mtlLayer release]; [surface->device release]; } - //NOTE: we don't use mp_layer_cleanup here, because the CAMetalLayer is taken care off by the surface itself + //NOTE: we don't use oc_layer_cleanup here, because the CAMetalLayer is taken care off by the surface itself } -void mg_mtl_surface_acquire_command_buffer(mg_mtl_surface* surface) +void oc_mtl_surface_acquire_command_buffer(oc_mtl_surface* surface) { if(surface->commandBuffer == nil) { @@ -60,7 +60,7 @@ void mg_mtl_surface_acquire_command_buffer(mg_mtl_surface* surface) } } -void mg_mtl_surface_acquire_drawable(mg_mtl_surface* surface) +void oc_mtl_surface_acquire_drawable(oc_mtl_surface* surface) {@autoreleasepool{ /*WARN(martin): //TODO: we should stop trying to render if we detect that the app is in the background @@ -81,15 +81,15 @@ void mg_mtl_surface_acquire_drawable(mg_mtl_surface* surface) } }} -void mg_mtl_surface_prepare(mg_surface_data* interface) +void oc_mtl_surface_prepare(oc_surface_data* interface) { - mg_mtl_surface* surface = (mg_mtl_surface*)interface; - mg_mtl_surface_acquire_command_buffer(surface); + oc_mtl_surface* surface = (oc_mtl_surface*)interface; + oc_mtl_surface_acquire_command_buffer(surface); } -void mg_mtl_surface_present(mg_surface_data* interface) +void oc_mtl_surface_present(oc_surface_data* interface) { - mg_mtl_surface* surface = (mg_mtl_surface*)interface; + oc_mtl_surface* surface = (oc_mtl_surface*)interface; @autoreleasepool { if(surface->commandBuffer != nil) @@ -107,9 +107,9 @@ void mg_mtl_surface_present(mg_surface_data* interface) } } -void mg_mtl_surface_swap_interval(mg_surface_data* interface, int swap) +void oc_mtl_surface_swap_interval(oc_surface_data* interface, int swap) { - mg_mtl_surface* surface = (mg_mtl_surface*)interface; + oc_mtl_surface* surface = (oc_mtl_surface*)interface; @autoreleasepool { [surface->mtlLayer setDisplaySyncEnabled: (swap ? YES : NO)]; @@ -117,11 +117,11 @@ void mg_mtl_surface_swap_interval(mg_surface_data* interface, int swap) } /* -void mg_mtl_surface_set_frame(mg_surface_data* interface, mp_rect frame) +void oc_mtl_surface_set_frame(oc_surface_data* interface, oc_rect frame) { - mg_mtl_surface* surface = (mg_mtl_surface*)interface; - mg_osx_surface_set_frame(interface, frame); - vec2 scale = mg_osx_surface_contents_scaling(interface); + oc_mtl_surface* surface = (oc_mtl_surface*)interface; + oc_osx_surface_set_frame(interface, frame); + oc_vec2 scale = oc_osx_surface_contents_scaling(interface); CGRect cgFrame = {{frame.x, frame.y}, {frame.w, frame.h}}; @@ -140,29 +140,29 @@ void mg_mtl_surface_set_frame(mg_surface_data* interface, mp_rect frame) //TODO fix that according to real scaling, depending on the monitor settings -static const f32 MG_MTL_SURFACE_CONTENTS_SCALING = 2; +static const f32 OC_MTL_SURFACE_CONTENTS_SCALING = 2; //NOTE: max frames in flight (n frames being queued on the GPU while we're working on the n+1 frame). // for triple buffering, there's 2 frames being queued on the GPU while we're working on the 3rd frame -static const int MG_MTL_MAX_FRAMES_IN_FLIGHT = 2; +static const int OC_MTL_MAX_FRAMES_IN_FLIGHT = 2; -mg_surface_data* mg_mtl_surface_create_for_window(mp_window window) +oc_surface_data* oc_mtl_surface_create_for_window(oc_window window) { - mg_mtl_surface* surface = 0; - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_mtl_surface* surface = 0; + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { - surface = (mg_mtl_surface*)malloc(sizeof(mg_mtl_surface)); + surface = (oc_mtl_surface*)malloc(sizeof(oc_mtl_surface)); - mg_surface_init_for_window((mg_surface_data*)surface, windowData); + oc_surface_init_for_window((oc_surface_data*)surface, windowData); //NOTE(martin): setup interface functions - surface->interface.api = MG_METAL; - surface->interface.destroy = mg_mtl_surface_destroy; - surface->interface.prepare = mg_mtl_surface_prepare; + surface->interface.api = OC_METAL; + surface->interface.destroy = oc_mtl_surface_destroy; + surface->interface.prepare = oc_mtl_surface_prepare; surface->interface.deselect = 0; - surface->interface.present = mg_mtl_surface_present; - surface->interface.swapInterval = mg_mtl_surface_swap_interval; + surface->interface.present = oc_mtl_surface_present; + surface->interface.swapInterval = oc_mtl_surface_swap_interval; @autoreleasepool { @@ -191,7 +191,7 @@ mg_surface_data* mg_mtl_surface_create_for_window(mp_window window) } if(surface->device == nil) { - log_warning("Couldn't select a discrete GPU, using first available device\n"); + oc_log_warning("Couldn't select a discrete GPU, using first available device\n"); surface->device = devices[0]; } @@ -212,10 +212,10 @@ mg_surface_data* mg_mtl_surface_create_for_window(mp_window window) NSRect frame = [[windowData->osx.nsWindow contentView] frame]; CGSize size = frame.size; surface->mtlLayer.frame = (CGRect){{0, 0}, size}; - size.width *= MG_MTL_SURFACE_CONTENTS_SCALING; - size.height *= MG_MTL_SURFACE_CONTENTS_SCALING; + size.width *= OC_MTL_SURFACE_CONTENTS_SCALING; + size.height *= OC_MTL_SURFACE_CONTENTS_SCALING; surface->mtlLayer.drawableSize = size; - surface->mtlLayer.contentsScale = MG_MTL_SURFACE_CONTENTS_SCALING; + surface->mtlLayer.contentsScale = OC_MTL_SURFACE_CONTENTS_SCALING; surface->mtlLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; @@ -234,15 +234,15 @@ mg_surface_data* mg_mtl_surface_create_for_window(mp_window window) surface->commandBuffer = nil; } } - return((mg_surface_data*)surface); + return((oc_surface_data*)surface); } -void* mg_mtl_surface_layer(mg_surface surface) +void* oc_mtl_surface_layer(oc_surface surface) { - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); - if(surfaceData && surfaceData->api == MG_METAL) + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); + if(surfaceData && surfaceData->api == OC_METAL) { - mg_mtl_surface* mtlSurface = (mg_mtl_surface*)surfaceData; + oc_mtl_surface* mtlSurface = (oc_mtl_surface*)surfaceData; return(mtlSurface->mtlLayer); } else @@ -251,13 +251,13 @@ void* mg_mtl_surface_layer(mg_surface surface) } } -void* mg_mtl_surface_drawable(mg_surface surface) +void* oc_mtl_surface_drawable(oc_surface surface) { - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); - if(surfaceData && surfaceData->api == MG_METAL) + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); + if(surfaceData && surfaceData->api == OC_METAL) { - mg_mtl_surface* mtlSurface = (mg_mtl_surface*)surfaceData; - mg_mtl_surface_acquire_drawable(mtlSurface); + oc_mtl_surface* mtlSurface = (oc_mtl_surface*)surfaceData; + oc_mtl_surface_acquire_drawable(mtlSurface); return(mtlSurface->drawable); } else @@ -266,13 +266,13 @@ void* mg_mtl_surface_drawable(mg_surface surface) } } -void* mg_mtl_surface_command_buffer(mg_surface surface) +void* oc_mtl_surface_command_buffer(oc_surface surface) { - mg_surface_data* surfaceData = mg_surface_data_from_handle(surface); - if(surfaceData && surfaceData->api == MG_METAL) + oc_surface_data* surfaceData = oc_surface_data_from_handle(surface); + if(surfaceData && surfaceData->api == OC_METAL) { - mg_mtl_surface* mtlSurface = (mg_mtl_surface*)surfaceData; - mg_mtl_surface_acquire_command_buffer(mtlSurface); + oc_mtl_surface* mtlSurface = (oc_mtl_surface*)surfaceData; + oc_mtl_surface_acquire_command_buffer(mtlSurface); return(mtlSurface->commandBuffer); } else diff --git a/src/graphics/wgl_surface.c b/src/graphics/wgl_surface.c index 912b760..b12060c 100644 --- a/src/graphics/wgl_surface.c +++ b/src/graphics/wgl_surface.c @@ -11,42 +11,42 @@ #include"gl_loader.h" #include -#include"util/macro_helpers.h" +#include"util/macros.h" -#define WGL_PROC_LIST \ - WGL_PROC(WGLCHOOSEPIXELFORMATARB, wglChoosePixelFormatARB) \ - WGL_PROC(WGLCREATECONTEXTATTRIBSARB, wglCreateContextAttribsARB) \ - WGL_PROC(WGLMAKECONTEXTCURRENTARB, wglMakeContextCurrentARB) \ - WGL_PROC(WGLSWAPINTERVALEXT, wglSwapIntervalEXT) \ +#define OC_WGL_PROC_LIST \ + OC_WGL_PROC(WGLCHOOSEPIXELFORMATARB, wglChoosePixelFormatARB) \ + OC_WGL_PROC(WGLCREATECONTEXTATTRIBSARB, wglCreateContextAttribsARB) \ + OC_WGL_PROC(WGLMAKECONTEXTCURRENTARB, wglMakeContextCurrentARB) \ + OC_WGL_PROC(WGLSWAPINTERVALEXT, wglSwapIntervalEXT) \ //NOTE: wgl function pointers declarations -#define WGL_PROC(type, name) _cat3_(PFN, type, PROC) name = 0; - WGL_PROC_LIST -#undef WGL_PROC +#define OC_WGL_PROC(type, name) OC_CAT3(PFN, type, PROC) name = 0; + OC_WGL_PROC_LIST +#undef OC_WGL_PROC //NOTE: wgl loader -typedef struct wgl_dummy_context +typedef struct oc_wgl_dummy_context { bool init; HWND hWnd; HDC hDC; HGLRC glContext; -} wgl_dummy_context; +} oc_wgl_dummy_context; -static wgl_dummy_context __mgWGLDummyContext = {0}; +static oc_wgl_dummy_context oc_wglDummyContext = {0}; -static void wgl_init() +static void oc_wgl_init() { - if(!__mgWGLDummyContext.init) + if(!oc_wglDummyContext.init) { //NOTE: create a dummy window WNDCLASS windowClass = {.style = CS_OWNDC, .lpfnWndProc = DefWindowProc, .hInstance = GetModuleHandleW(NULL), - .lpszClassName = "wgl_helper_window_class", + .lpszClassName = "oc_wgl_helper_window_class", .hCursor = LoadCursor(0, IDC_ARROW)}; if(!RegisterClass(&windowClass)) @@ -55,18 +55,18 @@ static void wgl_init() goto quit; } - __mgWGLDummyContext.hWnd = CreateWindow("wgl_helper_window_class", + oc_wglDummyContext.hWnd = CreateWindow("oc_wgl_helper_window_class", "dummy", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, windowClass.hInstance, 0); - if(!__mgWGLDummyContext.hWnd) + if(!oc_wglDummyContext.hWnd) { //TODO: error goto quit; } - __mgWGLDummyContext.hDC = GetDC(__mgWGLDummyContext.hWnd); + oc_wglDummyContext.hDC = GetDC(oc_wglDummyContext.hWnd); PIXELFORMATDESCRIPTOR pixelFormatDesc = { @@ -88,44 +88,44 @@ static void wgl_init() 0, 0, 0 }; - int pixelFormat = ChoosePixelFormat(__mgWGLDummyContext.hDC, &pixelFormatDesc); - SetPixelFormat(__mgWGLDummyContext.hDC, pixelFormat, &pixelFormatDesc); + int pixelFormat = ChoosePixelFormat(oc_wglDummyContext.hDC, &pixelFormatDesc); + SetPixelFormat(oc_wglDummyContext.hDC, pixelFormat, &pixelFormatDesc); - __mgWGLDummyContext.glContext = wglCreateContext(__mgWGLDummyContext.hDC); - wglMakeCurrent(__mgWGLDummyContext.hDC, __mgWGLDummyContext.glContext); + oc_wglDummyContext.glContext = wglCreateContext(oc_wglDummyContext.hDC); + wglMakeCurrent(oc_wglDummyContext.hDC, oc_wglDummyContext.glContext); //NOTE(martin): now load WGL extension functions - #define WGL_PROC(type, name) name = (_cat3_(PFN, type, PROC))wglGetProcAddress( #name ); - WGL_PROC_LIST - #undef WGL_PROC + #define OC_WGL_PROC(type, name) name = (OC_CAT3(PFN, type, PROC))wglGetProcAddress( #name ); + OC_WGL_PROC_LIST + #undef OC_WGL_PROC - __mgWGLDummyContext.init = true; + oc_wglDummyContext.init = true; } else { - wglMakeCurrent(__mgWGLDummyContext.hDC, __mgWGLDummyContext.glContext); + wglMakeCurrent(oc_wglDummyContext.hDC, oc_wglDummyContext.glContext); } quit:; } -#undef WGL_PROC_LIST +#undef OC_WGL_PROC_LIST -typedef struct mg_wgl_surface +typedef struct oc_wgl_surface { - mg_surface_data interface; + oc_surface_data interface; HDC hDC; HGLRC glContext; //NOTE: this may be a bit wasteful to have one api struct per surface, but win32 docs says that loading procs // from different contexts might select different implementations (eg. depending on context version/pixel format) - mg_gl_api api; -} mg_wgl_surface; + oc_gl_api api; +} oc_wgl_surface; -void mg_wgl_surface_destroy(mg_surface_data* interface) +void oc_wgl_surface_destroy(oc_surface_data* interface) { - mg_wgl_surface* surface = (mg_wgl_surface*)interface; + oc_wgl_surface* surface = (oc_wgl_surface*)interface; if(surface->glContext == wglGetCurrentContext()) { @@ -133,39 +133,39 @@ void mg_wgl_surface_destroy(mg_surface_data* interface) } wglDeleteContext(surface->glContext); - mg_surface_cleanup(interface); + oc_surface_cleanup(interface); free(surface); } -void mg_wgl_surface_prepare(mg_surface_data* interface) +void oc_wgl_surface_prepare(oc_surface_data* interface) { - mg_wgl_surface* surface = (mg_wgl_surface*)interface; + oc_wgl_surface* surface = (oc_wgl_surface*)interface; wglMakeCurrent(surface->hDC, surface->glContext); - mg_gl_select_api(&surface->api); + oc_gl_select_api(&surface->api); } -void mg_wgl_surface_present(mg_surface_data* interface) +void oc_wgl_surface_present(oc_surface_data* interface) { - mg_wgl_surface* surface = (mg_wgl_surface*)interface; + oc_wgl_surface* surface = (oc_wgl_surface*)interface; SwapBuffers(surface->hDC); } -void mg_wgl_surface_deselect(mg_surface_data* interface) +void oc_wgl_surface_deselect(oc_surface_data* interface) { wglMakeCurrent(NULL, NULL); - mg_gl_deselect_api(); + oc_gl_deselect_api(); } -void mg_wgl_surface_swap_interval(mg_surface_data* interface, int swap) +void oc_wgl_surface_swap_interval(oc_surface_data* interface, int swap) { - mg_wgl_surface* surface = (mg_wgl_surface*)interface; + oc_wgl_surface* surface = (oc_wgl_surface*)interface; wglSwapIntervalEXT(swap); } -void* mg_wgl_get_proc(const char* name) +void* oc_wgl_get_proc(const char* name) { void* p = wglGetProcAddress(name); if( p == 0 @@ -181,28 +181,28 @@ void* mg_wgl_get_proc(const char* name) return(p); } -mg_surface_data* mg_wgl_surface_create_for_window(mp_window window) +oc_surface_data* oc_wgl_surface_create_for_window(oc_window window) { - mg_wgl_surface* surface = 0; + oc_wgl_surface* surface = 0; - mp_window_data* windowData = mp_window_ptr_from_handle(window); + oc_window_data* windowData = oc_window_ptr_from_handle(window); if(windowData) { - wgl_init(); + oc_wgl_init(); //NOTE: fill surface data and load api - surface = malloc_type(mg_wgl_surface); + surface = oc_malloc_type(oc_wgl_surface); if(surface) { - memset(surface, 0, sizeof(mg_wgl_surface)); - mg_surface_init_for_window((mg_surface_data*)surface, windowData); + memset(surface, 0, sizeof(oc_wgl_surface)); + oc_surface_init_for_window((oc_surface_data*)surface, windowData); - surface->interface.api = MG_GL; - surface->interface.destroy = mg_wgl_surface_destroy; - surface->interface.prepare = mg_wgl_surface_prepare; - surface->interface.present = mg_wgl_surface_present; - surface->interface.swapInterval = mg_wgl_surface_swap_interval; - surface->interface.deselect = mg_wgl_surface_deselect; + surface->interface.api = OC_GL; + surface->interface.destroy = oc_wgl_surface_destroy; + surface->interface.prepare = oc_wgl_surface_prepare; + surface->interface.present = oc_wgl_surface_present; + surface->interface.swapInterval = oc_wgl_surface_swap_interval; + surface->interface.deselect = oc_wgl_surface_deselect; surface->hDC = GetDC(surface->interface.layer.hWnd); @@ -259,7 +259,7 @@ mg_surface_data* mg_wgl_surface_create_for_window(mp_window window) WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, 0}; - surface->glContext = wglCreateContextAttribsARB(surface->hDC, __mgWGLDummyContext.glContext, contextAttrs); + surface->glContext = wglCreateContextAttribsARB(surface->hDC, oc_wglDummyContext.glContext, contextAttrs); if(!surface->glContext) { @@ -271,8 +271,8 @@ mg_surface_data* mg_wgl_surface_create_for_window(mp_window window) //NOTE: make gl context current and load api wglMakeCurrent(surface->hDC, surface->glContext); wglSwapIntervalEXT(1); - mg_gl_load_gl44(&surface->api, mg_wgl_get_proc); + oc_gl_load_gl44(&surface->api, oc_wgl_get_proc); } } - return((mg_surface_data*)surface); + return((oc_surface_data*)surface); } diff --git a/src/graphics/wgl_surface.h b/src/graphics/wgl_surface.h index ea53d51..fb7333c 100644 --- a/src/graphics/wgl_surface.h +++ b/src/graphics/wgl_surface.h @@ -11,6 +11,6 @@ #include"graphics_surface.h" -mg_surface_data* mg_wgl_surface_create_for_window(mp_window window); +oc_surface_data* oc_wgl_surface_create_for_window(oc_window window); #endif // __WIN32_GL_SURFACE_H_ diff --git a/src/libc-shim/include/assert.h b/src/libc-shim/include/assert.h index 3d75295..39fe22a 100644 --- a/src/libc-shim/include/assert.h +++ b/src/libc-shim/include/assert.h @@ -6,7 +6,7 @@ #ifdef NDEBUG #define assert(x) (void)0 #else -#define assert(x) ASSERT(x) +#define assert(x) OC_ASSERT(x) #endif #if __STDC_VERSION__ >= 201112L && !defined(__cplusplus) diff --git a/src/libc-shim/include/stdlib.h b/src/libc-shim/include/stdlib.h index 530ff44..eeceafe 100644 --- a/src/libc-shim/include/stdlib.h +++ b/src/libc-shim/include/stdlib.h @@ -5,7 +5,7 @@ extern "C" { #endif -#define abort(...) ORCA_ABORT(__VA_ARGS__) +#define abort(...) OC_ABORT(__VA_ARGS__) int abs (int); diff --git a/src/orca.c b/src/orca.c index 571f519..3fbde0d 100644 --- a/src/orca.c +++ b/src/orca.c @@ -12,7 +12,7 @@ //--------------------------------------------------------------- #include"platform/platform.h" -#if PLATFORM_WINDOWS +#if OC_PLATFORM_WINDOWS #include"platform/native_debug.c" #include"platform/win32_memory.c" #include"platform/win32_clock.c" @@ -21,7 +21,7 @@ #include"platform/win32_io.c" #include"platform/win32_thread.c" //TODO -#elif PLATFORM_MACOS +#elif OC_PLATFORM_MACOS #include"platform/native_debug.c" #include"platform/unix_memory.c" #include"platform/osx_clock.c" @@ -43,7 +43,7 @@ #include"platform/unix_rng.c" #include"platform/posix_socket.c" */ -#elif PLATFORM_ORCA +#elif OC_PLATFORM_ORCA #include"platform/orca_debug.c" #include"platform/orca_clock.c" #include"platform/orca_memory.c" @@ -62,35 +62,36 @@ #include"util/utf8.c" #include"util/hash.c" #include"util/ringbuffer.c" +#include"util/algebra.c" //--------------------------------------------------------------- // app/graphics layer //--------------------------------------------------------------- -#if PLATFORM_WINDOWS +#if OC_PLATFORM_WINDOWS #include"app/win32_app.c" #include"graphics/graphics_common.c" #include"graphics/graphics_surface.c" - #if MG_COMPILE_GL || MG_COMPILE_GLES + #if OC_COMPILE_GL || OC_COMPILE_GLES #include"graphics/gl_loader.c" #endif - #if MG_COMPILE_GL + #if OC_COMPILE_GL #include"graphics/wgl_surface.c" #endif - #if MG_COMPILE_CANVAS + #if OC_COMPILE_CANVAS #include"graphics/gl_canvas.c" #endif - #if MG_COMPILE_GLES + #if OC_COMPILE_GLES #include"graphics/egl_surface.c" #endif -#elif PLATFORM_MACOS +#elif OC_PLATFORM_MACOS //NOTE: macos application layer and graphics backends are defined in orca.m -#elif PLATFORM_ORCA +#elif OC_PLATFORM_ORCA #include"app/orca_app.c" #include"graphics/graphics_common.c" #include"graphics/orca_surface_stubs.c" diff --git a/src/orca.h b/src/orca.h index 4aa5109..3b29235 100644 --- a/src/orca.h +++ b/src/orca.h @@ -10,39 +10,40 @@ #define __ORCA_H_ #include"util/typedefs.h" -#include"util/macro_helpers.h" +#include"util/macros.h" #include"util/debug.h" #include"util/lists.h" #include"util/memory.h" #include"util/strings.h" #include"util/utf8.h" #include"util/hash.h" +#include"util/algebra.h" #include"platform/platform.h" #include"platform/platform_clock.h" #include"platform/platform_path.h" #include"platform/platform_io.h" -#if !defined(PLATFORM_ORCA) || !(PLATFORM_ORCA) +#if !defined(OC_PLATFORM_ORCA) || !(OC_PLATFORM_ORCA) #include"platform/platform_thread.h" #endif -#include"app/mp_app.h" +#include"app/app.h" //---------------------------------------------------------------- // graphics //---------------------------------------------------------------- #include"graphics/graphics.h" -#if PLATFORM_ORCA +#if OC_PLATFORM_ORCA //TODO: maybe make this conditional #include"graphics/orca_gl31.h" - mg_surface mg_surface_canvas(); - mg_surface mg_surface_gles(); + oc_surface oc_surface_canvas(); + oc_surface oc_surface_gles(); #else - #ifdef MG_INCLUDE_GL_API + #ifdef OC_INCLUDE_GL_API #include"graphics/gl_api.h" #endif #endif diff --git a/src/orca.m b/src/orca.m index ef58b91..484774f 100644 --- a/src/orca.m +++ b/src/orca.m @@ -12,15 +12,15 @@ #include"graphics/graphics_common.c" #include"graphics/graphics_surface.c" -#if MG_COMPILE_METAL +#if OC_COMPILE_METAL #include"graphics/mtl_surface.m" #endif -#if MG_COMPILE_CANVAS +#if OC_COMPILE_CANVAS #include"graphics/mtl_renderer.m" #endif -#if MG_COMPILE_GLES +#if OC_COMPILE_GLES #include"graphics/gl_loader.c" #include"graphics/egl_surface.c" #endif diff --git a/src/platform/linux_clock.c b/src/platform/linux_clock.c deleted file mode 100644 index d6c1367..0000000 --- a/src/platform/linux_clock.c +++ /dev/null @@ -1,193 +0,0 @@ -/************************************************************//** -* -* @file: linux_clock.c -* @author: Martin Fouilleul -* @date: 20/04/2020 -* @revision: -* -*****************************************************************/ - -#include //fabs() -#include -#include // gettimeofday() - -#include -#include - -#include // nanosleep() - -#include"platform_rng.h" -#include"platform_clock.h" - -extern "C" { - -//TODO(martin): measure the actual values of these constants -const f64 SYSTEM_FUZZ = 25e-9, // minimum time to read the clock (s) - SYSTEM_TICK = 25e-9; // minimum step between two clock readings (s) - -static u64 __initialTimestamp__ = 0; -static u64 __initialMonotonicNanoseconds__ = 0; - -static inline u64 LinuxGetMonotonicNanoseconds() -{ - timespec ts; - clock_gettime(CLOCK_MONOTONIC_RAW, &ts); - //WARN(martin): do not multiply ts.tv_sec directly (implicit conversion will overflow) - u64 r = ts.tv_sec; - r *= 1000000000; - r += ts.tv_nsec; - return(r); -} - -static inline u64 LinuxGetUptimeNanoseconds() -{ - timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - //WARN(martin): do not multiply ts.tv_sec directly (implicit conversion will overflow) - u64 r = ts.tv_sec; - r *= 1000000000; - r += ts.tv_nsec; - return(r); -} - - -void ClockSystemInit() -{ - //NOTE(martin): we don't know of a widely supported way of getting the boot time on linux, so - // we fallback to our second best choice, which is taking an initial timestamp and - // the initial monotonic time now - - timeval tv; - gettimeofday(&tv, 0); - __initialMonotonicNanoseconds__ = LinuxGetMonotonicNanoseconds(); - - //NOTE(martin): convert boot date to timestamp - __initialTimestamp__ = (((u64)tv.tv_sec + JAN_1970) << 32) - + (u64)(tv.tv_usec * 1e-6 * TIMESTAMPS_PER_SECOND); - - //TODO(martin): maybe get a state vector for exclusive clock usage ? - RandomSeedFromDevice(); -} - -fx_timestamp ClockGetTimestamp(clock_kind clock) -{ - fx_timestamp ts = {0}; - switch(clock) - { - case SYS_CLOCK_MONOTONIC: - { - //NOTE(martin): compute monotonic offset and add it to bootup timestamp - u64 noff = LinuxGetMonotonicNanoseconds() - __initialMonotonicNanoseconds__; - u64 foff = (u64)(noff * 1e-9 * TIMESTAMPS_PER_SECOND); - ts.ts = __initialTimestamp__ + foff; - } break; - - case SYS_CLOCK_UPTIME: - { - //TODO(martin): maybe we should warn that this date is inconsistent after a sleep ? - //NOTE(martin): compute uptime offset and add it to bootup timestamp - u64 noff = LinuxGetUptimeNanoseconds() - __initialMonotonicNanoseconds__ ; - u64 foff = (u64)(noff * 1e-9 * TIMESTAMPS_PER_SECOND); - ts.ts = __initialTimestamp__ + foff; - } break; - - case SYS_CLOCK_DATE: - { - //NOTE(martin): get system date and convert it to a fixed-point timestamp - timeval tv; - gettimeofday(&tv, 0); - ts.ts = (((u64)tv.tv_sec + JAN_1970) << 32) - + (u64)(tv.tv_usec * 1e-6 * TIMESTAMPS_PER_SECOND); - } break; - } - - //NOTE(martin): add a random fuzz between 0 and 1 times the system fuzz - f64 fuzz = RandomU32()/(f64)(~(0UL)) * SYSTEM_FUZZ; - fx_timediff tdfuzz = TimediffFromSeconds(fuzz); - ts = TimestampAdd(ts, tdfuzz); - //TODO(martin): ensure that we always return a value greater than the last value - - return(ts); -} - - -f64 ClockGetTime(clock_kind clock) -{ - switch(clock) - { - case SYS_CLOCK_MONOTONIC: - { - //NOTE(martin): compute monotonic offset and add it to bootup timestamp - u64 noff = LinuxGetMonotonicNanoseconds(); - return((f64)noff * 1e-9); - } break; - - case SYS_CLOCK_UPTIME: - { - //TODO(martin): maybe we should warn that this date is inconsistent after a sleep ? - //NOTE(martin): compute uptime offset and add it to bootup timestamp - u64 noff = LinuxGetUptimeNanoseconds(); - return((f64)noff * 1e-9); - } break; - - case SYS_CLOCK_DATE: - { - //TODO(martin): maybe warn about precision loss ? - // could also change the epoch since we only promise to return a relative time - //NOTE(martin): get system date and convert it to seconds - timeval tv; - gettimeofday(&tv, 0); - return(((f64)tv.tv_sec + JAN_1970) + ((f64)tv.tv_usec * 1e-6)); - } break; - } - return(0); -} - -void ClockSleepNanoseconds(u64 nanoseconds) -{ - timespec rqtp; - rqtp.tv_sec = nanoseconds / 1000000000; - rqtp.tv_nsec = nanoseconds - rqtp.tv_sec * 1000000000; - nanosleep(&rqtp, 0); -} - - - -//////////////////////////////////////////////////////////////////// -//TODO: update these functions for various clocks besides monotonic -//////////////////////////////////////////////////////////////////// -f64 ClockGetGranularity(clock_kind clock) -{ - u64 minDiff = ~(0ULL); - - const int GRANULARITY_NUM_ITERATION = 100000; - for(int i=0; i -#include"app/mp_app.h" +#include"app/app.h" #include"platform_debug.c" //---------------------------------------------------------------- // Logging //---------------------------------------------------------------- -#if PLATFORM_WINDOWS +#if OC_PLATFORM_WINDOWS #include #define isatty _isatty #define fileno _fileno -#elif PLATFORM_MACOS || PLATFORM_LINUX +#elif OC_PLATFORM_MACOS || PLATFORM_LINUX #include #endif -static const char* LOG_HEADINGS[LOG_LEVEL_COUNT] = { +static const char* OC_LOG_HEADINGS[OC_LOG_LEVEL_COUNT] = { "Error", "Warning", "Info"}; -static const char* LOG_FORMATS[LOG_LEVEL_COUNT] = { +static const char* OC_LOG_FORMATS[OC_LOG_LEVEL_COUNT] = { "\033[38;5;9m\033[1m", "\033[38;5;13m\033[1m", "\033[38;5;10m\033[1m"}; -static const char* LOG_FORMAT_STOP = "\033[m"; +static const char* OC_LOG_FORMAT_STOP = "\033[m"; -typedef struct log_output +typedef struct oc_log_output { FILE* f; -} log_output; +} oc_log_output; -static log_output _logDefaultOutput = {0}; -log_output* LOG_DEFAULT_OUTPUT = &_logDefaultOutput; +static oc_log_output oc_logDefaultOutput = {0}; +oc_log_output* OC_LOG_DEFAULT_OUTPUT = &oc_logDefaultOutput; -void platform_log_push(log_output* output, - log_level level, +void platform_log_push(oc_log_output* output, + oc_log_level level, const char* file, const char* function, int line, const char* fmt, va_list ap) { - if(output == LOG_DEFAULT_OUTPUT && output->f == 0) + if(output == OC_LOG_DEFAULT_OUTPUT && output->f == 0) { output->f = stdout; } @@ -59,9 +59,9 @@ void platform_log_push(log_output* output, { fprintf(output->f, "%s%s:%s %s() in %s:%i: ", - LOG_FORMATS[level], - LOG_HEADINGS[level], - LOG_FORMAT_STOP, + OC_LOG_FORMATS[level], + OC_LOG_HEADINGS[level], + OC_LOG_FORMAT_STOP, function, file, line); @@ -70,7 +70,7 @@ void platform_log_push(log_output* output, { fprintf(output->f, "%s: %s() in %s:%i: ", - LOG_HEADINGS[level], + OC_LOG_HEADINGS[level], function, file, line); @@ -82,16 +82,16 @@ void platform_log_push(log_output* output, // Assert/Abort //---------------------------------------------------------------- -_Noreturn void orca_abort(const char* file, const char* function, int line, const char* fmt, ...) +_Noreturn void oc_abort_ext(const char* file, const char* function, int line, const char* fmt, ...) { - mem_arena* scratch = mem_scratch(); + oc_arena* scratch = oc_scratch(); va_list ap; va_start(ap, fmt); - str8 note = str8_pushfv(scratch, fmt, ap); + oc_str8 note = oc_str8_pushfv(scratch, fmt, ap); va_end(ap); - str8 msg = str8_pushf(scratch, + oc_str8 msg = oc_str8_pushf(scratch, "Fatal error in function %s() in file \"%s\", line %i:\n%.*s\n", function, file, @@ -99,38 +99,40 @@ _Noreturn void orca_abort(const char* file, const char* function, int line, cons (int)note.len, note.ptr); - const char* msgCStr = str8_to_cstring(scratch, msg); - log_error(msgCStr); + oc_log_error(msg.ptr); - const char* options[] = {"OK"}; - mp_alert_popup("Fatal Error", msgCStr, 1, options); + oc_str8_list options = {0}; + oc_str8_list_push(scratch, &options, OC_STR8("OK")); + + oc_alert_popup(OC_STR8("Fatal Error"), msg, options); //TODO: could terminate more gracefully? exit(-1); } -_Noreturn void orca_assert_fail(const char* file, const char* function, int line, const char* src, const char* fmt, ...) +_Noreturn void oc_assert_fail(const char* file, const char* function, int line, const char* src, const char* fmt, ...) { - mem_arena* scratch = mem_scratch(); + oc_arena* scratch = oc_scratch(); va_list ap; va_start(ap, fmt); - str8 note = str8_pushfv(scratch, fmt, ap); + oc_str8 note = oc_str8_pushfv(scratch, fmt, ap); va_end(ap); - str8 msg = str8_pushf(scratch, + oc_str8 msg = oc_str8_pushf(scratch, "Assertion failed in function %s() in file \"%s\", line %i:\n%s\nNote: %.*s\n", function, file, line, src, - str8_ip(note)); + oc_str8_ip(note)); - const char* msgCStr = str8_to_cstring(scratch, msg); - log_error(msgCStr); + oc_log_error(msg.ptr); - const char* options[] = {"OK"}; - mp_alert_popup("Assertion Failed", msgCStr, 1, options); + oc_str8_list options = {0}; + oc_str8_list_push(scratch, &options, OC_STR8("OK")); + + oc_alert_popup(OC_STR8("Assertion Failed"), msg, options); //TODO: could terminate more gracefully? exit(-1); diff --git a/src/platform/orca_clock.c b/src/platform/orca_clock.c index a93599d..e066ee4 100644 --- a/src/platform/orca_clock.c +++ b/src/platform/orca_clock.c @@ -1,4 +1,4 @@ #include"util/typedefs.h" #include"platform_clock.h" -f64 ORCA_IMPORT(mp_get_time)(mp_clock_kind clock); +f64 ORCA_IMPORT(oc_clock_time)(oc_clock_kind clock); diff --git a/src/platform/orca_debug.c b/src/platform/orca_debug.c index d4b69a7..d4a1b56 100644 --- a/src/platform/orca_debug.c +++ b/src/platform/orca_debug.c @@ -15,18 +15,18 @@ // stb sprintf callback and user struct //---------------------------------------------------------------- -typedef struct orca_stbsp_context +typedef struct oc_stbsp_context { - mem_arena* arena; - str8_list list; -} orca_stbsp_context; + oc_arena* arena; + oc_str8_list list; +} oc_stbsp_context; -char* orca_stbsp_callback(char const* buf, void* user, int len) +char* oc_stbsp_callback(char const* buf, void* user, int len) { - orca_stbsp_context* ctx = (orca_stbsp_context*)user; + oc_stbsp_context* ctx = (oc_stbsp_context*)user; - str8 string = str8_push_buffer(ctx->arena, len, (char*)buf); - str8_list_push(ctx->arena, &ctx->list, string); + oc_str8 string = oc_str8_push_buffer(ctx->arena, len, (char*)buf); + oc_str8_list_push(ctx->arena, &ctx->list, string); return((char*)buf); } @@ -39,18 +39,18 @@ typedef enum { ORCA_LOG_OUTPUT_CONSOLE, ORCA_LOG_OUTPUT_FILE -} orca_log_output_kind; +} oc_log_output_kind; -typedef struct log_output +typedef struct oc_log_output { - orca_log_output_kind kind; + oc_log_output_kind kind; //TODO: file output -} log_output; +} oc_log_output; -static log_output _logDefaultOutput = {.kind = ORCA_LOG_OUTPUT_CONSOLE}; -log_output* LOG_DEFAULT_OUTPUT = &_logDefaultOutput; +static oc_log_output oc_logDefaultOutput = {.kind = ORCA_LOG_OUTPUT_CONSOLE}; +oc_log_output* OC_LOG_DEFAULT_OUTPUT = &oc_logDefaultOutput; -void ORCA_IMPORT(orca_log)(log_level level, +void ORCA_IMPORT(oc_runtime_log)(oc_log_level level, int fileLen, const char* file, int functionLen, @@ -59,42 +59,42 @@ void ORCA_IMPORT(orca_log)(log_level level, int msgLen, const char* msg); -void platform_log_push(log_output* output, - log_level level, +void platform_log_push(oc_log_output* output, + oc_log_level level, const char* file, const char* function, int line, const char* fmt, va_list ap) { - mem_arena* scratch = mem_scratch(); - mem_arena_scope tmp = mem_arena_scope_begin(scratch); + oc_arena* scratch = oc_scratch(); + oc_arena_scope tmp = oc_arena_scope_begin(scratch); - orca_stbsp_context ctx = {.arena = scratch, + oc_stbsp_context ctx = {.arena = scratch, .list = {0}}; char buf[STB_SPRINTF_MIN]; - stbsp_vsprintfcb(orca_stbsp_callback, &ctx, buf, fmt, ap); + stbsp_vsprintfcb(oc_stbsp_callback, &ctx, buf, fmt, ap); - str8 string = str8_list_join(scratch, ctx.list); + oc_str8 string = oc_str8_list_join(scratch, ctx.list); - orca_log(level, strlen(file), file, strlen(function), function, line, str8_ip(string)); + oc_runtime_log(level, strlen(file), file, strlen(function), function, line, oc_str8_ip(string)); - mem_arena_scope_end(tmp); + oc_arena_scope_end(tmp); } //---------------------------------------------------------------- // Assert/Abort //---------------------------------------------------------------- -_Noreturn void ORCA_IMPORT(orca_runtime_abort)(const char* file, const char* function, int line, const char* msg); -_Noreturn void ORCA_IMPORT(orca_runtime_assert_fail)(const char* file, const char* function, int line, const char* src, const char* msg); +_Noreturn void ORCA_IMPORT(oc_runtime_abort_ext)(const char* file, const char* function, int line, const char* msg); +_Noreturn void ORCA_IMPORT(oc_runtime_assert_fail)(const char* file, const char* function, int line, const char* src, const char* msg); -_Noreturn void orca_abort(const char* file, const char* function, int line, const char* fmt, ...) +_Noreturn void oc_abort_ext(const char* file, const char* function, int line, const char* fmt, ...) { - mem_arena_scope scratch = mem_scratch_begin(); + oc_arena_scope scratch = oc_scratch_begin(); - orca_stbsp_context ctx = { + oc_stbsp_context ctx = { .arena = scratch.arena, .list = {0} }; @@ -103,22 +103,22 @@ _Noreturn void orca_abort(const char* file, const char* function, int line, cons va_start(ap, fmt); char buf[STB_SPRINTF_MIN]; - stbsp_vsprintfcb(orca_stbsp_callback, &ctx, buf, fmt, ap); + stbsp_vsprintfcb(oc_stbsp_callback, &ctx, buf, fmt, ap); va_end(ap); - str8 msg = str8_list_join(scratch.arena, ctx.list); + oc_str8 msg = oc_str8_list_join(scratch.arena, ctx.list); - orca_runtime_abort(file, function, line, msg.ptr); + oc_runtime_abort_ext(file, function, line, msg.ptr); - mem_scratch_end(scratch); + oc_scratch_end(scratch); } -_Noreturn void orca_assert_fail(const char* file, const char* function, int line, const char* src, const char* fmt, ...) +_Noreturn void oc_assert_fail(const char* file, const char* function, int line, const char* src, const char* fmt, ...) { - mem_arena_scope scratch = mem_scratch_begin(); + oc_arena_scope scratch = oc_scratch_begin(); - orca_stbsp_context ctx = { + oc_stbsp_context ctx = { .arena = scratch.arena, .list = {0} }; @@ -127,13 +127,13 @@ _Noreturn void orca_assert_fail(const char* file, const char* function, int line va_start(ap, fmt); char buf[STB_SPRINTF_MIN]; - stbsp_vsprintfcb(orca_stbsp_callback, &ctx, buf, fmt, ap); + stbsp_vsprintfcb(oc_stbsp_callback, &ctx, buf, fmt, ap); va_end(ap); - str8 msg = str8_list_join(scratch.arena, ctx.list); + oc_str8 msg = oc_str8_list_join(scratch.arena, ctx.list); - orca_runtime_assert_fail(file, function, line, src, msg.ptr); + oc_runtime_assert_fail(file, function, line, src, msg.ptr); - mem_scratch_end(scratch); + oc_scratch_end(scratch); } diff --git a/src/platform/orca_malloc.c b/src/platform/orca_malloc.c index 1d5ed59..ded90f6 100644 --- a/src/platform/orca_malloc.c +++ b/src/platform/orca_malloc.c @@ -6,8 +6,8 @@ #define LACKS_UNISTD_H #define LACKS_SYS_PARAM_H -extern void* orca_mem_grow(u64 size); -#define MORECORE orca_mem_grow +extern void* oc_mem_grow(u64 size); +#define MORECORE oc_mem_grow #define MORECORE_CONTIGUOUS 0 /* This is a version (aka dlmalloc) of malloc/free/realloc written by @@ -5485,7 +5485,7 @@ History: * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing memory allocation routines * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) - * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to + * Use 'assert' rather than 'OC_ASSERT' in WIN32 code to conform to usage of 'assert' in non-WIN32 code * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to avoid infinite loop diff --git a/src/platform/orca_memory.c b/src/platform/orca_memory.c index 7152ee9..0ef9dbd 100644 --- a/src/platform/orca_memory.c +++ b/src/platform/orca_memory.c @@ -8,24 +8,24 @@ #include"platform_memory.h" -void* ORCA_IMPORT(orca_mem_grow)(u64 size); +void* ORCA_IMPORT(oc_mem_grow)(u64 size); -void* orca_mem_base_reserve(mem_base_allocator* context, u64 size) +void* orca_oc_base_reserve(oc_base_allocator* context, u64 size) { - return(orca_mem_grow(size)); + return(oc_mem_grow(size)); } -void orca_mem_base_nop(mem_base_allocator* context, void* ptr, u64 size) {} +void orca_oc_base_nop(oc_base_allocator* context, void* ptr, u64 size) {} -mem_base_allocator* mem_base_allocator_default() +oc_base_allocator* oc_base_allocator_default() { - static mem_base_allocator base = {0}; + static oc_base_allocator base = {0}; if(base.reserve == 0) { - base.reserve = orca_mem_base_reserve; - base.commit = orca_mem_base_nop; - base.decommit = orca_mem_base_nop; - base.release = orca_mem_base_nop; + base.reserve = orca_oc_base_reserve; + base.commit = orca_oc_base_nop; + base.decommit = orca_oc_base_nop; + base.release = orca_oc_base_nop; } return(&base); } diff --git a/src/platform/osx_clock.c b/src/platform/osx_clock.c index f27fdcd..b29f89d 100644 --- a/src/platform/osx_clock.c +++ b/src/platform/osx_clock.c @@ -18,8 +18,6 @@ #include #include -#include // nanosleep() - #include"platform_clock.h" @@ -27,8 +25,8 @@ typedef struct timeval timeval; typedef struct timespec timespec; //TODO(martin): measure the actual values of these constants -const f64 SYSTEM_FUZZ = 25e-9, // minimum time to read the clock (s) - SYSTEM_TICK = 25e-9; // minimum step between two clock readings (s) +const f64 OC_CLOCK_FUZZ = 25e-9, // minimum time to read the clock (s) + OC_CLOCK_TICK = 25e-9; // minimum step between two clock readings (s) static mach_timebase_info_data_t __machTimeBase__ = {1,1}; static u64 __initialTimestamp__ = 0; @@ -45,9 +43,9 @@ static inline u64 OSXGetUptimeNanoseconds() static inline u64 OSXGetMonotonicNanoseconds() { - //NOTE(martin): according to the documentation, MP_CLOCK_MONOTONIC increment monotonically - // on systems where MP_CLOCK_MONOTONIC_RAW is present, we may want to use that instead, - // because MP_CLOCK_MONOTONIC seems to be subject to frequency changes ? + //NOTE(martin): according to the documentation, OC_CLOCK_MONOTONIC increment monotonically + // on systems where OC_CLOCK_MONOTONIC_RAW is present, we may want to use that instead, + // because OC_CLOCK_MONOTONIC seems to be subject to frequency changes ? #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 #ifndef CLOCK_MONOTONIC_RAW @@ -65,7 +63,7 @@ static inline u64 OSXGetMonotonicNanoseconds() static const f64 CLK_TIMESTAMPS_PER_SECOND = 4294967296.; // 2^32 as a double static const u64 CLK_JAN_1970 = 2208988800ULL; // seconds from january 1900 to january 1970 -void mp_clock_init() +void oc_clock_init() { mach_timebase_info(&__machTimeBase__); @@ -78,7 +76,7 @@ void mp_clock_init() if(sysctl(mib, 2, &tv, &size, 0, 0) == -1) { - log_error("can't read boot time\n"); + oc_log_error("can't read boot time\n"); } //NOTE(martin): convert boot date to timestamp __initialTimestamp__ = (((u64)tv.tv_sec + CLK_JAN_1970) << 32) @@ -88,12 +86,12 @@ void mp_clock_init() //RandomSeedFromDevice(); } -u64 mp_get_timestamp(mp_clock_kind clock) +u64 oc_clock_timestamp(oc_clock_kind clock) { u64 ts = 0; switch(clock) { - case MP_CLOCK_MONOTONIC: + case OC_CLOCK_MONOTONIC: { //NOTE(martin): compute monotonic offset and add it to bootup timestamp u64 noff = OSXGetMonotonicNanoseconds() ; @@ -101,7 +99,7 @@ u64 mp_get_timestamp(mp_clock_kind clock) ts = __initialTimestamp__ + foff; } break; - case MP_CLOCK_UPTIME: + case OC_CLOCK_UPTIME: { //TODO(martin): maybe we should warn that this date is inconsistent after a sleep ? //NOTE(martin): compute uptime offset and add it to bootup timestamp @@ -110,7 +108,7 @@ u64 mp_get_timestamp(mp_clock_kind clock) ts = __initialTimestamp__ + foff; } break; - case MP_CLOCK_DATE: + case OC_CLOCK_DATE: { //NOTE(martin): get system date and convert it to a fixed-point timestamp timeval tv; @@ -123,7 +121,7 @@ u64 mp_get_timestamp(mp_clock_kind clock) /* //NOTE(martin): add a random fuzz between 0 and 1 times the system fuzz //TODO(martin): ensure that we always return a value greater than the last value - f64 fuzz = RandomU32()/(f64)(~(0UL)) * SYSTEM_FUZZ; + f64 fuzz = RandomU32()/(f64)(~(0UL)) * OC_CLOCK_FUZZ; ts_timediff tdfuzz = TimediffFromSeconds(fuzz); ts = TimestampAdd(ts, tdfuzz); */ @@ -132,18 +130,18 @@ u64 mp_get_timestamp(mp_clock_kind clock) } -f64 mp_get_time(mp_clock_kind clock) +f64 oc_clock_time(oc_clock_kind clock) { switch(clock) { - case MP_CLOCK_MONOTONIC: + case OC_CLOCK_MONOTONIC: { //NOTE(martin): compute monotonic offset and add it to bootup timestamp u64 noff = OSXGetMonotonicNanoseconds(); return((f64)noff * 1e-9); } break; - case MP_CLOCK_UPTIME: + case OC_CLOCK_UPTIME: { //TODO(martin): maybe we should warn that this date is inconsistent after a sleep ? //NOTE(martin): compute uptime offset and add it to bootup timestamp @@ -151,7 +149,7 @@ f64 mp_get_time(mp_clock_kind clock) return((f64)noff * 1e-9); } break; - case MP_CLOCK_DATE: + case OC_CLOCK_DATE: { //TODO(martin): maybe warn about precision loss ? // could also change the epoch since we only promise to return a relative time @@ -162,11 +160,3 @@ f64 mp_get_time(mp_clock_kind clock) } break; } } - -void mp_sleep_nanoseconds(u64 nanoseconds) -{ - timespec rqtp; - rqtp.tv_sec = nanoseconds / 1000000000; - rqtp.tv_nsec = nanoseconds - rqtp.tv_sec * 1000000000; - nanosleep(&rqtp, 0); -} diff --git a/src/platform/osx_path.m b/src/platform/osx_path.m index 28c7eb4..ad5740c 100644 --- a/src/platform/osx_path.m +++ b/src/platform/osx_path.m @@ -12,33 +12,33 @@ #include"platform_path.c" -bool path_is_absolute(str8 path) +bool oc_path_is_absolute(oc_str8 path) { return(path.len && (path.ptr[0] == '/')); } -str8 path_executable(mem_arena* arena) +oc_str8 oc_path_executable(oc_arena* arena) {@autoreleasepool{ - str8 result = {}; + oc_str8 result = {}; u32 size = 0; _NSGetExecutablePath(0, &size); result.len = size; - result.ptr = mem_arena_alloc_array(arena, char, result.len+1); + result.ptr = oc_arena_push_array(arena, char, result.len+1); _NSGetExecutablePath(result.ptr, &size); result.ptr[result.len] = '\0'; return(result); }} -str8 path_canonical(mem_arena* arena, str8 path) +oc_str8 oc_path_canonical(oc_arena* arena, oc_str8 path) { - mem_arena_scope scratch = mem_scratch_begin_next(arena); - char* pathCString = str8_to_cstring(scratch.arena, path); + oc_arena_scope scratch = oc_scratch_begin_next(arena); + char* pathCString = oc_str8_to_cstring(scratch.arena, path); char* real = realpath(pathCString, 0); - str8 result = str8_push_cstring(arena, real); + oc_str8 result = oc_str8_push_cstring(arena, real); free(real); - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(result); } diff --git a/src/platform/platform.h b/src/platform/platform.h index ce19777..3fce607 100644 --- a/src/platform/platform.h +++ b/src/platform/platform.h @@ -14,17 +14,17 @@ // Compiler identification //----------------------------------------------------------------- #if defined(__clang__) - #define COMPILER_CLANG 1 + #define OC_COMPILER_CLANG 1 #if defined(__apple_build_version__) - #define COMPILER_CLANG_APPLE 1 + #define OC_COMPILER_CLANG_APPLE 1 #elif defined(_MSC_VER) - #define COMPILER_CLANG_CL 1 + #define OC_COMPILER_CLANG_CL 1 #endif #elif defined(_MSC_VER) - #define COMPILER_CL 1 + #define OC_COMPILER_CL 1 #elif defined(__GNUC__) - #define COMPILER_GCC 1 + #define OC_COMPILER_GCC 1 #else #error "Can't identify compiler" #endif @@ -33,15 +33,15 @@ // OS identification //----------------------------------------------------------------- #if defined(_WIN64) - #define PLATFORM_WINDOWS 1 + #define OC_PLATFORM_WINDOWS 1 #elif defined(_WIN32) #error "Unsupported OS (32bit only version of Windows)" #elif defined(__APPLE__) && defined(__MACH__) - #define PLATFORM_MACOS 1 + #define OC_PLATFORM_MACOS 1 #elif defined(__gnu_linux__) #define PLATFORM_LINUX 1 #elif defined(__ORCA__) - #define PLATFORM_ORCA 1 + #define OC_PLATFORM_ORCA 1 #else #error "Can't identify platform" #endif @@ -49,29 +49,29 @@ //----------------------------------------------------------------- // Architecture identification //----------------------------------------------------------------- -#if defined(COMPILER_CL) +#if defined(OC_COMPILER_CL) #if defined(_M_AMD64) - #define ARCH_X64 1 + #define OC_ARCH_X64 1 #elif defined(_M_I86) - #define ARCH_X86 1 + #define OC_ARCH_X86 1 #elif defined(_M_ARM64) - #define ARCH_ARM64 1 + #define OC_ARCH_ARM64 1 #elif defined(_M_ARM) - #define ARCH_ARM32 1 + #define OC_ARCH_ARM32 1 #else #error "Can't identify architecture" #endif #else #if defined(__x86_64__) - #define ARCH_X64 1 + #define OC_ARCH_X64 1 #elif defined(__i386__) - #define ARCH_X86 1 + #define OC_ARCH_X86 1 #elif defined(__arm__) - #define ARCH_ARM32 1 + #define OC_ARCH_ARM32 1 #elif defined(__aarch64__) - #define ARCH_ARM64 1 + #define OC_ARCH_ARM64 1 #elif defined(__ORCA__) - #define ARCH_WASM 1 + #define OC_ARCH_WASM32 1 #else #error "Can't identify architecture" #endif @@ -80,28 +80,28 @@ //----------------------------------------------------------------- // platform helper macros //----------------------------------------------------------------- -#if defined(COMPILER_CL) - #if defined(MP_BUILD_DLL) - #define MP_API __declspec(dllexport) +#if defined(OC_COMPILER_CL) + #if defined(OC_BUILD_DLL) + #define ORCA_API __declspec(dllexport) #else - #define MP_API __declspec(dllimport) + #define ORCA_API __declspec(dllimport) #endif -#elif defined(COMPILER_GCC) || defined(COMPILER_CLANG) - #define MP_API +#elif defined(OC_COMPILER_GCC) || defined(OC_COMPILER_CLANG) + #define ORCA_API #endif -#if PLATFORM_ORCA - #define mp_thread_local // no tls (or threads) for now on wasm orca -#elif defined(COMPILER_CL) - #define mp_thread_local __declspec(thread) -#elif defined(COMPILER_GCC) || defined(COMPILER_CLANG) - #define mp_thread_local __thread +#if OC_PLATFORM_ORCA + #define oc_thread_local // no tls (or threads) for now on wasm orca +#elif defined(OC_COMPILER_CL) + #define oc_thread_local __declspec(thread) +#elif defined(OC_COMPILER_GCC) || defined(OC_COMPILER_CLANG) + #define oc_thread_local __thread #endif -#if PLATFORM_ORCA +#if OC_PLATFORM_ORCA #define ORCA_IMPORT(f) __attribute__((import_name(#f))) f - #if COMPILER_CLANG + #if OC_COMPILER_CLANG #define ORCA_EXPORT __attribute__((visibility("default"))) #else #error "Orca apps can only be compiled with clang for now" diff --git a/src/platform/platform_clock.h b/src/platform/platform_clock.h index 98fba1d..0ef8b9b 100644 --- a/src/platform/platform_clock.h +++ b/src/platform/platform_clock.h @@ -17,15 +17,14 @@ extern "C" { #endif // __cplusplus typedef enum { - MP_CLOCK_MONOTONIC, // clock that increment monotonically - MP_CLOCK_UPTIME, // clock that increment monotonically during uptime - MP_CLOCK_DATE // clock that is driven by the platform time -} mp_clock_kind; + OC_CLOCK_MONOTONIC, // clock that increment monotonically + OC_CLOCK_UPTIME, // clock that increment monotonically during uptime + OC_CLOCK_DATE // clock that is driven by the platform time +} oc_clock_kind; -MP_API void mp_clock_init(); // initialize the clock subsystem -MP_API u64 mp_get_timestamp(mp_clock_kind clock); -MP_API f64 mp_get_time(mp_clock_kind clock); -MP_API void mp_sleep_nanoseconds(u64 nanoseconds); // sleep for a given number of nanoseconds +ORCA_API void oc_clock_init(); // initialize the clock subsystem +ORCA_API u64 oc_clock_timestamp(oc_clock_kind clock); +ORCA_API f64 oc_clock_time(oc_clock_kind clock); #ifdef __cplusplus } // extern "C" diff --git a/src/platform/platform_debug.c b/src/platform/platform_debug.c index 9456338..99dda95 100644 --- a/src/platform/platform_debug.c +++ b/src/platform/platform_debug.c @@ -7,34 +7,34 @@ *****************************************************************/ #include"platform_debug.h" -typedef struct log_config +typedef struct oc_log_config { - log_output* output; - log_level level; -} log_config; + oc_log_output* output; + oc_log_level level; +} oc_log_config; -//TODO: make default output a compile-time constant to avoid check in log_push()? -static log_config __logConfig = {0, LOG_LEVEL_INFO}; +//TODO: make default output a compile-time constant to avoid check in oc_log_ext()? +static oc_log_config __logConfig = {0, OC_LOG_LEVEL_INFO}; -void log_set_output(log_output* output) +void oc_log_set_output(oc_log_output* output) { __logConfig.output = output; } -void log_set_level(log_level level) +void oc_log_set_level(oc_log_level level) { __logConfig.level = level; } -void platform_log_push(log_output* output, - log_level level, +void platform_log_push(oc_log_output* output, + oc_log_level level, const char* file, const char* function, int line, const char* fmt, va_list ap); -void log_push(log_level level, +void oc_log_ext(oc_log_level level, const char* function, const char* file, int line, @@ -43,7 +43,7 @@ void log_push(log_level level, { if(!__logConfig.output) { - __logConfig.output = LOG_DEFAULT_OUTPUT; + __logConfig.output = OC_LOG_DEFAULT_OUTPUT; } if(level <= __logConfig.level) diff --git a/src/platform/platform_debug.h b/src/platform/platform_debug.h index ce795bb..1b81fd0 100644 --- a/src/platform/platform_debug.h +++ b/src/platform/platform_debug.h @@ -14,30 +14,30 @@ // Assert / Abort //---------------------------------------------------------------- -MP_API _Noreturn void orca_abort(const char* file, const char* function, int line, const char* fmt, ...); -MP_API _Noreturn void orca_assert_fail(const char* file, const char* function, int line, const char* src, const char* fmt, ...); +ORCA_API _Noreturn void oc_abort_ext(const char* file, const char* function, int line, const char* fmt, ...); +ORCA_API _Noreturn void oc_assert_fail(const char* file, const char* function, int line, const char* src, const char* fmt, ...); //---------------------------------------------------------------- // Logging //---------------------------------------------------------------- -typedef enum { LOG_LEVEL_ERROR, - LOG_LEVEL_WARNING, - LOG_LEVEL_INFO, - LOG_LEVEL_COUNT } log_level; +typedef enum { OC_LOG_LEVEL_ERROR, + OC_LOG_LEVEL_WARNING, + OC_LOG_LEVEL_INFO, + OC_LOG_LEVEL_COUNT } oc_log_level; -typedef struct log_output log_output; +typedef struct oc_log_output oc_log_output; -extern log_output* LOG_DEFAULT_OUTPUT; +extern oc_log_output* OC_LOG_DEFAULT_OUTPUT; -MP_API void log_set_level(log_level level); -MP_API void log_set_output(log_output* output); -MP_API void log_push(log_level level, - const char* function, - const char* file, - int line, - const char* fmt, - ...); +ORCA_API void oc_log_set_level(oc_log_level level); +ORCA_API void oc_log_set_output(oc_log_output* output); +ORCA_API void oc_log_ext(oc_log_level level, + const char* function, + const char* file, + int line, + const char* fmt, + ...); #endif //__PLATFORM_DEBUG_H_ diff --git a/src/platform/platform_io.h b/src/platform/platform_io.h index 6b7eb07..e92ac5e 100644 --- a/src/platform/platform_io.h +++ b/src/platform/platform_io.h @@ -15,56 +15,56 @@ // IO API //---------------------------------------------------------------- -typedef struct { u64 h; } file_handle; +typedef struct { u64 h; } oc_file; -typedef u16 file_open_flags; -enum _file_open_flags +typedef u16 oc_file_open_flags; +enum oc_file_open_flags_enum { - FILE_OPEN_NONE = 0, - FILE_OPEN_APPEND = 1<<1, - FILE_OPEN_TRUNCATE = 1<<2, - FILE_OPEN_CREATE = 1<<3, + OC_FILE_OPEN_NONE = 0, + OC_FILE_OPEN_APPEND = 1<<1, + OC_FILE_OPEN_TRUNCATE = 1<<2, + OC_FILE_OPEN_CREATE = 1<<3, - FILE_OPEN_SYMLINK = 1<<4, - FILE_OPEN_NO_FOLLOW = 1<<5, - FILE_OPEN_RESTRICT = 1<<6, + OC_FILE_OPEN_SYMLINK = 1<<4, + OC_FILE_OPEN_NO_FOLLOW = 1<<5, + OC_FILE_OPEN_RESTRICT = 1<<6, //... }; -typedef u16 file_access_rights; -enum _file_access_rights +typedef u16 oc_file_access; +enum oc_file_access_enum { - FILE_ACCESS_NONE = 0, - FILE_ACCESS_READ = 1<<1, - FILE_ACCESS_WRITE = 1<<2, + OC_FILE_ACCESS_NONE = 0, + OC_FILE_ACCESS_READ = 1<<1, + OC_FILE_ACCESS_WRITE = 1<<2, }; -typedef enum { FILE_SEEK_SET, FILE_SEEK_END, FILE_SEEK_CURRENT } file_whence; +typedef enum { OC_FILE_SEEK_SET, OC_FILE_SEEK_END, OC_FILE_SEEK_CURRENT } oc_file_whence; -typedef u64 io_req_id; +typedef u64 oc_io_req_id; -typedef u32 io_op; -enum _io_op +typedef u32 oc_io_op; +enum oc_io_op_enum { - IO_OP_OPEN_AT = 0, - IO_OP_CLOSE, + OC_IO_OPEN_AT = 0, + OC_IO_CLOSE, - IO_OP_FSTAT, + OC_IO_FSTAT, - IO_OP_SEEK, - IO_OP_READ, - IO_OP_WRITE, + OC_IO_SEEK, + OC_IO_READ, + OC_IO_WRITE, - IO_OP_ERROR, + OC_OC_IO_ERROR, //... }; -typedef struct io_req +typedef struct oc_io_req { - io_req_id id; - io_op op; - file_handle handle; + oc_io_req_id id; + oc_io_op op; + oc_file handle; i64 offset; u64 size; @@ -78,133 +78,133 @@ typedef struct io_req { struct { - file_access_rights rights; - file_open_flags flags; + oc_file_access rights; + oc_file_open_flags flags; } open; - file_whence whence; + oc_file_whence whence; }; -} io_req; +} oc_io_req; -typedef i32 io_error; -enum _io_error { - IO_OK = 0, - IO_ERR_UNKNOWN, - IO_ERR_OP, // unsupported operation - IO_ERR_HANDLE, // invalid handle - IO_ERR_PREV, // previously had a fatal error (last error stored on handle) - IO_ERR_ARG, // invalid argument or argument combination - IO_ERR_PERM, // access denied - IO_ERR_SPACE, // no space left - IO_ERR_NO_ENTRY, // file or directory does not exist - IO_ERR_EXISTS, // file already exists - IO_ERR_NOT_DIR, // path element is not a directory - IO_ERR_DIR, // attempted to write directory - IO_ERR_MAX_FILES, // max open files reached - IO_ERR_MAX_LINKS, // too many symbolic links in path - IO_ERR_PATH_LENGTH, // path too long - IO_ERR_FILE_SIZE, // file too big - IO_ERR_OVERFLOW, // offset too big - IO_ERR_NOT_READY, // no data ready to be read/written - IO_ERR_MEM, // failed to allocate memory - IO_ERR_INTERRUPT, // operation interrupted by a signal - IO_ERR_PHYSICAL, // physical IO error - IO_ERR_NO_DEVICE, // device not found - IO_ERR_WALKOUT, // attempted to walk out of root directory +typedef i32 oc_io_error; +enum oc_io_error_enum { + OC_IO_OK = 0, + OC_IO_ERR_UNKNOWN, + OC_IO_ERR_OP, // unsupported operation + OC_IO_ERR_HANDLE, // invalid handle + OC_IO_ERR_PREV, // previously had a fatal error (last error stored on handle) + OC_IO_ERR_ARG, // invalid argument or argument combination + OC_IO_ERR_PERM, // access denied + OC_IO_ERR_SPACE, // no space left + OC_IO_ERR_NO_ENTRY, // file or directory does not exist + OC_IO_ERR_EXISTS, // file already exists + OC_IO_ERR_NOT_DIR, // path element is not a directory + OC_IO_ERR_DIR, // attempted to write directory + OC_IO_ERR_MAX_FILES, // max open files reached + OC_IO_ERR_MAX_LINKS, // too many symbolic links in path + OC_IO_ERR_PATH_LENGTH, // path too long + OC_IO_ERR_FILE_SIZE, // file too big + OC_IO_ERR_OVERFLOW, // offset too big + OC_IO_ERR_NOT_READY, // no data ready to be read/written + OC_IO_ERR_MEM, // failed to allocate memory + OC_IO_ERR_INTERRUPT, // operation interrupted by a signal + OC_IO_ERR_PHYSICAL, // physical IO error + OC_IO_ERR_NO_DEVICE, // device not found + OC_IO_ERR_WALKOUT, // attempted to walk out of root directory //... }; -typedef struct io_cmp +typedef struct oc_io_cmp { - io_req_id id; - io_error error; + oc_io_req_id id; + oc_io_error error; union { i64 result; u64 size; i64 offset; - file_handle handle; + oc_file handle; //... }; -} io_cmp; +} oc_io_cmp; //---------------------------------------------------------------- //TODO: complete io queue api //---------------------------------------------------------------- -MP_API io_cmp io_wait_single_req(io_req* req); +ORCA_API oc_io_cmp oc_io_wait_single_req(oc_io_req* req); //---------------------------------------------------------------- // File IO wrapper API //---------------------------------------------------------------- -MP_API file_handle file_handle_nil(); -MP_API bool file_handle_is_nil(file_handle handle); +ORCA_API oc_file oc_file_nil(); +ORCA_API bool oc_file_is_nil(oc_file handle); -MP_API file_handle file_open(str8 path, file_access_rights rights, file_open_flags flags); -MP_API file_handle file_open_at(file_handle dir, str8 path, file_access_rights rights, file_open_flags flags); -MP_API void file_close(file_handle file); +ORCA_API oc_file oc_file_open(oc_str8 path, oc_file_access rights, oc_file_open_flags flags); +ORCA_API oc_file oc_file_open_at(oc_file dir, oc_str8 path, oc_file_access rights, oc_file_open_flags flags); +ORCA_API void oc_file_close(oc_file file); -MP_API i64 file_pos(file_handle file); -MP_API i64 file_seek(file_handle file, i64 offset, file_whence whence); +ORCA_API i64 oc_file_pos(oc_file file); +ORCA_API i64 oc_file_seek(oc_file file, i64 offset, oc_file_whence whence); -MP_API u64 file_write(file_handle file, u64 size, char* buffer); -MP_API u64 file_read(file_handle file, u64 size, char* buffer); +ORCA_API u64 oc_file_write(oc_file file, u64 size, char* buffer); +ORCA_API u64 oc_file_read(oc_file file, u64 size, char* buffer); -MP_API io_error file_last_error(file_handle handle); +ORCA_API oc_io_error oc_file_last_error(oc_file handle); //---------------------------------------------------------------- // File System wrapper API //---------------------------------------------------------------- -typedef enum file_type +typedef enum oc_file_type { - MP_FILE_UNKNOWN, - MP_FILE_REGULAR, - MP_FILE_DIRECTORY, - MP_FILE_SYMLINK, - MP_FILE_BLOCK, - MP_FILE_CHARACTER, - MP_FILE_FIFO, - MP_FILE_SOCKET, + OC_FILE_UNKNOWN, + OC_FILE_REGULAR, + OC_FILE_DIRECTORY, + OC_FILE_SYMLINK, + OC_FILE_BLOCK, + OC_FILE_CHARACTER, + OC_FILE_FIFO, + OC_FILE_SOCKET, -} file_type; +} oc_file_type; -typedef u16 file_perm; -enum file_perm +typedef u16 oc_file_perm; +enum oc_file_perm { - MP_FILE_OTHER_EXEC = 1<<0, - MP_FILE_OTHER_WRITE = 1<<1, - MP_FILE_OTHER_READ = 1<<2, + OC_FILE_OTHER_EXEC = 1<<0, + OC_FILE_OTHER_WRITE = 1<<1, + OC_FILE_OTHER_READ = 1<<2, - MP_FILE_GROUP_EXEC = 1<<3, - MP_FILE_GROUP_WRITE = 1<<4, - MP_FILE_GROUP_READ = 1<<5, + OC_FILE_GROUP_EXEC = 1<<3, + OC_FILE_GROUP_WRITE = 1<<4, + OC_FILE_GROUP_READ = 1<<5, - MP_FILE_OWNER_EXEC = 1<<6, - MP_FILE_OWNER_WRITE = 1<<7, - MP_FILE_OWNER_READ = 1<<8, + OC_FILE_OWNER_EXEC = 1<<6, + OC_FILE_OWNER_WRITE = 1<<7, + OC_FILE_OWNER_READ = 1<<8, - MP_FILE_STICKY_BIT = 1<<9, - MP_FILE_SET_GID = 1<<10, - MP_FILE_SET_UID = 1<<11, + OC_FILE_STICKY_BIT = 1<<9, + OC_FILE_SET_GID = 1<<10, + OC_FILE_SET_UID = 1<<11, }; -typedef struct file_status +typedef struct oc_file_status { u64 uid; - file_type type; - file_perm perm; + oc_file_type type; + oc_file_perm perm; u64 size; //TODO times -} file_status; +} oc_file_status; -MP_API file_status file_get_status(file_handle file); -MP_API u64 file_size(file_handle file); +ORCA_API oc_file_status oc_file_get_status(oc_file file); +ORCA_API u64 oc_file_size(oc_file file); //TODO: Complete as needed... diff --git a/src/platform/platform_io_common.c b/src/platform/platform_io_common.c index 199c69d..7d2e1d0 100644 --- a/src/platform/platform_io_common.c +++ b/src/platform/platform_io_common.c @@ -11,112 +11,112 @@ // File stream read/write API //------------------------------------------------------------------------------ -file_handle file_handle_nil() +oc_file oc_file_nil() { - return((file_handle){0}); + return((oc_file){0}); } -bool file_handle_is_nil(file_handle handle) +bool oc_file_is_nil(oc_file handle) { return(handle.h == 0); } -file_handle file_open(str8 path, file_access_rights rights, file_open_flags flags) +oc_file oc_file_open(oc_str8 path, oc_file_access rights, oc_file_open_flags flags) { - io_req req = {.op = IO_OP_OPEN_AT, + oc_io_req req = {.op = OC_IO_OPEN_AT, .size = path.len, .buffer = path.ptr, .open.rights = rights, .open.flags = flags }; - io_cmp cmp = io_wait_single_req(&req); + oc_io_cmp cmp = oc_io_wait_single_req(&req); //WARN: we always return a handle that can be queried for errors. Handles must be closed // even if there was an error when opening return(cmp.handle); } -file_handle file_open_at(file_handle dir, str8 path, file_access_rights rights, file_open_flags flags) +oc_file oc_file_open_at(oc_file dir, oc_str8 path, oc_file_access rights, oc_file_open_flags flags) { - io_req req = {.op = IO_OP_OPEN_AT, + oc_io_req req = {.op = OC_IO_OPEN_AT, .handle = dir, .size = path.len, .buffer = path.ptr, .open.rights = rights, .open.flags = flags,}; - io_cmp cmp = io_wait_single_req(&req); + oc_io_cmp cmp = oc_io_wait_single_req(&req); return(cmp.handle); } -void file_close(file_handle file) +void oc_file_close(oc_file file) { - io_req req = {.op = IO_OP_CLOSE, + oc_io_req req = {.op = OC_IO_CLOSE, .handle = file}; - io_wait_single_req(&req); + oc_io_wait_single_req(&req); } -i64 file_seek(file_handle file, i64 offset, file_whence whence) +i64 oc_file_seek(oc_file file, i64 offset, oc_file_whence whence) { - io_req req = {.op = IO_OP_SEEK, + oc_io_req req = {.op = OC_IO_SEEK, .handle = file, .offset = offset, .whence = whence}; - io_cmp cmp = io_wait_single_req(&req); + oc_io_cmp cmp = oc_io_wait_single_req(&req); return(cmp.offset); } -i64 file_pos(file_handle file) +i64 oc_file_pos(oc_file file) { - return(file_seek(file, 0, FILE_SEEK_CURRENT)); + return(oc_file_seek(file, 0, OC_FILE_SEEK_CURRENT)); } -u64 file_write(file_handle file, u64 size, char* buffer) +u64 oc_file_write(oc_file file, u64 size, char* buffer) { - io_req req = {.op = IO_OP_WRITE, + oc_io_req req = {.op = OC_IO_WRITE, .handle = file, .size = size, .buffer = buffer}; - io_cmp cmp = io_wait_single_req(&req); + oc_io_cmp cmp = oc_io_wait_single_req(&req); return(cmp.size); } -u64 file_read(file_handle file, u64 size, char* buffer) +u64 oc_file_read(oc_file file, u64 size, char* buffer) { - io_req req = {.op = IO_OP_READ, + oc_io_req req = {.op = OC_IO_READ, .handle = file, .size = size, .buffer = buffer}; - io_cmp cmp = io_wait_single_req(&req); + oc_io_cmp cmp = oc_io_wait_single_req(&req); return(cmp.size); } -io_error file_last_error(file_handle file) +oc_io_error oc_file_last_error(oc_file file) { - io_req req = {.op = IO_OP_ERROR, + oc_io_req req = {.op = OC_OC_IO_ERROR, .handle = file}; - io_cmp cmp = io_wait_single_req(&req); - return((io_error)cmp.result); + oc_io_cmp cmp = oc_io_wait_single_req(&req); + return((oc_io_error)cmp.result); } -file_status file_get_status(file_handle file) +oc_file_status oc_file_get_status(oc_file file) { - file_status status = {0}; - io_req req = {.op = IO_OP_FSTAT, + oc_file_status status = {0}; + oc_io_req req = {.op = OC_IO_FSTAT, .handle = file, - .size = sizeof(file_status), + .size = sizeof(oc_file_status), .buffer = (char*)&status}; - io_cmp cmp = io_wait_single_req(&req); + oc_io_cmp cmp = oc_io_wait_single_req(&req); return(status); } -u64 file_size(file_handle file) +u64 oc_file_size(oc_file file) { - file_status status = file_get_status(file); + oc_file_status status = oc_file_get_status(file); return(status.size); } diff --git a/src/platform/platform_io_internal.c b/src/platform/platform_io_internal.c index 9d71a3e..1450e15 100644 --- a/src/platform/platform_io_internal.c +++ b/src/platform/platform_io_internal.c @@ -9,12 +9,12 @@ #include"platform_io_internal.h" #include"platform_path.h" -file_table __globalFileTable = {0}; +oc_file_table oc_globalFileTable = {0}; -file_slot* file_slot_alloc(file_table* table) +oc_file_slot* oc_file_slot_alloc(oc_file_table* table) { - file_slot* slot = list_pop_entry(&table->freeList, file_slot, freeListElt); - if(!slot && table->nextSlot < ORCA_MAX_FILE_SLOTS) + oc_file_slot* slot = oc_list_pop_entry(&table->freeList, oc_file_slot, freeListElt); + if(!slot && table->nextSlot < OC_IO_MAX_FILE_SLOTS) { slot = &table->slots[table->nextSlot]; slot->generation = 1; @@ -22,36 +22,36 @@ file_slot* file_slot_alloc(file_table* table) } u32 tmpGeneration = slot->generation; - memset(slot, 0, sizeof(file_slot)); + memset(slot, 0, sizeof(oc_file_slot)); slot->generation = tmpGeneration; return(slot); } -void file_slot_recycle(file_table* table, file_slot* slot) +void oc_file_slot_recycle(oc_file_table* table, oc_file_slot* slot) { slot->generation++; - list_push(&table->freeList, &slot->freeListElt); + oc_list_push(&table->freeList, &slot->freeListElt); } -file_handle file_handle_from_slot(file_table* table, file_slot* slot) +oc_file oc_file_from_slot(oc_file_table* table, oc_file_slot* slot) { u64 index = slot - table->slots; u64 generation = slot->generation; - file_handle handle = {.h = (generation<<32) | index }; + oc_file handle = {.h = (generation<<32) | index }; return(handle); } -file_slot* file_slot_from_handle(file_table* table, file_handle handle) +oc_file_slot* oc_file_slot_from_handle(oc_file_table* table, oc_file handle) { - file_slot* slot = 0; + oc_file_slot* slot = 0; u64 index = handle.h & 0xffffffff; u64 generation = handle.h>>32; if(index < table->nextSlot) { - file_slot* candidate = &table->slots[index]; + oc_file_slot* candidate = &table->slots[index]; if(candidate->generation == generation) { slot = candidate; @@ -60,149 +60,149 @@ file_slot* file_slot_from_handle(file_table* table, file_handle handle) return(slot); } -io_cmp io_wait_single_req(io_req* req) +oc_io_cmp oc_io_wait_single_req(oc_io_req* req) { - return(io_wait_single_req_with_table(req, &__globalFileTable)); + return(oc_io_wait_single_req_with_table(req, &oc_globalFileTable)); } //----------------------------------------------------------------------- // io common primitives //----------------------------------------------------------------------- -typedef struct io_open_restrict_context +typedef struct oc_io_open_restrict_context { - io_error error; + oc_io_error error; u64 rootUID; - io_file_desc rootFd; - io_file_desc fd; + oc_file_desc rootFd; + oc_file_desc fd; -} io_open_restrict_context; +} oc_io_open_restrict_context; -io_error io_open_restrict_enter(io_open_restrict_context* context, str8 name, file_access_rights accessRights, file_open_flags openFlags) +oc_io_error oc_io_open_restrict_enter(oc_io_open_restrict_context* context, oc_str8 name, oc_file_access accessRights, oc_file_open_flags openFlags) { - io_file_desc nextFd = io_raw_open_at(context->fd, name, accessRights, openFlags); - if(io_file_desc_is_nil(nextFd)) + oc_file_desc nextFd = oc_io_raw_open_at(context->fd, name, accessRights, openFlags); + if(oc_file_desc_is_nil(nextFd)) { - context->error = io_raw_last_error(); + context->error = oc_io_raw_last_error(); } else { if(context->fd != context->rootFd) { - io_raw_close(context->fd); + oc_io_raw_close(context->fd); } context->fd = nextFd; } return(context->error); } -typedef struct io_open_restrict_result +typedef struct oc_io_open_restrict_result { - io_error error; - io_file_desc fd; -} io_open_restrict_result; + oc_io_error error; + oc_file_desc fd; +} oc_io_open_restrict_result; -io_open_restrict_result io_open_restrict(io_file_desc dirFd, str8 path, file_access_rights accessRights, file_open_flags openFlags) +oc_io_open_restrict_result oc_io_open_restrict(oc_file_desc dirFd, oc_str8 path, oc_file_access accessRights, oc_file_open_flags openFlags) { - mem_arena_scope scratch = mem_scratch_begin(); + oc_arena_scope scratch = oc_scratch_begin(); - str8_list sep = {0}; - str8_list_push(scratch.arena, &sep, STR8("/")); - str8_list_push(scratch.arena, &sep, STR8("\\")); - str8_list pathElements = str8_split(scratch.arena, path, sep); + oc_str8_list sep = {0}; + oc_str8_list_push(scratch.arena, &sep, OC_STR8("/")); + oc_str8_list_push(scratch.arena, &sep, OC_STR8("\\")); + oc_str8_list pathElements = oc_str8_split(scratch.arena, path, sep); - io_open_restrict_context context = { - .error = IO_OK, + oc_io_open_restrict_context context = { + .error = OC_IO_OK, .rootFd = dirFd, .fd = dirFd, }; - if(io_file_desc_is_nil(dirFd)) + if(oc_file_desc_is_nil(dirFd)) { - context.error = IO_ERR_HANDLE; + context.error = OC_IO_ERR_HANDLE; } else { - file_status status; - context.error = io_raw_fstat(dirFd, &status); + oc_file_status status; + context.error = oc_io_raw_fstat(dirFd, &status); context.rootUID = status.uid; } - if(context.error == IO_OK) + if(context.error == OC_IO_OK) { - for_list(&pathElements.list, elt, str8_elt, listElt) + oc_list_for(&pathElements.list, elt, oc_str8_elt, listElt) { - str8 name = elt->string; - file_access_rights eltAccessRights = FILE_ACCESS_READ; - file_open_flags eltOpenFlags = 0; + oc_str8 name = elt->string; + oc_file_access eltAccessRights = OC_FILE_ACCESS_READ; + oc_file_open_flags eltOpenFlags = 0; - bool atLastElement = (&elt->listElt == list_last(&pathElements.list)); + bool atLastElement = (&elt->listElt == oc_list_last(&pathElements.list)); if(atLastElement) { eltAccessRights = accessRights; eltOpenFlags = openFlags; } - if( !str8_cmp(name, STR8(".")) + if( !oc_str8_cmp(name, OC_STR8(".")) && !atLastElement) { //NOTE: if we're not at the last element we can just skip '.' elements continue; } - else if(!str8_cmp(name, STR8(".."))) + else if(!oc_str8_cmp(name, OC_STR8(".."))) { //NOTE: check that we don't escape root dir - file_status status; - context.error = io_raw_fstat(context.fd, &status); + oc_file_status status; + context.error = oc_io_raw_fstat(context.fd, &status); if(context.error) { break; } else if(status.uid == context.rootUID) { - context.error = IO_ERR_WALKOUT; + context.error = OC_IO_ERR_WALKOUT; break; } } - else if(!io_raw_file_exists_at(context.fd, name, FILE_OPEN_SYMLINK)) + else if(!oc_io_raw_file_exists_at(context.fd, name, OC_FILE_OPEN_SYMLINK)) { - //NOTE: if the file doesn't exists, but we're at the last element and FILE_OPEN_CREATE - // is set, we create the file. Otherwise it is a IO_ERROR_NO_ENTRY error. + //NOTE: if the file doesn't exists, but we're at the last element and OC_FILE_OPEN_CREATE + // is set, we create the file. Otherwise it is a OC_IO_ERROR_NO_ENTRY error. if( !atLastElement - || !(openFlags & FILE_OPEN_CREATE)) + || !(openFlags & OC_FILE_OPEN_CREATE)) { - context.error = IO_ERR_NO_ENTRY; + context.error = OC_IO_ERR_NO_ENTRY; break; } } else { //NOTE: if the file exists, we check the type of file - file_status status = {0}; - context.error = io_raw_fstat_at(context.fd, name, FILE_OPEN_SYMLINK, &status); + oc_file_status status = {0}; + context.error = oc_io_raw_fstat_at(context.fd, name, OC_FILE_OPEN_SYMLINK, &status); if(context.error) { break; } - if(status.type == MP_FILE_REGULAR) + if(status.type == OC_FILE_REGULAR) { if(!atLastElement) { - context.error = IO_ERR_NOT_DIR; + context.error = OC_IO_ERR_NOT_DIR; break; } } - else if(status.type == MP_FILE_SYMLINK) + else if(status.type == OC_FILE_SYMLINK) { - //TODO - do we need a FILE_OPEN_NO_FOLLOW that fails if last element is a symlink? - // - do we need a FILE_OPEN_NO_SYMLINKS that fails if _any_ element is a symlink? + //TODO - do we need a OC_FILE_OPEN_NO_FOLLOW that fails if last element is a symlink? + // - do we need a OC_FILE_OPEN_NO_SYMLINKS that fails if _any_ element is a symlink? if( !atLastElement - || !(openFlags & FILE_OPEN_SYMLINK)) + || !(openFlags & OC_FILE_OPEN_SYMLINK)) { - io_raw_read_link_result link = io_raw_read_link_at(scratch.arena, context.fd, name); + oc_io_raw_read_link_result link = oc_io_raw_read_link_at(scratch.arena, context.fd, name); if(link.error) { context.error = link.error; @@ -211,19 +211,19 @@ io_open_restrict_result io_open_restrict(io_file_desc dirFd, str8 path, file_acc if(link.target.len == 0) { //NOTE: treat an empty target as a '.' - link.target = STR8("."); + link.target = OC_STR8("."); } - else if(path_is_absolute(link.target)) + else if(oc_path_is_absolute(link.target)) { - context.error = IO_ERR_WALKOUT; + context.error = OC_IO_ERR_WALKOUT; break; } - str8_list linkElements = str8_split(scratch.arena, link.target, sep); - if(!list_empty(&linkElements.list)) + oc_str8_list linkElements = oc_str8_split(scratch.arena, link.target, sep); + if(!oc_list_empty(&linkElements.list)) { //NOTE: insert linkElements into pathElements after elt - list_elt* tmp = elt->listElt.next; + oc_list_elt* tmp = elt->listElt.next; elt->listElt.next = linkElements.list.first; linkElements.list.last->next = tmp; if(!tmp) @@ -234,63 +234,63 @@ io_open_restrict_result io_open_restrict(io_file_desc dirFd, str8 path, file_acc continue; } } - else if(status.type != MP_FILE_DIRECTORY) + else if(status.type != OC_FILE_DIRECTORY) { - context.error = IO_ERR_NOT_DIR; + context.error = OC_IO_ERR_NOT_DIR; break; } } //NOTE: if we arrive here, we have no errors and the correct flags are set, // so we can enter the element - DEBUG_ASSERT(context.error == IO_OK); - io_open_restrict_enter(&context, name, eltAccessRights, eltOpenFlags); + OC_DEBUG_ASSERT(context.error == OC_IO_OK); + oc_io_open_restrict_enter(&context, name, eltAccessRights, eltOpenFlags); } } - if(context.error && !io_file_desc_is_nil(context.fd)) + if(context.error && !oc_file_desc_is_nil(context.fd)) { if(context.fd != context.rootFd) { - io_raw_close(context.fd); + oc_io_raw_close(context.fd); } - context.fd = io_file_desc_nil(); + context.fd = oc_file_desc_nil(); } - io_open_restrict_result result = { + oc_io_open_restrict_result result = { .error = context.error, .fd = context.fd }; - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(result); } -io_cmp io_open_at(file_slot* atSlot, io_req* req, file_table* table) +oc_io_cmp oc_io_open_at(oc_file_slot* atSlot, oc_io_req* req, oc_file_table* table) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; - file_slot* slot = file_slot_alloc(table); + oc_file_slot* slot = oc_file_slot_alloc(table); if(!slot) { - cmp.error = IO_ERR_MAX_FILES; + cmp.error = OC_IO_ERR_MAX_FILES; cmp.result = 0; } else { - slot->fd = io_file_desc_nil(); - cmp.handle = file_handle_from_slot(table, slot); + slot->fd = oc_file_desc_nil(); + cmp.handle = oc_file_from_slot(table, slot); - str8 path = str8_from_buffer(req->size, req->buffer); + oc_str8 path = oc_str8_from_buffer(req->size, req->buffer); if(!path.len) { - slot->error = IO_ERR_ARG; + slot->error = OC_IO_ERR_ARG; } - else if(!atSlot && !file_handle_is_nil(req->handle)) + else if(!atSlot && !oc_file_is_nil(req->handle)) { - slot->error = IO_ERR_HANDLE; + slot->error = OC_IO_ERR_HANDLE; } else { @@ -302,34 +302,34 @@ io_cmp io_open_at(file_slot* atSlot, io_req* req, file_table* table) if(slot->rights != req->open.rights) { - slot->error = IO_ERR_PERM; + slot->error = OC_IO_ERR_PERM; } else { - io_file_desc dirFd = atSlot ? atSlot->fd : io_file_desc_nil(); + oc_file_desc dirFd = atSlot ? atSlot->fd : oc_file_desc_nil(); - if(req->open.flags & FILE_OPEN_RESTRICT) + if(req->open.flags & OC_FILE_OPEN_RESTRICT) { - io_open_restrict_result res = io_open_restrict(dirFd, path, slot->rights, req->open.flags); + oc_io_open_restrict_result res = oc_io_open_restrict(dirFd, path, slot->rights, req->open.flags); slot->error = res.error; slot->fd = res.fd; } else { - slot->fd = io_raw_open_at(dirFd, path, slot->rights, req->open.flags); - if(io_file_desc_is_nil(slot->fd)) + slot->fd = oc_io_raw_open_at(dirFd, path, slot->rights, req->open.flags); + if(oc_file_desc_is_nil(slot->fd)) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); } } } } - if(slot->error == IO_OK) + if(slot->error == OC_IO_OK) { - file_status status; - slot->error = io_raw_fstat(slot->fd, &status); - if(slot->error == IO_OK) + oc_file_status status; + slot->error = oc_io_raw_fstat(slot->fd, &status); + if(slot->error == OC_IO_OK) { slot->type = status.type; } diff --git a/src/platform/platform_io_internal.h b/src/platform/platform_io_internal.h index 318ef27..b5e81a9 100644 --- a/src/platform/platform_io_internal.h +++ b/src/platform/platform_io_internal.h @@ -11,60 +11,60 @@ #include"platform_io.h" #include"platform.h" -#if PLATFORM_MACOS || PLATFORM_LINUX - typedef int io_file_desc; -#elif PLATFORM_WINDOWS +#if OC_PLATFORM_MACOS || PLATFORM_LINUX + typedef int oc_file_desc; +#elif OC_PLATFORM_WINDOWS #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include - typedef HANDLE io_file_desc; + typedef HANDLE oc_file_desc; #endif -typedef struct file_slot +typedef struct oc_file_slot { u32 generation; - io_error error; + oc_io_error error; bool fatal; - list_elt freeListElt; + oc_list_elt freeListElt; - file_type type; - file_access_rights rights; - io_file_desc fd; + oc_file_type type; + oc_file_access rights; + oc_file_desc fd; -} file_slot; +} oc_file_slot; enum { - ORCA_MAX_FILE_SLOTS = 256, + OC_IO_MAX_FILE_SLOTS = 256, }; -typedef struct file_table +typedef struct oc_file_table { - file_slot slots[ORCA_MAX_FILE_SLOTS]; + oc_file_slot slots[OC_IO_MAX_FILE_SLOTS]; u32 nextSlot; - list_info freeList; -} file_table; + oc_list freeList; +} oc_file_table; -file_slot* file_slot_alloc(file_table* table); -void file_slot_recycle(file_table* table, file_slot* slot); -file_handle file_handle_from_slot(file_table* table, file_slot* slot); -file_slot* file_slot_from_handle(file_table* table, file_handle handle); +oc_file_slot* oc_file_slot_alloc(oc_file_table* table); +void oc_file_slot_recycle(oc_file_table* table, oc_file_slot* slot); +oc_file oc_file_from_slot(oc_file_table* table, oc_file_slot* slot); +oc_file_slot* oc_file_slot_from_handle(oc_file_table* table, oc_file handle); -MP_API io_cmp io_wait_single_req_with_table(io_req* req, file_table* table); +ORCA_API oc_io_cmp oc_io_wait_single_req_with_table(oc_io_req* req, oc_file_table* table); //----------------------------------------------------------------------- // raw io primitives //----------------------------------------------------------------------- -io_file_desc io_file_desc_nil(); -bool io_file_desc_is_nil(io_file_desc fd); +oc_file_desc oc_file_desc_nil(); +bool oc_file_desc_is_nil(oc_file_desc fd); /*WARN - io_raw_xxx_at functions are similar to posix openat() regarding path resolution, + oc_io_raw_xxx_at functions are similar to posix openat() regarding path resolution, but with some important differences: - - If dirFd is a non-nil fd, path is considered relative to dirFd _even if it is an absolute path_ + - If dirFd is a non-nil fd, path is considered relative to dirFd _even if it is an absolute oc_path_ - If dirFd is a nil fd, it is _ignored_ (i.e., path can be absolute, or relative to the current directory) This means that: @@ -72,19 +72,19 @@ bool io_file_desc_is_nil(io_file_desc fd); - we don't need a special handle value to use a path relative to the current working directory (we just pass a nil dirFd with a relative path) */ -io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights accessRights, file_open_flags openFlags); -void io_raw_close(io_file_desc fd); -io_error io_raw_last_error(); -bool io_raw_file_exists_at(io_file_desc dirFd, str8 path, file_open_flags openFlags); -io_error io_raw_fstat(io_file_desc fd, file_status* status); -io_error io_raw_fstat_at(io_file_desc dirFd, str8 path, file_open_flags openFlags, file_status* status); +oc_file_desc oc_io_raw_open_at(oc_file_desc dirFd, oc_str8 path, oc_file_access accessRights, oc_file_open_flags openFlags); +void oc_io_raw_close(oc_file_desc fd); +oc_io_error oc_io_raw_last_error(); +bool oc_io_raw_file_exists_at(oc_file_desc dirFd, oc_str8 path, oc_file_open_flags openFlags); +oc_io_error oc_io_raw_fstat(oc_file_desc fd, oc_file_status* status); +oc_io_error oc_io_raw_fstat_at(oc_file_desc dirFd, oc_str8 path, oc_file_open_flags openFlags, oc_file_status* status); -typedef struct io_raw_read_link_result +typedef struct oc_io_raw_read_link_result { - io_error error; - str8 target; -} io_raw_read_link_result; + oc_io_error error; + oc_str8 target; +} oc_io_raw_read_link_result; -io_raw_read_link_result io_raw_read_link_at(mem_arena* arena, io_file_desc dirFd, str8 path); +oc_io_raw_read_link_result oc_io_raw_read_link_at(oc_arena* arena, oc_file_desc dirFd, oc_str8 path); #endif //__PLATFORM_IO_INTERNAL_H_ diff --git a/src/platform/platform_memory.h b/src/platform/platform_memory.h index 006396f..7c28cfe 100644 --- a/src/platform/platform_memory.h +++ b/src/platform/platform_memory.h @@ -19,40 +19,34 @@ extern "C" { //-------------------------------------------------------------------------------- //NOTE(martin): base allocator //-------------------------------------------------------------------------------- -typedef struct mem_base_allocator mem_base_allocator; +typedef struct oc_base_allocator oc_base_allocator; -typedef void*(*mem_reserve_function)(mem_base_allocator* context, u64 size); -typedef void(*mem_modify_function)(mem_base_allocator* context, void* ptr, u64 size); +typedef void*(*oc_mem_reserve_function)(oc_base_allocator* context, u64 size); +typedef void(*oc_mem_modify_function)(oc_base_allocator* context, void* ptr, u64 size); -typedef struct mem_base_allocator +typedef struct oc_base_allocator { - mem_reserve_function reserve; - mem_modify_function commit; - mem_modify_function decommit; - mem_modify_function release; + oc_mem_reserve_function reserve; + oc_mem_modify_function commit; + oc_mem_modify_function decommit; + oc_mem_modify_function release; -} mem_base_allocator; +} oc_base_allocator; -MP_API mem_base_allocator* mem_base_allocator_default(); +ORCA_API oc_base_allocator* oc_base_allocator_default(); -#define mem_base_reserve(base, size) base->reserve(base, size) -#define mem_base_commit(base, ptr, size) base->commit(base, ptr, size) -#define mem_base_decommit(base, ptr, size) base->decommit(base, ptr, size) -#define mem_base_release(base, ptr, size) base->release(base, ptr, size) +#define oc_base_reserve(base, size) base->reserve(base, size) +#define oc_base_commit(base, ptr, size) base->commit(base, ptr, size) +#define oc_base_decommit(base, ptr, size) base->decommit(base, ptr, size) +#define oc_base_release(base, ptr, size) base->release(base, ptr, size) //-------------------------------------------------------------------------------- //NOTE(martin): malloc/free //-------------------------------------------------------------------------------- -#if PLATFORM_ORCA - void* malloc(size_t size); - void* realloc(void* ptr, size_t size); - void free(void* ptr); -#else - #include -#endif +#include -#define malloc_type(type) ((type*)malloc(sizeof(type))) -#define malloc_array(type, count) ((type*)malloc(sizeof(type)*count)) +#define oc_malloc_type(type) ((type*)malloc(sizeof(type))) +#define oc_malloc_array(type, count) ((type*)malloc(sizeof(type)*count)) //-------------------------------------------------------------------------------- //NOTE(martin): memset / memcpy diff --git a/src/platform/platform_path.c b/src/platform/platform_path.c index 699bc80..fdb83d8 100644 --- a/src/platform/platform_path.c +++ b/src/platform/platform_path.c @@ -8,7 +8,7 @@ #include"platform_path.h" -str8 path_slice_directory(str8 fullPath) +oc_str8 oc_path_slice_directory(oc_str8 fullPath) { i64 lastSlashIndex = -1; @@ -20,11 +20,11 @@ str8 path_slice_directory(str8 fullPath) break; } } - str8 directory = str8_slice(fullPath, 0, lastSlashIndex+1); + oc_str8 directory = oc_str8_slice(fullPath, 0, lastSlashIndex+1); return(directory); } -str8 path_slice_filename(str8 fullPath) +oc_str8 oc_path_slice_filename(oc_str8 fullPath) { i64 lastSlashIndex = -1; @@ -37,69 +37,69 @@ str8 path_slice_filename(str8 fullPath) } } - str8 basename = str8_slice(fullPath, lastSlashIndex+1, fullPath.len); + oc_str8 basename = oc_str8_slice(fullPath, lastSlashIndex+1, fullPath.len); return(basename); } -str8_list path_split(mem_arena* arena, str8 path) +oc_str8_list oc_path_split(oc_arena* arena, oc_str8 path) { - mem_arena_scope tmp = mem_scratch_begin_next(arena); - str8_list split = {0}; - str8_list_push(tmp.arena, &split, STR8("/")); - str8_list res = str8_split(arena, path, split); - mem_scratch_end(tmp); + oc_arena_scope tmp = oc_scratch_begin_next(arena); + oc_str8_list split = {0}; + oc_str8_list_push(tmp.arena, &split, OC_STR8("/")); + oc_str8_list res = oc_str8_split(arena, path, split); + oc_scratch_end(tmp); return(res); } -str8 path_join(mem_arena* arena, str8_list elements) +oc_str8 oc_path_join(oc_arena* arena, oc_str8_list elements) { //TODO: check if elements have ending/begining '/' ? - str8 res = str8_list_collate(arena, elements, STR8("/"), STR8("/"), (str8){0}); + oc_str8 res = oc_str8_list_collate(arena, elements, OC_STR8("/"), OC_STR8("/"), (oc_str8){0}); return(res); } -str8 path_append(mem_arena* arena, str8 parent, str8 relPath) +oc_str8 oc_path_append(oc_arena* arena, oc_str8 parent, oc_str8 relPath) { - str8 result = {0}; + oc_str8 result = {0}; if(parent.len == 0) { - result = str8_push_copy(arena, relPath); + result = oc_str8_push_copy(arena, relPath); } else if(relPath.len == 0) { - result = str8_push_copy(arena, parent); + result = oc_str8_push_copy(arena, parent); } else { - mem_arena_scope tmp = mem_scratch_begin_next(arena); + oc_arena_scope tmp = oc_scratch_begin_next(arena); - str8_list list = {0}; - str8_list_push(tmp.arena, &list, parent); + oc_str8_list list = {0}; + oc_str8_list_push(tmp.arena, &list, parent); if( (parent.ptr[parent.len-1] != '/') &&(relPath.ptr[relPath.len-1] != '/')) { - str8_list_push(tmp.arena, &list, STR8("/")); + oc_str8_list_push(tmp.arena, &list, OC_STR8("/")); } - str8_list_push(tmp.arena, &list, relPath); + oc_str8_list_push(tmp.arena, &list, relPath); - result = str8_list_join(arena, list); + result = oc_str8_list_join(arena, list); - mem_scratch_end(tmp); + oc_scratch_end(tmp); } return(result); } -str8 path_executable_relative(mem_arena* arena, str8 relPath) +oc_str8 oc_path_executable_relative(oc_arena* arena, oc_str8 relPath) { - str8_list list = {0}; - mem_arena_scope scratch = mem_scratch_begin_next(arena); + oc_str8_list list = {0}; + oc_arena_scope scratch = oc_scratch_begin_next(arena); - str8 executablePath = path_executable(scratch.arena); - str8 dirPath = path_slice_directory(executablePath); + oc_str8 executablePath = oc_path_executable(scratch.arena); + oc_str8 dirPath = oc_path_slice_directory(executablePath); - str8 path = path_append(arena, dirPath, relPath); + oc_str8 path = oc_path_append(arena, dirPath, relPath); - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(path); } diff --git a/src/platform/platform_path.h b/src/platform/platform_path.h index da1c23f..6fd8f19 100644 --- a/src/platform/platform_path.h +++ b/src/platform/platform_path.h @@ -16,18 +16,18 @@ the string. */ -MP_API str8 path_slice_directory(str8 path); -MP_API str8 path_slice_filename(str8 path); +ORCA_API oc_str8 oc_path_slice_directory(oc_str8 path); +ORCA_API oc_str8 oc_path_slice_filename(oc_str8 path); -MP_API str8_list path_split(mem_arena* arena, str8 path); -MP_API str8 path_join(mem_arena* arena, str8_list elements); -MP_API str8 path_append(mem_arena* arena, str8 parent, str8 relPath); +ORCA_API oc_str8_list oc_path_split(oc_arena* arena, oc_str8 path); +ORCA_API oc_str8 oc_path_join(oc_arena* arena, oc_str8_list elements); +ORCA_API oc_str8 oc_path_append(oc_arena* arena, oc_str8 parent, oc_str8 relPath); -MP_API bool path_is_absolute(str8 path); -MP_API str8 path_executable(mem_arena* arena); -MP_API str8 path_canonical(mem_arena* arena, str8 path); +ORCA_API bool oc_path_is_absolute(oc_str8 path); +ORCA_API oc_str8 oc_path_executable(oc_arena* arena); +ORCA_API oc_str8 oc_path_canonical(oc_arena* arena, oc_str8 path); -// helper: gets the path from path_executable() and appends relPath -MP_API str8 path_executable_relative(mem_arena* arena, str8 relPath); +// helper: gets the path from oc_path_executable() and appends relPath +ORCA_API oc_str8 oc_path_executable_relative(oc_arena* arena, oc_str8 relPath); #endif //__PLATFORM_PATH_H_ diff --git a/src/platform/platform_rng.h b/src/platform/platform_rng.h deleted file mode 100644 index b4726b6..0000000 --- a/src/platform/platform_rng.h +++ /dev/null @@ -1,18 +0,0 @@ -/************************************************************//** -* -* @file: platform_rng.h -* @author: Martin Fouilleul -* @date: 06/03/2020 -* @revision: -* -*****************************************************************/ -#ifndef __PLATFORM_RANDOM_H_ -#define __PLATFORM_RANDOM_H_ - -#include"typedefs.h" - -int RandomSeedFromDevice(); -u32 RandomU32(); -u64 RandomU64(); - -#endif //__PLATFORM_RANDOM_H_ diff --git a/src/platform/platform_socket.h b/src/platform/platform_socket.h deleted file mode 100644 index 8585cd0..0000000 --- a/src/platform/platform_socket.h +++ /dev/null @@ -1,161 +0,0 @@ -/************************************************************//** -* -* @file: platform_socket.h -* @author: Martin Fouilleul -* @date: 22/03/2019 -* @revision: -* -*****************************************************************/ -#ifndef __PLATFORM_SOCKET_H_ -#define __PLATFORM_SOCKET_H_ - -#include // timeval -#include"typedefs.h" - -#ifdef __cplusplus -extern "C" { -#else -typedef struct timeval timeval; -#endif //__cplusplus - - -//---------------------------------------------------------------------------------- -// Errors -//---------------------------------------------------------------------------------- - -//TODO(martin): extend these error codes -const int SOCK_ERR_OK = 0, - SOCK_ERR_UNKNOWN = -1, - SOCK_ERR_ACCESS = -2, - SOCK_ERR_MEM = -3, - SOCK_ERR_INTR = -4, - SOCK_ERR_USED = -5, - SOCK_ERR_BADF = -6, - SOCK_ERR_ABORT = -7, - SOCK_ERR_NBLOCK = -8; - -int SocketGetLastError(); -const char* SocketGetLastErrorMessage(); - -//---------------------------------------------------------------------------------- -// Addresses -//---------------------------------------------------------------------------------- - -//NOTE(martin): net_ip and net_port are stored in network byte order -// host_ip and host_port are stored in host byte order -typedef uint32 net_ip; -typedef uint16 net_port; -typedef uint32 host_ip; -typedef uint16 host_port; - -typedef struct -{ - net_ip ip; - net_port port; -} socket_address; - -//NOTE(martin): these are in host byte order ! -const host_ip SOCK_IP_LOOPBACK = 0x7f000001; -const host_ip SOCK_IP_ANY = 0; -const host_port SOCK_PORT_ANY = 0; - -net_ip StringToNetIP(const char* addr); -const char* NetIPToString(net_ip ip); - -host_ip StringToHostIP(const char* addr); -const char* HostIPToString(host_ip ip); - -net_ip HostToNetIP(host_ip ip); -net_port HostToNetPort(host_port port); -host_ip NetToHostIP(net_ip ip); -host_port NetToHostPort(net_port port); - - -int SocketGetIFAddresses(int* count, net_ip* ips); -net_ip SocketGetDefaultExternalIP(); - -//---------------------------------------------------------------------------------- -// Socket API -//---------------------------------------------------------------------------------- - -typedef struct platform_socket platform_socket; - -typedef enum { SOCK_UDP, SOCK_TCP } socket_transport; - -const int SOCK_MSG_OOB = 0x01, - SOCK_MSG_PEEK = 0x02, - SOCK_MSG_DONTROUTE = 0x04, - SOCK_MSG_WAITALL = 0x40; - -platform_socket* SocketOpen(socket_transport transport); -int SocketClose(platform_socket* socket); - -int SocketBind(platform_socket* socket, socket_address* addr); -int SocketListen(platform_socket* socket, int backlog); -platform_socket* SocketAccept(platform_socket* socket, socket_address* from); - -int SocketConnect(platform_socket* socket, socket_address* addr); - -int64 SocketReceive(platform_socket* socket, void* buffer, uint64 size, int flags); -int64 SocketReceiveFrom(platform_socket* socket, void* buffer, uint64 size, int flags, socket_address* from); - -int64 SocketSend(platform_socket* socket, void* buffer, uint64 size, int flags); -int64 SocketSendTo(platform_socket* socket, void* buffer, uint64 size, int flags, socket_address* to); - -int SocketGetAddress(platform_socket* socket, socket_address* addr); - -//---------------------------------------------------------------------------------- -// Multiplexing -//---------------------------------------------------------------------------------- -const uint8 SOCK_ACTIVITY_IN = 1<<0, - SOCK_ACTIVITY_OUT = 1<<2, - SOCK_ACTIVITY_ERR = 1<<3; - -typedef struct -{ - platform_socket* sock; - uint8 watch; - uint8 set; -} socket_activity; - -int SocketSelect(uint32 count, socket_activity* set, double timeout); - -//---------------------------------------------------------------------------------- -// Socket Options -//---------------------------------------------------------------------------------- - -int SocketSetReceiveTimeout(platform_socket* socket, timeval* tv); -int SocketSetSendTimeout(platform_socket* socket, timeval* tv); -int SocketSetBroadcast(platform_socket* sock, bool enable); -int SocketSetReuseAddress(platform_socket* sock, bool enable); -int SocketSetReusePort(platform_socket* sock, bool enable); -int SocketSetReceiveTimestamping(platform_socket* socket, bool enable); - -//---------------------------------------------------------------------------------- -// Multicast -//---------------------------------------------------------------------------------- - -int SocketSetMulticastLoop(platform_socket* sock, bool enable); -int SocketJoinMulticastGroup(platform_socket* socket, host_ip group, host_ip interface); -int SocketLeaveMulticastGroup(platform_socket* socket, host_ip group, host_ip interface); - -//---------------------------------------------------------------------------------- -//Ancillary data API -//---------------------------------------------------------------------------------- -typedef struct -{ - u64 messageBufferSize; - char* messageBuffer; - - u64 controlBufferSize; - char* controlBuffer; -} socket_msg; - -int SocketReceiveMessage(platform_socket* socket, socket_msg* msg, socket_address* from); - -#ifdef __cplusplus -} // extern "C" -#endif - - -#endif //__PLATFORM_SOCKET_H_ diff --git a/src/platform/platform_thread.h b/src/platform/platform_thread.h index f54ec0f..3abaab5 100644 --- a/src/platform/platform_thread.h +++ b/src/platform/platform_thread.h @@ -9,6 +9,7 @@ #ifndef __PLATFORM_THREAD_H_ #define __PLATFORM_THREAD_H_ +#include"util/strings.h" #ifdef __cplusplus #include @@ -27,59 +28,64 @@ extern "C" { enum { - MP_THREAD_NAME_MAX_SIZE = 64, // including null terminator + OC_THREAD_NAME_MAX_SIZE = 64, // including null terminator }; -typedef struct mp_thread mp_thread; +typedef struct oc_thread oc_thread; -typedef i32 (*mp_thread_start_function)(void* userPointer); +typedef i32 (*oc_thread_start_function)(void* userPointer); -MP_API mp_thread* mp_thread_create(mp_thread_start_function start, void* userPointer); -MP_API mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* userPointer, const char* name); -MP_API const char* mp_thread_get_name(mp_thread* thread); -MP_API u64 mp_thread_unique_id(mp_thread* thread); -MP_API u64 mp_thread_self_id(); -MP_API int mp_thread_signal(mp_thread* thread, int sig); -MP_API int mp_thread_join(mp_thread* thread, i64* exitCode); -MP_API int mp_thread_detach(mp_thread* thread); +ORCA_API oc_thread* oc_thread_create(oc_thread_start_function start, void* userPointer); +ORCA_API oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* userPointer, oc_str8 name); +ORCA_API oc_str8 oc_thread_get_name(oc_thread* thread); +ORCA_API u64 oc_thread_unique_id(oc_thread* thread); +ORCA_API u64 oc_thread_self_id(); +ORCA_API int oc_thread_signal(oc_thread* thread, int sig); +ORCA_API int oc_thread_join(oc_thread* thread, i64* exitCode); +ORCA_API int oc_thread_detach(oc_thread* thread); //--------------------------------------------------------------- // Platform Mutex API //--------------------------------------------------------------- -typedef struct mp_mutex mp_mutex; +typedef struct oc_mutex oc_mutex; -MP_API mp_mutex* mp_mutex_create(); -MP_API int mp_mutex_destroy(mp_mutex* mutex); -MP_API int mp_mutex_lock(mp_mutex* mutex); -MP_API int mp_mutex_unlock(mp_mutex* mutex); +ORCA_API oc_mutex* oc_mutex_create(); +ORCA_API int oc_mutex_destroy(oc_mutex* mutex); +ORCA_API int oc_mutex_lock(oc_mutex* mutex); +ORCA_API int oc_mutex_unlock(oc_mutex* mutex); //--------------------------------------------------------------- // Lightweight ticket mutex API //--------------------------------------------------------------- -typedef struct mp_ticket_spin_mutex +typedef struct oc_ticket { volatile _Atomic(u64) nextTicket; volatile _Atomic(u64) serving; -} mp_ticket_spin_mutex; +} oc_ticket; -MP_API void mp_ticket_spin_mutex_init(mp_ticket_spin_mutex* mutex); -MP_API void mp_ticket_spin_mutex_lock(mp_ticket_spin_mutex* mutex); -MP_API void mp_ticket_spin_mutex_unlock(mp_ticket_spin_mutex* mutex); +ORCA_API void oc_ticket_init(oc_ticket* mutex); +ORCA_API void oc_ticket_lock(oc_ticket* mutex); +ORCA_API void oc_ticket_unlock(oc_ticket* mutex); //--------------------------------------------------------------- // Platform condition variable API //--------------------------------------------------------------- -typedef struct mp_condition mp_condition; +typedef struct oc_condition oc_condition; -MP_API mp_condition* mp_condition_create(); -MP_API int mp_condition_destroy(mp_condition* cond); -MP_API int mp_condition_wait(mp_condition* cond, mp_mutex* mutex); -MP_API int mp_condition_timedwait(mp_condition* cond, mp_mutex* mutex, f64 seconds); -MP_API int mp_condition_signal(mp_condition* cond); -MP_API int mp_condition_broadcast(mp_condition* cond); +ORCA_API oc_condition* oc_condition_create(); +ORCA_API int oc_condition_destroy(oc_condition* cond); +ORCA_API int oc_condition_wait(oc_condition* cond, oc_mutex* mutex); +ORCA_API int oc_condition_timedwait(oc_condition* cond, oc_mutex* mutex, f64 seconds); +ORCA_API int oc_condition_signal(oc_condition* cond); +ORCA_API int oc_condition_broadcast(oc_condition* cond); + +//--------------------------------------------------------------- +// Putting threads to sleep +//--------------------------------------------------------------- +ORCA_API void oc_sleep_nano(u64 nanoseconds); // sleep for a given number of nanoseconds #ifdef __cplusplus } // extern "C" diff --git a/src/platform/posix_io.c b/src/platform/posix_io.c index 0b9449c..ef36510 100644 --- a/src/platform/posix_io.c +++ b/src/platform/posix_io.c @@ -15,116 +15,116 @@ #include"platform_io_common.c" #include"platform_io_internal.c" -io_file_desc io_file_desc_nil() +oc_file_desc oc_file_desc_nil() { return(-1); } -bool io_file_desc_is_nil(io_file_desc fd) +bool oc_file_desc_is_nil(oc_file_desc fd) { return(fd < 0); } -io_error io_raw_last_error() +oc_io_error oc_io_raw_last_error() { - io_error error = IO_OK; + oc_io_error error = OC_IO_OK; switch(errno) { case EPERM: case EACCES: case EROFS: - error = IO_ERR_PERM; + error = OC_IO_ERR_PERM; break; case ENOENT: - error = IO_ERR_NO_ENTRY; + error = OC_IO_ERR_NO_ENTRY; break; case EINTR: - error = IO_ERR_INTERRUPT; + error = OC_IO_ERR_INTERRUPT; break; case EIO: - error = IO_ERR_PHYSICAL; + error = OC_IO_ERR_PHYSICAL; break; case ENXIO: - error = IO_ERR_NO_DEVICE; + error = OC_IO_ERR_NO_DEVICE; break; case EBADF: // this should only happen when user tries to write/read to a file handle // opened with readonly/writeonly access - error = IO_ERR_PERM; + error = OC_IO_ERR_PERM; break; case ENOMEM: - error = IO_ERR_MEM; + error = OC_IO_ERR_MEM; break; case EFAULT: case EINVAL: case EDOM: - error = IO_ERR_ARG; + error = OC_IO_ERR_ARG; break; case EBUSY: case EAGAIN: - error = IO_ERR_NOT_READY; + error = OC_IO_ERR_NOT_READY; break; case EEXIST: - error = IO_ERR_EXISTS; + error = OC_IO_ERR_EXISTS; break; case ENOTDIR: - error = IO_ERR_NOT_DIR; + error = OC_IO_ERR_NOT_DIR; break; case EISDIR: - error = IO_ERR_DIR; + error = OC_IO_ERR_DIR; break; case ENFILE: case EMFILE: - error = IO_ERR_MAX_FILES; + error = OC_IO_ERR_MAX_FILES; break; case EFBIG: - error = IO_ERR_FILE_SIZE; + error = OC_IO_ERR_FILE_SIZE; break; case ENOSPC: case EDQUOT: - error = IO_ERR_SPACE; + error = OC_IO_ERR_SPACE; break; case ELOOP: - error = IO_ERR_MAX_LINKS; + error = OC_IO_ERR_MAX_LINKS; break; case ENAMETOOLONG: - error = IO_ERR_PATH_LENGTH; + error = OC_IO_ERR_PATH_LENGTH; break; case EOVERFLOW: - error = IO_ERR_OVERFLOW; + error = OC_IO_ERR_OVERFLOW; break; default: - error = IO_ERR_UNKNOWN; + error = OC_IO_ERR_UNKNOWN; break; } return(error); } -int io_convert_access_rights(file_access_rights rights) +static int oc_io_convert_access_rights(oc_file_access rights) { int oflags = 0; - if(rights & FILE_ACCESS_READ) + if(rights & OC_FILE_ACCESS_READ) { - if(rights & FILE_ACCESS_WRITE) + if(rights & OC_FILE_ACCESS_WRITE) { oflags = O_RDWR; } @@ -133,41 +133,41 @@ int io_convert_access_rights(file_access_rights rights) oflags = O_RDONLY; } } - else if(rights & FILE_ACCESS_WRITE) + else if(rights & OC_FILE_ACCESS_WRITE) { oflags = O_WRONLY; } return(oflags); } -int io_convert_open_flags(file_open_flags flags) +static int oc_io_convert_open_flags(oc_file_open_flags flags) { int oflags = 0; - if(flags & FILE_OPEN_TRUNCATE) + if(flags & OC_FILE_OPEN_TRUNCATE) { oflags |= O_TRUNC; } - if(flags & FILE_OPEN_APPEND) + if(flags & OC_FILE_OPEN_APPEND) { oflags |= O_APPEND; } - if(flags & FILE_OPEN_CREATE) + if(flags & OC_FILE_OPEN_CREATE) { oflags |= O_CREAT; } - if(flags & FILE_OPEN_NO_FOLLOW) + if(flags & OC_FILE_OPEN_NO_FOLLOW) { oflags |= O_NOFOLLOW; } - if(flags & FILE_OPEN_SYMLINK) + if(flags & OC_FILE_OPEN_SYMLINK) { oflags |= O_SYMLINK; } return(oflags); } -int io_update_dir_flags_at(int dirFd, char* path, int flags) +static int oc_io_update_dir_flags_at(int dirFd, char* path, int flags) { struct stat s; if(!fstatat(dirFd, path, &s, AT_SYMLINK_NOFOLLOW)) @@ -188,10 +188,10 @@ int io_update_dir_flags_at(int dirFd, char* path, int flags) return(flags); } -io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights accessRights, file_open_flags openFlags) +oc_file_desc oc_io_raw_open_at(oc_file_desc dirFd, oc_str8 path, oc_file_access accessRights, oc_file_open_flags openFlags) { - int flags = io_convert_access_rights(accessRights); - flags |= io_convert_open_flags(openFlags); + int flags = oc_io_convert_access_rights(accessRights); + flags |= oc_io_convert_open_flags(openFlags); mode_t mode = S_IRUSR | S_IWUSR @@ -200,18 +200,18 @@ io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights ac | S_IROTH | S_IWOTH; - mem_arena_scope scratch = mem_scratch_begin(); + oc_arena_scope scratch = oc_scratch_begin(); - io_file_desc fd = -1; + oc_file_desc fd = -1; if(dirFd >= 0) { if(path.len && path.ptr[0] == '/') { //NOTE: if path is absolute, change for a relative one, otherwise openat ignores fd. - str8_list list = {0}; - str8_list_push(scratch.arena, &list, STR8(".")); - str8_list_push(scratch.arena, &list, path); - path = str8_list_join(scratch.arena, list); + oc_str8_list list = {0}; + oc_str8_list_push(scratch.arena, &list, OC_STR8(".")); + oc_str8_list_push(scratch.arena, &list, path); + path = oc_str8_list_join(scratch.arena, list); } } else @@ -219,98 +219,98 @@ io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights ac dirFd = AT_FDCWD; } - char* pathCStr = str8_to_cstring(scratch.arena, path); + char* pathCStr = oc_str8_to_cstring(scratch.arena, path); - flags = io_update_dir_flags_at(dirFd, pathCStr, flags); + flags = oc_io_update_dir_flags_at(dirFd, pathCStr, flags); fd = openat(dirFd, pathCStr, flags, mode); - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(fd); } -void io_raw_close(io_file_desc fd) +void oc_io_raw_close(oc_file_desc fd) { close(fd); } -file_perm io_convert_perm_from_stat(u16 mode) +static oc_file_perm oc_io_convert_perm_from_stat(u16 mode) { - file_perm perm = mode & 07777; + oc_file_perm perm = mode & 07777; return(perm); } -file_type io_convert_type_from_stat(u16 mode) +static oc_file_type oc_io_convert_type_from_stat(u16 mode) { - file_type type; + oc_file_type type; switch(mode & S_IFMT) { case S_IFIFO: - type = MP_FILE_FIFO; + type = OC_FILE_FIFO; break; case S_IFCHR: - type = MP_FILE_CHARACTER; + type = OC_FILE_CHARACTER; break; case S_IFDIR: - type = MP_FILE_DIRECTORY; + type = OC_FILE_DIRECTORY; break; case S_IFBLK: - type = MP_FILE_BLOCK; + type = OC_FILE_BLOCK; break; case S_IFREG: - type = MP_FILE_REGULAR; + type = OC_FILE_REGULAR; break; case S_IFLNK: - type = MP_FILE_SYMLINK; + type = OC_FILE_SYMLINK; break; case S_IFSOCK: - type = MP_FILE_SOCKET; + type = OC_FILE_SOCKET; break; default: - type = MP_FILE_UNKNOWN; + type = OC_FILE_UNKNOWN; break; } return(type); } -io_error io_raw_fstat(io_file_desc fd, file_status* status) +oc_io_error oc_io_raw_fstat(oc_file_desc fd, oc_file_status* status) { - io_error error = IO_OK; + oc_io_error error = OC_IO_OK; struct stat s; if(fstat(fd, &s)) { - error = io_raw_last_error(); + error = oc_io_raw_last_error(); } else { status->uid = s.st_ino; - status->perm = io_convert_perm_from_stat(s.st_mode); - status->type = io_convert_type_from_stat(s.st_mode); + status->perm = oc_io_convert_perm_from_stat(s.st_mode); + status->type = oc_io_convert_type_from_stat(s.st_mode); status->size = s.st_size; //TODO: times } return(error); } -io_error io_raw_fstat_at(io_file_desc dirFd, str8 path, file_open_flags flags, file_status* status) +oc_io_error oc_io_raw_fstat_at(oc_file_desc dirFd, oc_str8 path, oc_file_open_flags flags, oc_file_status* status) { - mem_arena_scope scratch = mem_scratch_begin(); + oc_arena_scope scratch = oc_scratch_begin(); if(dirFd >= 0) { if(path.len && path.ptr[0] == '/') { - str8_list list = {0}; - str8_list_push(scratch.arena, &list, STR8(".")); - str8_list_push(scratch.arena, &list, path); - path = str8_list_join(scratch.arena, list); + oc_str8_list list = {0}; + oc_str8_list_push(scratch.arena, &list, OC_STR8(".")); + oc_str8_list_push(scratch.arena, &list, path); + path = oc_str8_list_join(scratch.arena, list); } } else @@ -318,40 +318,40 @@ io_error io_raw_fstat_at(io_file_desc dirFd, str8 path, file_open_flags flags, f dirFd = AT_FDCWD; } - char* pathCStr = str8_to_cstring(scratch.arena, path); + char* pathCStr = oc_str8_to_cstring(scratch.arena, path); - int statFlag = (flags & FILE_OPEN_SYMLINK)? AT_SYMLINK_NOFOLLOW : 0; - io_error error = IO_OK; + int statFlag = (flags & OC_FILE_OPEN_SYMLINK)? AT_SYMLINK_NOFOLLOW : 0; + oc_io_error error = OC_IO_OK; struct stat s; if(fstatat(dirFd, pathCStr, &s, statFlag)) { - error = io_raw_last_error(); + error = oc_io_raw_last_error(); } else { status->uid = s.st_ino; - status->perm = io_convert_perm_from_stat(s.st_mode); - status->type = io_convert_type_from_stat(s.st_mode); + status->perm = oc_io_convert_perm_from_stat(s.st_mode); + status->type = oc_io_convert_type_from_stat(s.st_mode); status->size = s.st_size; //TODO: times } - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(error); } -io_raw_read_link_result io_raw_read_link_at(mem_arena* arena, io_file_desc dirFd, str8 path) +oc_io_raw_read_link_result oc_io_raw_read_link_at(oc_arena* arena, oc_file_desc dirFd, oc_str8 path) { - mem_arena_scope scratch = mem_scratch_begin_next(arena); + oc_arena_scope scratch = oc_scratch_begin_next(arena); if(dirFd >= 0) { if(path.len && path.ptr[0] == '/') { - str8_list list = {0}; - str8_list_push(scratch.arena, &list, STR8(".")); - str8_list_push(scratch.arena, &list, path); - path = str8_list_join(scratch.arena, list); + oc_str8_list list = {0}; + oc_str8_list_push(scratch.arena, &list, OC_STR8(".")); + oc_str8_list_push(scratch.arena, &list, path); + path = oc_str8_list_join(scratch.arena, list); } } else @@ -359,9 +359,9 @@ io_raw_read_link_result io_raw_read_link_at(mem_arena* arena, io_file_desc dirFd dirFd = AT_FDCWD; } - char* pathCStr = str8_to_cstring(scratch.arena, path); + char* pathCStr = oc_str8_to_cstring(scratch.arena, path); - io_raw_read_link_result result = {0}; + oc_io_raw_read_link_result result = {0}; char buffer[PATH_MAX]; u64 bufferSize = PATH_MAX; @@ -369,31 +369,31 @@ io_raw_read_link_result io_raw_read_link_at(mem_arena* arena, io_file_desc dirFd if(r<0) { - result.error = io_raw_last_error(); + result.error = oc_io_raw_last_error(); } else { result.target.len = r; - result.target.ptr = mem_arena_alloc_array(arena, char, result.target.len); + result.target.ptr = oc_arena_push_array(arena, char, result.target.len); memcpy(result.target.ptr, buffer, result.target.len); } - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(result); } -bool io_raw_file_exists_at(io_file_desc dirFd, str8 path, file_open_flags openFlags) +bool oc_io_raw_file_exists_at(oc_file_desc dirFd, oc_str8 path, oc_file_open_flags openFlags) { - mem_arena_scope scratch = mem_scratch_begin(); + oc_arena_scope scratch = oc_scratch_begin(); if(dirFd >= 0) { if(path.len && path.ptr[0] == '/') { - str8_list list = {0}; - str8_list_push(scratch.arena, &list, STR8(".")); - str8_list_push(scratch.arena, &list, path); - path = str8_list_join(scratch.arena, list); + oc_str8_list list = {0}; + oc_str8_list_push(scratch.arena, &list, OC_STR8(".")); + oc_str8_list_push(scratch.arena, &list, path); + path = oc_str8_list_join(scratch.arena, list); } } else @@ -401,48 +401,48 @@ bool io_raw_file_exists_at(io_file_desc dirFd, str8 path, file_open_flags openFl dirFd = AT_FDCWD; } - char* pathCStr = str8_to_cstring(scratch.arena, path); + char* pathCStr = oc_str8_to_cstring(scratch.arena, path); - int flags = (openFlags & FILE_OPEN_SYMLINK)? AT_SYMLINK_NOFOLLOW : 0; + int flags = (openFlags & OC_FILE_OPEN_SYMLINK)? AT_SYMLINK_NOFOLLOW : 0; int r = faccessat(dirFd, pathCStr, F_OK, flags); bool result = (r == 0); - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(result); } -io_cmp io_close(file_slot* slot, io_req* req, file_table* table) +oc_io_cmp oc_io_close(oc_file_slot* slot, oc_io_req* req, oc_file_table* table) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; if(slot->fd >= 0) { close(slot->fd); } - file_slot_recycle(table, slot); + oc_file_slot_recycle(table, slot); return(cmp); } -io_cmp io_fstat(file_slot* slot, io_req* req) +oc_io_cmp oc_io_fstat(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; - if(req->size < sizeof(file_status)) + if(req->size < sizeof(oc_file_status)) { - cmp.error = IO_ERR_ARG; + cmp.error = OC_IO_ERR_ARG; } else { struct stat s; if(fstat(slot->fd, &s)) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); cmp.error = slot->error; } else { - file_status* status = (file_status*)req->buffer; - status->perm = io_convert_perm_from_stat(s.st_mode); - status->type = io_convert_type_from_stat(s.st_mode); + oc_file_status* status = (oc_file_status*)req->buffer; + status->perm = oc_io_convert_perm_from_stat(s.st_mode); + status->type = oc_io_convert_type_from_stat(s.st_mode); status->size = s.st_size; //TODO: times } @@ -450,44 +450,44 @@ io_cmp io_fstat(file_slot* slot, io_req* req) return(cmp); } -io_cmp io_seek(file_slot* slot, io_req* req) +oc_io_cmp oc_io_seek(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; int whence; switch(req->whence) { - case FILE_SEEK_CURRENT: + case OC_FILE_SEEK_CURRENT: whence = SEEK_CUR; break; - case FILE_SEEK_SET: + case OC_FILE_SEEK_SET: whence = SEEK_SET; break; - case FILE_SEEK_END: + case OC_FILE_SEEK_END: whence = SEEK_END; } cmp.result = lseek(slot->fd, req->offset, whence); if(cmp.result < 0) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); cmp.error = slot->error; } return(cmp); } -io_cmp io_read(file_slot* slot, io_req* req) +oc_io_cmp oc_io_read(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; cmp.result = read(slot->fd, req->buffer, req->size); if(cmp.result < 0) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); cmp.result = 0; cmp.error = slot->error; } @@ -495,15 +495,15 @@ io_cmp io_read(file_slot* slot, io_req* req) return(cmp); } -io_cmp io_write(file_slot* slot, io_req* req) +oc_io_cmp oc_io_write(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; cmp.result = write(slot->fd, req->buffer, req->size); if(cmp.result < 0) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); cmp.result = 0; cmp.error = slot->error; } @@ -511,66 +511,66 @@ io_cmp io_write(file_slot* slot, io_req* req) return(cmp); } -io_cmp io_get_error(file_slot* slot, io_req* req) +oc_io_cmp oc_io_get_error(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; cmp.result = slot->error; return(cmp); } -io_cmp io_wait_single_req_with_table(io_req* req, file_table* table) +oc_io_cmp oc_io_wait_single_req_with_table(oc_io_req* req, oc_file_table* table) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; - file_slot* slot = file_slot_from_handle(table, req->handle); + oc_file_slot* slot = oc_file_slot_from_handle(table, req->handle); if(!slot) { - if(req->op != IO_OP_OPEN_AT) + if(req->op != OC_IO_OPEN_AT) { - cmp.error = IO_ERR_HANDLE; + cmp.error = OC_IO_ERR_HANDLE; } } else if( slot->fatal - && req->op != IO_OP_CLOSE - && req->op != IO_OP_ERROR) + && req->op != OC_IO_CLOSE + && req->op != OC_OC_IO_ERROR) { - cmp.error = IO_ERR_PREV; + cmp.error = OC_IO_ERR_PREV; } - if(cmp.error == IO_OK) + if(cmp.error == OC_IO_OK) { switch(req->op) { - case IO_OP_OPEN_AT: - cmp = io_open_at(slot, req, table); + case OC_IO_OPEN_AT: + cmp = oc_io_open_at(slot, req, table); break; - case IO_OP_FSTAT: - cmp = io_fstat(slot, req); + case OC_IO_FSTAT: + cmp = oc_io_fstat(slot, req); break; - case IO_OP_CLOSE: - cmp = io_close(slot, req, table); + case OC_IO_CLOSE: + cmp = oc_io_close(slot, req, table); break; - case IO_OP_READ: - cmp = io_read(slot, req); + case OC_IO_READ: + cmp = oc_io_read(slot, req); break; - case IO_OP_WRITE: - cmp = io_write(slot, req); + case OC_IO_WRITE: + cmp = oc_io_write(slot, req); break; - case IO_OP_SEEK: - cmp = io_seek(slot, req); + case OC_IO_SEEK: + cmp = oc_io_seek(slot, req); break; - case IO_OP_ERROR: - cmp = io_get_error(slot, req); + case OC_OC_IO_ERROR: + cmp = oc_io_get_error(slot, req); break; default: - cmp.error = IO_ERR_OP; + cmp.error = OC_IO_ERR_OP; break; } } diff --git a/src/platform/posix_socket.c b/src/platform/posix_socket.c deleted file mode 100644 index 6f471fb..0000000 --- a/src/platform/posix_socket.c +++ /dev/null @@ -1,511 +0,0 @@ -/************************************************************//** -* -* @file: posix_socket.c -* @author: Martin Fouilleul -* @date: 22/03/2019 -* @revision: -* -*****************************************************************/ - -#include // socket() -#include // socaddr_in -#include // inet_addr() -#include // getifaddrs() / freeifaddrs() -#include // close() -#include // strerror() -#include // errno -#include // malloc()/free() - -#include"platform_socket.h" -#include"platform_debug.h" - -typedef struct in_addr in_addr; -typedef struct sockaddr_in sockaddr_in; -typedef struct sockaddr sockaddr; -typedef struct msghdr msghdr; -typedef struct cmsghdr cmsghdr; -typedef struct ip_mreq ip_mreq; -typedef struct iovec iovec; - -net_ip StringToNetIP(const char* addr) -{ - return(inet_addr(addr)); -} -const char* NetIPToString(net_ip ip) -{ - in_addr in; - in.s_addr = ip; - return(inet_ntoa(in)); -} - -host_ip StringToHostIP(const char* addr) -{ - return(NetToHostIP(StringToNetIP(addr))); -} -const char* HostIPToString(host_ip ip) -{ - return(NetIPToString(HostToNetIP(ip))); -} - -net_ip HostToNetIP(uint32 ip) -{ - return(htonl(ip)); -} -net_port HostToNetPort(uint16 port) -{ - return(htons(port)); -} -uint32 NetToHostIP(net_ip ip) -{ - return(ntohl(ip)); -} -uint16 NetToHostPort(net_port port) -{ - return(ntohs(port)); -} - -static int PlatformToSocketFlags(int flags) -{ - int sflags = 0; - if(flags & SOCK_MSG_OOB) - { - sflags |= MSG_OOB; - } - if(flags & SOCK_MSG_PEEK) - { - sflags |= MSG_PEEK; - } - if(flags & SOCK_MSG_DONTROUTE) - { - sflags |= MSG_DONTROUTE; - } - if(flags & SOCK_MSG_WAITALL) - { - sflags |= MSG_WAITALL; - } - - return(sflags); -} - -static int ErrnoToSocketError(int err) -{ - //TODO(martin): extend these error codes - switch(err) - { - case 0: return(SOCK_ERR_OK); - case EACCES: return(SOCK_ERR_ACCESS); - case ENOBUFS: - case ENOMEM: return(SOCK_ERR_MEM); - case EINTR: return(SOCK_ERR_INTR); - case EADDRINUSE: return(SOCK_ERR_USED); - case EBADF: return(SOCK_ERR_BADF); - case ECONNABORTED: return(SOCK_ERR_ABORT); - - case EWOULDBLOCK: - #if EAGAIN != EWOULDBLOCK - case EAGAIN: - #endif - return(SOCK_ERR_NBLOCK); - - default: - return(SOCK_ERR_UNKNOWN); - } -} - -int SocketGetLastError() -{ - return(ErrnoToSocketError(errno)); -} - -const char* SocketGetLastErrorMessage() -{ - return(strerror(errno)); -} - -struct platform_socket -{ - int sd; -}; - -platform_socket* SocketOpen(socket_transport transport) -{ - int sd = 0; - switch(transport) - { - case SOCK_UDP: - sd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - break; - - case SOCK_TCP: - sd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - break; - } - if(!sd) - { - return(0); - } - - platform_socket* sock = (platform_socket*)malloc(sizeof(platform_socket)); - if(!sock) - { - close(sd); - return(0); - } - sock->sd = sd; - return(sock); -} - -int SocketClose(platform_socket* sock) -{ - if(!sock) - { - return(-1); - } - int res = close(sock->sd); - free(sock); - return(res); -} - -int SocketBind(platform_socket* sock, socket_address* addr) -{ - sockaddr_in saddr; - saddr.sin_addr.s_addr = addr->ip; - saddr.sin_port = addr->port; - saddr.sin_family = AF_INET; - - return(bind(sock->sd, (sockaddr*)&saddr, sizeof(saddr))); -} - -int SocketListen(platform_socket* sock, int backlog) -{ - return(listen(sock->sd, backlog)); -} -platform_socket* SocketAccept(platform_socket* sock, socket_address* from) -{ - sockaddr_in saddr; - socklen_t saddrSize = sizeof(saddr); - int sd = accept(sock->sd, (sockaddr*)&saddr, &saddrSize); - - from->ip = saddr.sin_addr.s_addr; - from->port = saddr.sin_port; - - if(sd <= 0) - { - return(0); - } - else - { - platform_socket* client = (platform_socket*)malloc(sizeof(platform_socket)); - if(!client) - { - close(sd); - return(0); - } - client->sd = sd; - return(client); - - } -} - -int SocketConnect(platform_socket* sock, socket_address* addr) -{ - sockaddr_in saddr; - saddr.sin_addr.s_addr = addr->ip; - saddr.sin_port = addr->port; - saddr.sin_family = AF_INET; - - return(connect(sock->sd, (sockaddr*)&saddr, sizeof(saddr))); -} - -int64 SocketReceive(platform_socket* sock, void* buffer, uint64 size, int flags) -{ - return(recv(sock->sd, buffer, size, PlatformToSocketFlags(flags))); -} - -int64 SocketReceiveFrom(platform_socket* sock, void* buffer, uint64 size, int flags, socket_address* from) -{ - sockaddr_in saddr; - socklen_t saddrSize = sizeof(saddr); - - int res = recvfrom(sock->sd, buffer, size, PlatformToSocketFlags(flags), (sockaddr*)&saddr, &saddrSize); - - from->ip = saddr.sin_addr.s_addr; - from->port = saddr.sin_port; - return(res); -} - -int64 SocketSend(platform_socket* sock, void* buffer, uint64 size, int flags) -{ - return(send(sock->sd, buffer, size, PlatformToSocketFlags(flags))); -} -int64 SocketSendTo(platform_socket* sock, void* buffer, uint64 size, int flags, socket_address* to) -{ - sockaddr_in saddr; - saddr.sin_addr.s_addr = to->ip; - saddr.sin_port = to->port; - saddr.sin_family = AF_INET; - - return(sendto(sock->sd, buffer, size, PlatformToSocketFlags(flags), (sockaddr*)&saddr, sizeof(saddr))); -} - - -int SocketSetReceiveTimeout(platform_socket* sock, timeval* tv) -{ - DEBUG_ASSERT(sock); - DEBUG_ASSERT(sock->sd); - return(setsockopt(sock->sd, SOL_SOCKET, SO_RCVTIMEO, tv, sizeof(timeval))); -} - -int SocketSetSendTimeout(platform_socket* sock, timeval* tv) -{ - DEBUG_ASSERT(sock); - DEBUG_ASSERT(sock->sd); - return(setsockopt(sock->sd, SOL_SOCKET, SO_SNDTIMEO, tv, sizeof(timeval))); -} - -int SocketSetReceiveTimestamping(platform_socket* socket, bool enable) -{ - int opt = enable ? 1 : 0; - socklen_t len = sizeof(int); - return(setsockopt(socket->sd, SOL_SOCKET, SO_TIMESTAMP, &enable, len)); -} - -int SocketSetBroadcast(platform_socket* sock, bool enable) -{ - DEBUG_ASSERT(sock); - DEBUG_ASSERT(sock->sd); - - int opt = enable ? 1 : 0; - return(setsockopt(sock->sd, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(int))); -} - - -int SocketSelect(uint32 count, socket_activity* set, double timeout) -{ - fd_set fdInSet; - fd_set fdOutSet; - fd_set fdErrSet; - FD_ZERO(&fdInSet); - FD_ZERO(&fdOutSet); - FD_ZERO(&fdErrSet); - - int maxSd = -1; - for(int i=0; isock) - { - item->set = 0; - if(item->watch & SOCK_ACTIVITY_IN) - { - FD_SET(item->sock->sd, &fdInSet); - } - if(item->watch & SOCK_ACTIVITY_OUT) - { - FD_SET(item->sock->sd, &fdOutSet); - } - if(item->watch & SOCK_ACTIVITY_ERR) - { - FD_SET(item->sock->sd, &fdErrSet); - } - - if(item->watch && (item->sock->sd > maxSd)) - { - maxSd = item->sock->sd; - } - } - } - - if(maxSd <= 0) - { - return(0); - } - timeval tv; - tv.tv_sec = (time_t)timeout; - tv.tv_usec = (suseconds_t)((timeout - tv.tv_sec)*1000000); - - timeval* ptv = timeout >= 0 ? &tv : 0; - - int activity = select(maxSd+1, &fdInSet, &fdOutSet, &fdErrSet, ptv); - if(activity < 0) - { - return(-1); - } - - int processed = 0; - for(int i=0; i= activity) - { - break; - } - socket_activity* item = &(set[i]); - if(item->sock) - { - if(FD_ISSET(item->sock->sd, &fdInSet)) - { - item->set |= SOCK_ACTIVITY_IN; - } - if(FD_ISSET(item->sock->sd, &fdOutSet)) - { - item->set |= SOCK_ACTIVITY_OUT; - } - if(FD_ISSET(item->sock->sd, &fdErrSet)) - { - item->set |= SOCK_ACTIVITY_ERR; - } - if(item->set) - { - processed++; - } - } - } - return(activity); -} - - -int SocketGetAddress(platform_socket* sock, socket_address* addr) -{ - sockaddr_in saddr; - socklen_t sockLen = sizeof(saddr); - if(getsockname(sock->sd, (sockaddr*)&saddr, &sockLen)) - { - return(-1); - } - addr->ip = saddr.sin_addr.s_addr; - addr->port = saddr.sin_port; - - return(0); -} - - -int SocketGetIFAddresses(int* count, net_ip* ips) -{ - struct ifaddrs* ifaList = 0; - if(getifaddrs(&ifaList)) - { - return(-1); - } - - int maxCount = *count; - int i = 0; - - for(struct ifaddrs* ifa = ifaList; ifa != 0 ; ifa = ifa->ifa_next) - { - if(i >= maxCount) - { - freeifaddrs(ifaList); - *count = i; - return(-1); - } - if(ifa->ifa_addr->sa_family == AF_INET) - { - struct in_addr in = ((sockaddr_in*)ifa->ifa_addr)->sin_addr; - ips[i] = in.s_addr; - i++; - } - } - freeifaddrs(ifaList); - *count = i; - return(0); -} - - -int SocketSetReuseAddress(platform_socket* sock, bool enable) -{ - int reuse = enable ? 1 : 0; - return(setsockopt(sock->sd, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, sizeof(reuse))); -} - -int SocketSetReusePort(platform_socket* sock, bool enable) -{ - int reuse = enable ? 1 : 0; - return(setsockopt(sock->sd, SOL_SOCKET, SO_REUSEPORT, (char*)&reuse, sizeof(reuse))); -} - -int SocketSetMulticastLoop(platform_socket* sock, bool enable) -{ - int on = enable ? 1 : 0; - return(setsockopt(sock->sd, IPPROTO_IP, IP_MULTICAST_LOOP, (char*)&on, sizeof(on))); -} - -int SocketJoinMulticastGroup(platform_socket* sock, host_ip group, host_ip interface) -{ - ip_mreq mreq; - mreq.imr_multiaddr.s_addr = HostToNetIP(group); - mreq.imr_interface.s_addr = HostToNetIP(interface); - return(setsockopt(sock->sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq, sizeof(mreq))); -} - -int SocketLeaveMulticastGroup(platform_socket* sock, host_ip group, host_ip interface) -{ - ip_mreq mreq; - mreq.imr_multiaddr.s_addr = HostToNetIP(group); - mreq.imr_interface.s_addr = HostToNetIP(interface); - return(setsockopt(sock->sd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (char*)&mreq, sizeof(mreq))); -} - - -net_ip SocketGetDefaultExternalIP() -{ - //NOTE(martin): get the default local ip. This is a dumb way to do this - // 'cause I can't be bothered to think of a better way right now :( - - socket_address addr = {.ip = StringToNetIP("8.8.8.8"), - .port = HostToNetPort(5001)}; - - platform_socket* sock = SocketOpen(SOCK_UDP); - if(!sock) - { - log_error("can't create socket"); - return(0); - } - - if(SocketConnect(sock, &addr) != 0) - { - log_error("can't connect socket: %s\n", SocketGetLastErrorMessage()); - log_warning("try loopback interface\n"); - - addr.ip = HostToNetIP(SOCK_IP_LOOPBACK); - if(SocketConnect(sock, &addr) != 0) - { - log_error("can't connect socket: %s\n", SocketGetLastErrorMessage()); - SocketClose(sock); - return(0); - } - } - SocketGetAddress(sock, &addr); - SocketClose(sock); - return(addr.ip); -} - -int SocketReceiveMessage(platform_socket* socket, socket_msg* msg, socket_address* from) -{ - sockaddr_in saddr; - - iovec iov; - iov.iov_base = msg->messageBuffer; - iov.iov_len = msg->messageBufferSize; - - msghdr hdr; - hdr.msg_name = &saddr; - hdr.msg_namelen = sizeof(saddr); - hdr.msg_iov = &iov; - hdr.msg_iovlen = 1; - hdr.msg_control = msg->controlBuffer; - hdr.msg_controllen = msg->controlBufferSize; - - int size = recvmsg(socket->sd, &hdr, 0); - if(size <= 0) - { - return(size); - } - - from->ip = saddr.sin_addr.s_addr; - from->port = saddr.sin_port; - - msg->controlBufferSize = hdr.msg_controllen; - msg->messageBufferSize = iov.iov_len; - - return(size); -} diff --git a/src/platform/posix_thread.c b/src/platform/posix_thread.c index 0727a43..a1925a2 100644 --- a/src/platform/posix_thread.c +++ b/src/platform/posix_thread.c @@ -11,50 +11,54 @@ #include //needed for pthread_kill() on linux #include #include +#include // nanosleep() #include"platform_thread.h" -struct mp_thread +struct oc_thread { bool valid; pthread_t pthread; - mp_thread_start_function start; + oc_thread_start_function start; void* userPointer; - char name[MP_THREAD_NAME_MAX_SIZE]; + oc_str8 name; + char nameBuffer[OC_THREAD_NAME_MAX_SIZE]; }; -static void* mp_thread_bootstrap(void* data) +static void* oc_thread_bootstrap(void* data) { - mp_thread* thread = (mp_thread*)data; - if(strlen(thread->name)) + oc_thread* thread = (oc_thread*)data; + if(thread->name.len) { - pthread_setname_np(thread->name); + pthread_setname_np(thread->nameBuffer); } i32 exitCode = thread->start(thread->userPointer); return((void*)(ptrdiff_t)exitCode); } -mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* userPointer, const char* name) +oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* userPointer, oc_str8 name) { - mp_thread* thread = (mp_thread*)malloc(sizeof(mp_thread)); + oc_thread* thread = (oc_thread*)malloc(sizeof(oc_thread)); if(!thread) { return(0); } - if(name) + if(name.len && name.ptr) { - char* end = stpncpy(thread->name, name, MP_THREAD_NAME_MAX_SIZE-1); + char* end = stpncpy(thread->nameBuffer, name.ptr, oc_min(name.len, OC_THREAD_NAME_MAX_SIZE-1)); *end = '\0'; + thread->name = oc_str8_from_buffer(end - thread->nameBuffer, thread->nameBuffer); } else { - thread->name[0] = '\0'; + thread->nameBuffer[0] = '\0'; + thread->name = oc_str8_from_buffer(0, thread->nameBuffer); } thread->start = start; thread->userPointer = userPointer; - if(pthread_create(&thread->pthread, 0, mp_thread_bootstrap, thread) != 0) + if(pthread_create(&thread->pthread, 0, oc_thread_bootstrap, thread) != 0) { free(thread); return(0); @@ -66,24 +70,24 @@ mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* user } } -mp_thread* mp_thread_create(mp_thread_start_function start, void* userPointer) +oc_thread* oc_thread_create(oc_thread_start_function start, void* userPointer) { - return(mp_thread_create_with_name(start, userPointer, 0)); + return(oc_thread_create_with_name(start, userPointer, (oc_str8){0})); } -const char* mp_thread_get_name(mp_thread* thread) +oc_str8 oc_thread_get_name(oc_thread* thread) { return(thread->name); } -u64 mp_thread_unique_id(mp_thread* thread) +u64 oc_thread_unique_id(oc_thread* thread) { u64 id; pthread_threadid_np(thread->pthread, &id); return(id); } -u64 mp_thread_self_id() +u64 oc_thread_self_id() { pthread_t thread = pthread_self(); u64 id; @@ -91,12 +95,12 @@ u64 mp_thread_self_id() return(id); } -int mp_thread_signal(mp_thread* thread, int sig) +int oc_thread_signal(oc_thread* thread, int sig) { return(pthread_kill(thread->pthread, sig)); } -int mp_thread_join(mp_thread* thread, i64* exitCode) +int oc_thread_join(oc_thread* thread, i64* exitCode) { void* ret; if(pthread_join(thread->pthread, &ret)) @@ -112,7 +116,7 @@ int mp_thread_join(mp_thread* thread, i64* exitCode) return(0); } -int mp_thread_detach(mp_thread* thread) +int oc_thread_detach(oc_thread* thread) { if(pthread_detach(thread->pthread)) { @@ -123,14 +127,14 @@ int mp_thread_detach(mp_thread* thread) } -struct mp_mutex +struct oc_mutex { pthread_mutex_t pmutex; }; -mp_mutex* mp_mutex_create() +oc_mutex* oc_mutex_create() { - mp_mutex* mutex = (mp_mutex*)malloc(sizeof(mp_mutex)); + oc_mutex* mutex = (oc_mutex*)malloc(sizeof(oc_mutex)); if(!mutex) { return(0); @@ -143,7 +147,7 @@ mp_mutex* mp_mutex_create() return(mutex); } -int mp_mutex_destroy(mp_mutex* mutex) +int oc_mutex_destroy(oc_mutex* mutex) { if(pthread_mutex_destroy(&mutex->pmutex) != 0) { @@ -153,44 +157,44 @@ int mp_mutex_destroy(mp_mutex* mutex) return(0); } -int mp_mutex_lock(mp_mutex* mutex) +int oc_mutex_lock(oc_mutex* mutex) { return(pthread_mutex_lock(&mutex->pmutex)); } -int mp_mutex_unlock(mp_mutex* mutex) +int oc_mutex_unlock(oc_mutex* mutex) { return(pthread_mutex_unlock(&mutex->pmutex)); } -// mp_ticket_spin_mutex has a mirrored implementation in win32_thread.c +// oc_ticket has a mirrored implementation in win32_thread.c -void mp_ticket_spin_mutex_init(mp_ticket_spin_mutex* mutex) +void oc_ticket_init(oc_ticket* mutex) { mutex->nextTicket = 0; mutex->serving = 0; } -void mp_ticket_spin_mutex_lock(mp_ticket_spin_mutex* mutex) +void oc_ticket_lock(oc_ticket* mutex) { u64 ticket = atomic_fetch_add(&mutex->nextTicket, 1ULL); while(ticket != mutex->serving); //spin } -void mp_ticket_spin_mutex_unlock(mp_ticket_spin_mutex* mutex) +void oc_ticket_unlock(oc_ticket* mutex) { atomic_fetch_add(&mutex->serving, 1ULL); } -struct mp_condition +struct oc_condition { pthread_cond_t pcond; }; -mp_condition* mp_condition_create() +oc_condition* oc_condition_create() { - mp_condition* cond = (mp_condition*)malloc(sizeof(mp_condition)); + oc_condition* cond = (oc_condition*)malloc(sizeof(oc_condition)); if(!cond) { return(0); @@ -203,7 +207,7 @@ mp_condition* mp_condition_create() return(cond); } -int mp_condition_destroy(mp_condition* cond) +int oc_condition_destroy(oc_condition* cond) { if(pthread_cond_destroy(&cond->pcond) != 0) { @@ -213,12 +217,12 @@ int mp_condition_destroy(mp_condition* cond) return(0); } -int mp_condition_wait(mp_condition* cond, mp_mutex* mutex) +int oc_condition_wait(oc_condition* cond, oc_mutex* mutex) { return(pthread_cond_wait(&cond->pcond, &mutex->pmutex)); } -int mp_condition_timedwait(mp_condition* cond, mp_mutex* mutex, f64 seconds) +int oc_condition_timedwait(oc_condition* cond, oc_mutex* mutex, f64 seconds) { struct timeval tv; gettimeofday(&tv, 0); @@ -235,12 +239,21 @@ int mp_condition_timedwait(mp_condition* cond, mp_mutex* mutex, f64 seconds) return(pthread_cond_timedwait(&cond->pcond, &mutex->pmutex, &ts)); } -int mp_condition_signal(mp_condition* cond) +int oc_condition_signal(oc_condition* cond) { return(pthread_cond_signal(&cond->pcond)); } -int mp_condition_broadcast(mp_condition* cond) +int oc_condition_broadcast(oc_condition* cond) { return(pthread_cond_broadcast(&cond->pcond)); } + + +void oc_sleep_nano(u64 nanoseconds) +{ + timespec rqtp; + rqtp.tv_sec = nanoseconds / 1000000000; + rqtp.tv_nsec = nanoseconds - rqtp.tv_sec * 1000000000; + nanosleep(&rqtp, 0); +} diff --git a/src/platform/unix_memory.c b/src/platform/unix_memory.c index 2b8e5aa..24f4c89 100644 --- a/src/platform/unix_memory.c +++ b/src/platform/unix_memory.c @@ -12,27 +12,27 @@ /*NOTE(martin): Linux and MacOS don't make a distinction between reserved and committed memory, contrary to Windows */ -void mem_base_nop(mem_base_allocator* context, void* ptr, u64 size) {} +void oc_base_nop(oc_base_allocator* context, void* ptr, u64 size) {} -void* mem_base_reserve_mmap(mem_base_allocator* context, u64 size) +void* oc_base_reserve_mmap(oc_base_allocator* context, u64 size) { return(mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, 0, 0)); } -void mem_base_release_mmap(mem_base_allocator* context, void* ptr, u64 size) +void oc_base_release_mmap(oc_base_allocator* context, void* ptr, u64 size) { munmap(ptr, size); } -mem_base_allocator* mem_base_allocator_default() +oc_base_allocator* oc_base_allocator_default() { - static mem_base_allocator base = {}; + static oc_base_allocator base = {}; if(base.reserve == 0) { - base.reserve = mem_base_reserve_mmap; - base.commit = mem_base_nop; - base.decommit = mem_base_nop; - base.release = mem_base_release_mmap; + base.reserve = oc_base_reserve_mmap; + base.commit = oc_base_nop; + base.decommit = oc_base_nop; + base.release = oc_base_release_mmap; } return(&base); } diff --git a/src/platform/unix_rng.c b/src/platform/unix_rng.c deleted file mode 100644 index 0d3603d..0000000 --- a/src/platform/unix_rng.c +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************//** -* -* @file: unix_rng.c -* @author: Martin Fouilleul -* @date: 06/03/2020 -* @revision: -* -*****************************************************************/ - -#include -#include - -#include"platform_debug.h" -#include"typedefs.h" - -int RandomSeedFromDevice() -{ - FILE* urandom = fopen("/dev/urandom", "r"); - if(!urandom) - { - log_error("can't open /dev/urandom\n"); - return(-1); - } - - union - { - u32 u; - char buff[4]; - } seed; - - int size = fread(seed.buff, 1, 4, urandom); - if(size != 4) - { - log_error("couldn't read from /dev/urandom\n"); - return(-1); - } - - fclose(urandom); - srandom(seed.u); - return(0); -} - -u32 RandomU32() -{ - u32 u1 = (u32)random(); - u32 u2 = (u32)random(); - return((u1<<1) | (u2 & 0x01)); -} - -u64 RandomU64() -{ - u64 u1 = (u64)random(); - u64 u2 = (u64)random(); - u64 u3 = (u64)random(); - return((u1<<33) | (u2<<2) | (u3 & 0x03)); -} diff --git a/src/platform/win32_clock.c b/src/platform/win32_clock.c index b524495..d54d38e 100644 --- a/src/platform/win32_clock.c +++ b/src/platform/win32_clock.c @@ -17,14 +17,14 @@ extern "C" { static u64 __performanceCounterFreq = 0; -void mp_clock_init() +void oc_clock_init() { LARGE_INTEGER freq; QueryPerformanceFrequency(&freq); __performanceCounterFreq = freq.QuadPart; } -f64 mp_get_time(mp_clock_kind clock) +f64 oc_clock_time(oc_clock_kind clock) { LARGE_INTEGER counter; QueryPerformanceCounter(&counter); diff --git a/src/platform/win32_io.c b/src/platform/win32_io.c index d14c9d0..001c12a 100644 --- a/src/platform/win32_io.c +++ b/src/platform/win32_io.c @@ -15,72 +15,72 @@ #include"platform_io_internal.c" #include"platform_io_common.c" -io_error io_raw_last_error() +oc_io_error oc_io_raw_last_error() { - io_error error = 0; + oc_io_error error = 0; int winError = GetLastError(); switch(winError) { case ERROR_SUCCESS: - error = IO_OK; + error = OC_IO_OK; break; case ERROR_ACCESS_DENIED: - error = IO_ERR_PERM; + error = OC_IO_ERR_PERM; break; case ERROR_FILE_NOT_FOUND: case ERROR_PATH_NOT_FOUND: case ERROR_INVALID_DRIVE: case ERROR_DIRECTORY: - error = IO_ERR_NO_ENTRY; + error = OC_IO_ERR_NO_ENTRY; break; case ERROR_TOO_MANY_OPEN_FILES: - error = IO_ERR_MAX_FILES; + error = OC_IO_ERR_MAX_FILES; break; case ERROR_NOT_ENOUGH_MEMORY: case ERROR_OUTOFMEMORY: - error = IO_ERR_MEM; + error = OC_IO_ERR_MEM; break; case ERROR_DEV_NOT_EXIST: - error = IO_ERR_NO_DEVICE; + error = OC_IO_ERR_NO_DEVICE; break; case ERROR_FILE_EXISTS: case ERROR_ALREADY_EXISTS: - error = IO_ERR_EXISTS; + error = OC_IO_ERR_EXISTS; break; case ERROR_BUFFER_OVERFLOW: case ERROR_FILENAME_EXCED_RANGE: - error = IO_ERR_PATH_LENGTH; + error = OC_IO_ERR_PATH_LENGTH; break; case ERROR_FILE_TOO_LARGE: - error = IO_ERR_FILE_SIZE; + error = OC_IO_ERR_FILE_SIZE; break; //TODO: complete default: - error = IO_ERR_UNKNOWN; + error = OC_IO_ERR_UNKNOWN; break; } return(error); } -str16 win32_path_from_handle_null_terminated(mem_arena* arena, HANDLE handle) +static oc_str16 win32_path_from_handle_null_terminated(oc_arena* arena, HANDLE handle) { - str16 res = {0}; + oc_str16 res = {0}; res.len = GetFinalPathNameByHandleW(handle, NULL, 0, FILE_NAME_NORMALIZED); if(res.len) { - res.ptr = mem_arena_alloc_array(arena, u16, res.len); + res.ptr = oc_arena_push_array(arena, u16, res.len); if(!GetFinalPathNameByHandleW(handle, res.ptr, res.len, FILE_NAME_NORMALIZED)) { res.len = 0; @@ -90,36 +90,36 @@ str16 win32_path_from_handle_null_terminated(mem_arena* arena, HANDLE handle) return(res); } -typedef HANDLE io_file_desc; +typedef HANDLE oc_file_desc; -io_file_desc io_file_desc_nil() +oc_file_desc oc_file_desc_nil() { return(INVALID_HANDLE_VALUE); } -bool io_file_desc_is_nil(io_file_desc fd) +bool oc_file_desc_is_nil(oc_file_desc fd) { return(fd == NULL || fd == INVALID_HANDLE_VALUE); } -str16 win32_get_path_at_null_terminated(mem_arena* arena, io_file_desc dirFd, str8 path) +static oc_str16 win32_get_path_at_null_terminated(oc_arena* arena, oc_file_desc dirFd, oc_str8 path) { - str16 result = {0}; - mem_arena_scope scratch = mem_scratch_begin_next(arena); + oc_str16 result = {0}; + oc_arena_scope scratch = oc_scratch_begin_next(arena); - str16 dirPathW = win32_path_from_handle_null_terminated(scratch.arena, dirFd); - str16 pathW = win32_utf8_to_wide_null_terminated(scratch.arena, path); + oc_str16 dirPathW = win32_path_from_handle_null_terminated(scratch.arena, dirFd); + oc_str16 pathW = oc_win32_utf8_to_wide_null_terminated(scratch.arena, path); if(dirPathW.len && pathW.len) { u64 fullPathWSize = dirPathW.len + pathW.len; - LPWSTR fullPathW = mem_arena_alloc_array(scratch.arena, u16, fullPathWSize); + LPWSTR fullPathW = oc_arena_push_array(scratch.arena, u16, fullPathWSize); memcpy(fullPathW, dirPathW.ptr, (dirPathW.len-1)*sizeof(u16)); fullPathW[dirPathW.len-1] = '\\'; memcpy(fullPathW + dirPathW.len, pathW.ptr, pathW.len*sizeof(u16)); result.len = fullPathWSize; - result.ptr = mem_arena_alloc_array(arena, wchar_t, result.len); + result.ptr = oc_arena_push_array(arena, wchar_t, result.len); if(PathCanonicalizeW(result.ptr, fullPathW)) { @@ -131,12 +131,12 @@ str16 win32_get_path_at_null_terminated(mem_arena* arena, io_file_desc dirFd, st result.len = 0; } } - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(result); } -io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights accessRights, file_open_flags openFlags) +oc_file_desc oc_io_raw_open_at(oc_file_desc dirFd, oc_str8 path, oc_file_access accessRights, oc_file_open_flags openFlags) { HANDLE handle = INVALID_HANDLE_VALUE; @@ -147,13 +147,13 @@ io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights ac DWORD win32AttributeFlags = FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS; - if(accessRights & FILE_ACCESS_READ) + if(accessRights & OC_FILE_ACCESS_READ) { win32AccessFlags |= GENERIC_READ; } - if(accessRights & FILE_ACCESS_WRITE) + if(accessRights & OC_FILE_ACCESS_WRITE) { - if(accessRights & FILE_OPEN_APPEND) + if(accessRights & OC_FILE_OPEN_APPEND) { win32AccessFlags |= FILE_APPEND_DATA; } @@ -163,9 +163,9 @@ io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights ac } } - if(openFlags & FILE_OPEN_TRUNCATE) + if(openFlags & OC_FILE_OPEN_TRUNCATE) { - if(openFlags & FILE_OPEN_CREATE) + if(openFlags & OC_FILE_OPEN_CREATE) { win32CreateFlags |= CREATE_ALWAYS; } @@ -174,7 +174,7 @@ io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights ac win32CreateFlags |= TRUNCATE_EXISTING; } } - if(openFlags & FILE_OPEN_CREATE) + if(openFlags & OC_FILE_OPEN_CREATE) { if(!(win32CreateFlags & CREATE_ALWAYS)) { @@ -188,13 +188,13 @@ io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights ac win32CreateFlags |= OPEN_EXISTING; } - if(openFlags & FILE_OPEN_SYMLINK) + if(openFlags & OC_FILE_OPEN_SYMLINK) { win32AttributeFlags |= FILE_FLAG_OPEN_REPARSE_POINT; } - mem_arena_scope scratch = mem_scratch_begin(); - str16 pathW = win32_utf8_to_wide_null_terminated(scratch.arena, path); + oc_arena_scope scratch = oc_scratch_begin(); + oc_str16 pathW = oc_win32_utf8_to_wide_null_terminated(scratch.arena, path); if(dirFd == NULL || dirFd == INVALID_HANDLE_VALUE) { @@ -202,41 +202,41 @@ io_file_desc io_raw_open_at(io_file_desc dirFd, str8 path, file_access_rights ac } else { - str16 fullPathW = win32_get_path_at_null_terminated(scratch.arena, dirFd, path); + oc_str16 fullPathW = win32_get_path_at_null_terminated(scratch.arena, dirFd, path); if(fullPathW.len) { handle = CreateFileW(fullPathW.ptr, win32AccessFlags, win32ShareMode, NULL, win32CreateFlags, win32AttributeFlags, NULL); } } - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(handle); } -void io_raw_close(io_file_desc fd) +void oc_io_raw_close(oc_file_desc fd) { CloseHandle(fd); } -bool io_raw_file_exists_at(io_file_desc dirFd, str8 path, file_open_flags openFlags) +bool oc_io_raw_file_exists_at(oc_file_desc dirFd, oc_str8 path, oc_file_open_flags openFlags) { bool result = false; - io_file_desc fd = io_raw_open_at(dirFd, path, FILE_ACCESS_NONE, (openFlags & FILE_OPEN_SYMLINK)); - if(!io_file_desc_is_nil(fd)) + oc_file_desc fd = oc_io_raw_open_at(dirFd, path, OC_FILE_ACCESS_NONE, (openFlags & OC_FILE_OPEN_SYMLINK)); + if(!oc_file_desc_is_nil(fd)) { result = true; - io_raw_close(fd); + oc_io_raw_close(fd); } return(result); } -io_error io_raw_fstat(io_file_desc fd, file_status* status) +oc_io_error oc_io_raw_fstat(oc_file_desc fd, oc_file_status* status) { - io_error error = IO_OK; + oc_io_error error = OC_IO_OK; BY_HANDLE_FILE_INFORMATION info; if(!GetFileInformationByHandle(fd, &info)) { - error = io_raw_last_error(); + error = oc_io_raw_last_error(); } else { @@ -260,53 +260,53 @@ io_error io_raw_fstat(io_file_desc fd, file_status* status) FILE_ATTRIBUTE_TAG_INFO tagInfo; if(!GetFileInformationByHandleEx(fd, FileAttributeTagInfo, &tagInfo, sizeof(tagInfo))) { - error = io_raw_last_error(); + error = oc_io_raw_last_error(); } else if(tagInfo.ReparseTag == IO_REPARSE_TAG_SYMLINK) { - status->type = MP_FILE_SYMLINK; + status->type = OC_FILE_SYMLINK; } else { - status->type = MP_FILE_UNKNOWN; + status->type = OC_FILE_UNKNOWN; } } else if(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - status->type = MP_FILE_DIRECTORY; + status->type = OC_FILE_DIRECTORY; } else if(info.dwFileAttributes & attrRegularSet) { - status->type = MP_FILE_REGULAR; + status->type = OC_FILE_REGULAR; } else { //TODO: might want to check for socket/block/character devices? (otoh MS STL impl. doesn't seem to do it) - status->type = MP_FILE_UNKNOWN; + status->type = OC_FILE_UNKNOWN; } - status->perm = MP_FILE_OWNER_READ | MP_FILE_GROUP_READ | MP_FILE_OTHER_READ; + status->perm = OC_FILE_OWNER_READ | OC_FILE_GROUP_READ | OC_FILE_OTHER_READ; if(!(info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) { - status->perm = MP_FILE_OWNER_WRITE | MP_FILE_GROUP_WRITE | MP_FILE_OTHER_WRITE; + status->perm = OC_FILE_OWNER_WRITE | OC_FILE_GROUP_WRITE | OC_FILE_OTHER_WRITE; } //TODO: times } return(error); } -io_error io_raw_fstat_at(io_file_desc dirFd, str8 name, file_open_flags openFlags, file_status* status) +oc_io_error oc_io_raw_fstat_at(oc_file_desc dirFd, oc_str8 name, oc_file_open_flags openFlags, oc_file_status* status) { - io_error error = IO_OK; - io_file_desc fd = io_raw_open_at(dirFd, name, FILE_ACCESS_NONE, FILE_OPEN_SYMLINK); - if(io_file_desc_is_nil(fd)) + oc_io_error error = OC_IO_OK; + oc_file_desc fd = oc_io_raw_open_at(dirFd, name, OC_FILE_ACCESS_NONE, OC_FILE_OPEN_SYMLINK); + if(oc_file_desc_is_nil(fd)) { - error = io_raw_last_error(); + error = oc_io_raw_last_error(); } else { - error = io_raw_fstat(fd, status); - io_raw_close(fd); + error = oc_io_raw_fstat(fd, status); + oc_io_raw_close(fd); } return(error); } @@ -342,88 +342,88 @@ typedef struct UCHAR DataBuffer[1]; } GenericReparseBuffer; }; -} REPARSE_DATA_BUFFER; +} oc_win32_reparse_data_buffer; -io_raw_read_link_result io_raw_read_link(mem_arena* arena, io_file_desc fd) +oc_io_raw_read_link_result oc_io_raw_read_link(oc_arena* arena, oc_file_desc fd) { - io_raw_read_link_result result = {0}; + oc_io_raw_read_link_result result = {0}; char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; DWORD bytesReturned; if(!DeviceIoControl(fd, FSCTL_GET_REPARSE_POINT, NULL, 0, buffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned, 0)) { - result.error = io_raw_last_error(); + result.error = oc_io_raw_last_error(); } else { - REPARSE_DATA_BUFFER* reparse = (REPARSE_DATA_BUFFER*)buffer; + oc_win32_reparse_data_buffer* reparse = (oc_win32_reparse_data_buffer*)buffer; if(reparse->ReparseTag == IO_REPARSE_TAG_SYMLINK) { - str16 nameW = {0}; + oc_str16 nameW = {0}; nameW.len = reparse->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(wchar_t); nameW.ptr = (u16*)((char*)reparse->SymbolicLinkReparseBuffer.PathBuffer + reparse->SymbolicLinkReparseBuffer.SubstituteNameOffset); - result.target = win32_wide_to_utf8(arena, nameW); + result.target = oc_win32_wide_to_utf8(arena, nameW); } else { - result.error = IO_ERR_UNKNOWN; + result.error = OC_IO_ERR_UNKNOWN; } } return(result); } -io_raw_read_link_result io_raw_read_link_at(mem_arena* arena, io_file_desc dirFd, str8 name) +oc_io_raw_read_link_result oc_io_raw_read_link_at(oc_arena* arena, oc_file_desc dirFd, oc_str8 name) { - io_file_desc fd = io_raw_open_at(dirFd, name, FILE_ACCESS_READ, FILE_OPEN_SYMLINK); - io_raw_read_link_result result = io_raw_read_link(arena, fd); - io_raw_close(fd); + oc_file_desc fd = oc_io_raw_open_at(dirFd, name, OC_FILE_ACCESS_READ, OC_FILE_OPEN_SYMLINK); + oc_io_raw_read_link_result result = oc_io_raw_read_link(arena, fd); + oc_io_raw_close(fd); return(result); } -io_cmp io_close(file_slot* slot, io_req* req, file_table* table) +static oc_io_cmp oc_io_close(oc_file_slot* slot, oc_io_req* req, oc_file_table* table) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; if(slot->fd) { CloseHandle(slot->fd); } - file_slot_recycle(table, slot); + oc_file_slot_recycle(table, slot); return(cmp); } -io_cmp io_fstat(file_slot* slot, io_req* req) +static oc_io_cmp oc_io_fstat(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; - if(req->size < sizeof(file_status)) + if(req->size < sizeof(oc_file_status)) { - cmp.error = IO_ERR_ARG; + cmp.error = OC_IO_ERR_ARG; } else { - slot->error = io_raw_fstat(slot->fd, (file_status*)req->buffer); + slot->error = oc_io_raw_fstat(slot->fd, (oc_file_status*)req->buffer); cmp.error = slot->error; } return(cmp); } -io_cmp io_seek(file_slot* slot, io_req* req) +static oc_io_cmp oc_io_seek(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; DWORD whence; switch(req->whence) { - case FILE_SEEK_CURRENT: + case OC_FILE_SEEK_CURRENT: whence = FILE_CURRENT; break; - case FILE_SEEK_SET: + case OC_FILE_SEEK_SET: whence = FILE_BEGIN; break; - case FILE_SEEK_END: + case OC_FILE_SEEK_END: whence = FILE_END; } @@ -432,7 +432,7 @@ io_cmp io_seek(file_slot* slot, io_req* req) if(!SetFilePointerEx(slot->fd, off, &newPos, whence)) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); cmp.error = slot->error; } else @@ -443,13 +443,13 @@ io_cmp io_seek(file_slot* slot, io_req* req) return(cmp); } -io_cmp io_read(file_slot* slot, io_req* req) +static oc_io_cmp oc_io_read(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; - if(slot->type != MP_FILE_REGULAR) + if(slot->type != OC_FILE_REGULAR) { - slot->error = IO_ERR_PERM; + slot->error = OC_IO_ERR_PERM; cmp.error = slot->error; } else @@ -458,7 +458,7 @@ io_cmp io_read(file_slot* slot, io_req* req) if(!ReadFile(slot->fd, req->buffer, req->size, &bytesRead, NULL)) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); cmp.result = 0; cmp.error = slot->error; } @@ -470,13 +470,13 @@ io_cmp io_read(file_slot* slot, io_req* req) return(cmp); } -io_cmp io_write(file_slot* slot, io_req* req) +static oc_io_cmp oc_io_write(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; - if(slot->type != MP_FILE_REGULAR) + if(slot->type != OC_FILE_REGULAR) { - slot->error = IO_ERR_PERM; + slot->error = OC_IO_ERR_PERM; cmp.error = slot->error; } else @@ -485,7 +485,7 @@ io_cmp io_write(file_slot* slot, io_req* req) if(!WriteFile(slot->fd, req->buffer, req->size, &bytesWritten, NULL)) { - slot->error = io_raw_last_error(); + slot->error = oc_io_raw_last_error(); cmp.result = 0; cmp.error = slot->error; } @@ -497,64 +497,64 @@ io_cmp io_write(file_slot* slot, io_req* req) return(cmp); } -io_cmp io_get_error(file_slot* slot, io_req* req) +static oc_io_cmp oc_io_get_error(oc_file_slot* slot, oc_io_req* req) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; cmp.result = slot->error; return(cmp); } -io_cmp io_wait_single_req_with_table(io_req* req, file_table* table) +oc_io_cmp oc_io_wait_single_req_with_table(oc_io_req* req, oc_file_table* table) { - io_cmp cmp = {0}; + oc_io_cmp cmp = {0}; - file_slot* slot = file_slot_from_handle(table, req->handle); + oc_file_slot* slot = oc_file_slot_from_handle(table, req->handle); if(!slot) { - if(req->op != IO_OP_OPEN_AT) + if(req->op != OC_IO_OPEN_AT) { - cmp.error = IO_ERR_HANDLE; + cmp.error = OC_IO_ERR_HANDLE; } } - else if(slot->fatal && req->op != IO_OP_CLOSE && req->op != IO_OP_ERROR) + else if(slot->fatal && req->op != OC_IO_CLOSE && req->op != OC_OC_IO_ERROR) { - cmp.error = IO_ERR_PREV; + cmp.error = OC_IO_ERR_PREV; } - if(cmp.error == IO_OK) + if(cmp.error == OC_IO_OK) { switch(req->op) { - case IO_OP_OPEN_AT: - cmp = io_open_at(slot, req, table); + case OC_IO_OPEN_AT: + cmp = oc_io_open_at(slot, req, table); break; - case IO_OP_FSTAT: - cmp = io_fstat(slot, req); + case OC_IO_FSTAT: + cmp = oc_io_fstat(slot, req); break; - case IO_OP_CLOSE: - cmp = io_close(slot, req, table); + case OC_IO_CLOSE: + cmp = oc_io_close(slot, req, table); break; - case IO_OP_READ: - cmp = io_read(slot, req); + case OC_IO_READ: + cmp = oc_io_read(slot, req); break; - case IO_OP_WRITE: - cmp = io_write(slot, req); + case OC_IO_WRITE: + cmp = oc_io_write(slot, req); break; - case IO_OP_SEEK: - cmp = io_seek(slot, req); + case OC_IO_SEEK: + cmp = oc_io_seek(slot, req); break; - case IO_OP_ERROR: - cmp = io_get_error(slot, req); + case OC_OC_IO_ERROR: + cmp = oc_io_get_error(slot, req); break; default: - cmp.error = IO_ERR_OP; + cmp.error = OC_IO_ERR_OP; if(slot) { slot->error = cmp.error; diff --git a/src/platform/win32_memory.c b/src/platform/win32_memory.c index 2b6e391..0d758a3 100644 --- a/src/platform/win32_memory.c +++ b/src/platform/win32_memory.c @@ -10,36 +10,36 @@ #include #include"platform_memory.h" -void* mem_base_reserve_win32(mem_base_allocator* context, u64 size) +void* oc_base_reserve_win32(oc_base_allocator* context, u64 size) { void* result = VirtualAlloc(0, size, MEM_RESERVE, PAGE_READWRITE); return(result); } -void mem_base_commit_win32(mem_base_allocator* context, void* ptr, u64 size) +void oc_base_commit_win32(oc_base_allocator* context, void* ptr, u64 size) { VirtualAlloc(ptr, size, MEM_COMMIT, PAGE_READWRITE); } -void mem_base_release_win32(mem_base_allocator* context, void* ptr, u64 size) +void oc_base_release_win32(oc_base_allocator* context, void* ptr, u64 size) { VirtualFree(ptr, size, MEM_RELEASE); } -void mem_base_decommit_win32(mem_base_allocator* context, void* ptr, u64 size) +void oc_base_decommit_win32(oc_base_allocator* context, void* ptr, u64 size) { VirtualFree(ptr, size, MEM_DECOMMIT); } -mem_base_allocator* mem_base_allocator_default() +oc_base_allocator* oc_base_allocator_default() { - static mem_base_allocator base = {0}; + static oc_base_allocator base = {0}; if(base.reserve == 0) { - base.reserve = mem_base_reserve_win32; - base.commit = mem_base_commit_win32; - base.decommit = mem_base_decommit_win32; - base.release = mem_base_release_win32; + base.reserve = oc_base_reserve_win32; + base.commit = oc_base_commit_win32; + base.decommit = oc_base_decommit_win32; + base.release = oc_base_release_win32; } return(&base); } diff --git a/src/platform/win32_path.c b/src/platform/win32_path.c index 9f39f12..c25f2f0 100644 --- a/src/platform/win32_path.c +++ b/src/platform/win32_path.c @@ -10,23 +10,23 @@ #include"win32_string_helpers.h" #include"platform_path.c" -bool path_is_absolute(str8 path) +bool oc_path_is_absolute(oc_str8 path) { - mem_arena_scope scratch = mem_scratch_begin(); - str16 pathW = win32_utf8_to_wide_null_terminated(scratch.arena, path); + oc_arena_scope scratch = oc_scratch_begin(); + oc_str16 pathW = oc_win32_utf8_to_wide_null_terminated(scratch.arena, path); bool result = !PathIsRelativeW(pathW.ptr); - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(result); } -str8 path_executable(mem_arena* arena) +oc_str8 oc_path_executable(oc_arena* arena) { /////////////////////////////////////////////////////////////////// //TODO use wide chars /////////////////////////////////////////////////////////////////// - char* buffer = mem_arena_alloc_array(arena, char, MAX_PATH+2); + char* buffer = oc_arena_push_array(arena, char, MAX_PATH+2); int size = GetModuleFileName(NULL, buffer, MAX_PATH+1); //TODO: check for errors... for(int i=0; istart(thread->userPointer); return(exitCode); } -mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* userPointer, const char* name) +oc_thread* oc_thread_create_with_name(oc_thread_start_function start, void* userPointer, oc_str8 name) { - mp_thread* thread = (mp_thread*)malloc(sizeof(mp_thread)); + oc_thread* thread = (oc_thread*)malloc(sizeof(oc_thread)); thread->start = start; thread->handle = INVALID_HANDLE_VALUE; thread->userPointer = userPointer; - if(name) + if(name.len && name.ptr) { - char* end = strncpy(thread->name, name, MP_THREAD_NAME_MAX_SIZE-1); - *end = '\0'; + strncpy(thread->nameBuffer, name.ptr, oc_min(name.len, OC_THREAD_NAME_MAX_SIZE-1)); + thread->nameBuffer[OC_THREAD_NAME_MAX_SIZE-1] = '\0'; + thread->name = OC_STR8(thread->nameBuffer); } else { - thread->name[0] = '\0'; + thread->nameBuffer[0] = '\0'; + thread->name = oc_str8_from_buffer(0, thread->nameBuffer); } SECURITY_ATTRIBUTES childProcessSecurity = { @@ -51,7 +54,7 @@ mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* user SIZE_T stackSize = 0; // uses process default DWORD flags = 0; DWORD threadId = 0; - thread->handle = CreateThread(&childProcessSecurity, stackSize, mp_thread_bootstrap, thread, flags, &threadId); + thread->handle = CreateThread(&childProcessSecurity, stackSize, oc_thread_bootstrap, thread, flags, &threadId); if (thread->handle == NULL) { free(thread); return(NULL); @@ -59,9 +62,9 @@ mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* user thread->threadId = threadId; - if (thread->name[0]) { - wchar_t widename[MP_THREAD_NAME_MAX_SIZE]; - size_t length = mbstowcs(widename, thread->name, MP_THREAD_NAME_MAX_SIZE - 1); + if (thread->name.len) { + wchar_t widename[OC_THREAD_NAME_MAX_SIZE]; + size_t length = mbstowcs(widename, thread->nameBuffer, OC_THREAD_NAME_MAX_SIZE - 1); widename[length] = '\0'; SetThreadDescription(thread->handle, widename); @@ -70,33 +73,33 @@ mp_thread* mp_thread_create_with_name(mp_thread_start_function start, void* user return(thread); } -mp_thread* mp_thread_create(mp_thread_start_function start, void* userPointer) +oc_thread* oc_thread_create(oc_thread_start_function start, void* userPointer) { - return(mp_thread_create_with_name(start, userPointer, NULL)); + return(oc_thread_create_with_name(start, userPointer, (oc_str8){0})); } -const char* mp_thread_get_name(mp_thread* thread) +oc_str8 oc_thread_get_name(oc_thread* thread) { return(thread->name); } -u64 mp_thread_unique_id(mp_thread* thread) +u64 oc_thread_unique_id(oc_thread* thread) { return(thread->threadId); } -u64 mp_thread_self_id() +u64 oc_thread_self_id() { return(GetCurrentThreadId()); } -int mp_thread_signal(mp_thread* thread, int sig) +int oc_thread_signal(oc_thread* thread, int sig) { BOOL success = TerminateThread(thread->handle, (DWORD)sig); return(success ? 0 : -1); } -int mp_thread_join(mp_thread* thread, i64* exitCode) +int oc_thread_join(oc_thread* thread, i64* exitCode) { DWORD result = WaitForSingleObject(thread->handle, INFINITE); if (result == WAIT_FAILED) { @@ -116,7 +119,7 @@ int mp_thread_join(mp_thread* thread, i64* exitCode) return(0); } -int mp_thread_detach(mp_thread* thread) +int oc_thread_detach(oc_thread* thread) { if (CloseHandle(thread->handle)) { @@ -127,86 +130,86 @@ int mp_thread_detach(mp_thread* thread) } -struct mp_mutex +struct oc_mutex { u64 owningThreadId; SRWLOCK lock; }; -mp_mutex* mp_mutex_create() +oc_mutex* oc_mutex_create() { - mp_mutex* mutex = (mp_mutex*)malloc(sizeof(mp_mutex)); + oc_mutex* mutex = (oc_mutex*)malloc(sizeof(oc_mutex)); mutex->owningThreadId = 0; InitializeSRWLock(&mutex->lock); return mutex; } -int mp_mutex_destroy(mp_mutex* mutex) +int oc_mutex_destroy(oc_mutex* mutex) { - DEBUG_ASSERT(mutex->owningThreadId == 0); + OC_DEBUG_ASSERT(mutex->owningThreadId == 0); free(mutex); return(0); } -int mp_mutex_lock(mp_mutex* mutex) +int oc_mutex_lock(oc_mutex* mutex) { - DEBUG_ASSERT(mutex->owningThreadId == 0); + OC_DEBUG_ASSERT(mutex->owningThreadId == 0); AcquireSRWLockExclusive(&mutex->lock); return(0); } -int mp_mutex_unlock(mp_mutex* mutex) +int oc_mutex_unlock(oc_mutex* mutex) { - DEBUG_ASSERT(mp_thread_self_id() == mutex->owningThreadId); + OC_DEBUG_ASSERT(oc_thread_self_id() == mutex->owningThreadId); ReleaseSRWLockExclusive(&mutex->lock); mutex->owningThreadId = 0; return(0); } -// mp_ticket_spin_mutex has a mirrored implementation in posix_thread.c +// oc_ticket has a mirrored implementation in posix_thread.c -void mp_ticket_spin_mutex_init(mp_ticket_spin_mutex* mutex) +void oc_ticket_init(oc_ticket* mutex) { mutex->nextTicket = 0; mutex->serving = 0; } -void mp_ticket_spin_mutex_lock(mp_ticket_spin_mutex* mutex) +void oc_ticket_lock(oc_ticket* mutex) { u64 ticket = atomic_fetch_add(&mutex->nextTicket, 1ULL); while(ticket != mutex->serving); //spin } -void mp_ticket_spin_mutex_unlock(mp_ticket_spin_mutex* mutex) +void oc_ticket_unlock(oc_ticket* mutex) { atomic_fetch_add(&mutex->serving, 1ULL); } -struct mp_condition +struct oc_condition { CONDITION_VARIABLE cond; }; -mp_condition* mp_condition_create() +oc_condition* oc_condition_create() { - mp_condition* cond = (mp_condition*)malloc(sizeof(mp_condition)); + oc_condition* cond = (oc_condition*)malloc(sizeof(oc_condition)); InitializeConditionVariable(&cond->cond); return cond; } -int mp_condition_destroy(mp_condition* cond) +int oc_condition_destroy(oc_condition* cond) { free(cond); return(0); } -int mp_condition_wait(mp_condition* cond, mp_mutex* mutex) +int oc_condition_wait(oc_condition* cond, oc_mutex* mutex) { - return mp_condition_timedwait(cond, mutex, INFINITY); + return oc_condition_timedwait(cond, mutex, INFINITY); } -int mp_condition_timedwait(mp_condition* cond, mp_mutex* mutex, f64 seconds) +int oc_condition_timedwait(oc_condition* cond, oc_mutex* mutex, f64 seconds) { const f32 ms = (seconds == INFINITY) ? INFINITE : seconds * 1000; if (!SleepConditionVariableSRW(&cond->cond, &mutex->lock, ms, 0)) @@ -216,13 +219,13 @@ int mp_condition_timedwait(mp_condition* cond, mp_mutex* mutex, f64 seconds) return(0); } -int mp_condition_signal(mp_condition* cond) +int oc_condition_signal(oc_condition* cond) { WakeConditionVariable(&cond->cond); return(0); } -int mp_condition_broadcast(mp_condition* cond) +int oc_condition_broadcast(oc_condition* cond) { WakeAllConditionVariable(&cond->cond); return(0); diff --git a/src/runtime.c b/src/runtime.c index d8300bc..2e2e3fd 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -9,7 +9,7 @@ #include #include -#define MG_INCLUDE_GL_API +#define OC_INCLUDE_GL_API #include"orca.h" #include"graphics/graphics_common.h" @@ -17,57 +17,57 @@ #include"runtime_memory.c" #include"runtime_io.c" -mg_font orca_font_create(const char* resourcePath) +oc_font orca_font_create(const char* resourcePath) { //NOTE(martin): create default font - str8 fontPath = path_executable_relative(mem_scratch(), STR8(resourcePath)); + oc_str8 fontPath = oc_path_executable_relative(oc_scratch(), OC_STR8(resourcePath)); FILE* fontFile = fopen(fontPath.ptr, "r"); if(!fontFile) { - log_error("Could not load font file '%s': %s\n", fontPath.ptr, strerror(errno)); - return(mg_font_nil()); + oc_log_error("Could not load font file '%s': %s\n", fontPath.ptr, strerror(errno)); + return(oc_font_nil()); } - unsigned char* fontData = 0; + char* fontData = 0; fseek(fontFile, 0, SEEK_END); u32 fontDataSize = ftell(fontFile); rewind(fontFile); - fontData = (unsigned char*)malloc(fontDataSize); + fontData = malloc(fontDataSize); fread(fontData, 1, fontDataSize, fontFile); fclose(fontFile); - unicode_range ranges[5] = {UNICODE_RANGE_BASIC_LATIN, - UNICODE_RANGE_C1_CONTROLS_AND_LATIN_1_SUPPLEMENT, - UNICODE_RANGE_LATIN_EXTENDED_A, - UNICODE_RANGE_LATIN_EXTENDED_B, - UNICODE_RANGE_SPECIALS}; + oc_unicode_range ranges[5] = {OC_UNICODE_BASIC_LATIN, + OC_UNICODE_C1_CONTROLS_AND_LATIN_1_SUPPLEMENT, + OC_UNICODE_LATIN_EXTENDED_A, + OC_UNICODE_LATIN_EXTENDED_B, + OC_UNICODE_SPECIALS}; - mg_font font = mg_font_create_from_memory(fontDataSize, fontData, 5, ranges); + oc_font font = oc_font_create_from_memory(oc_str8_from_buffer(fontDataSize, fontData), 5, ranges); free(fontData); return(font); } -mg_font mg_font_create_default() +oc_font oc_font_create_default() { return(orca_font_create("../resources/OpenSansLatinSubset.ttf")); } -orca_app __orcaApp = {0}; +oc_runtime __orcaApp = {0}; -orca_app* orca_app_get() +oc_runtime* oc_runtime_get() { return(&__orcaApp); } -orca_runtime* orca_runtime_get() +oc_runtime_env* oc_runtime_env_get() { return(&__orcaApp.runtime); } -void orca_log(log_level level, +void oc_runtime_log(oc_log_level level, int fileLen, char* file, int functionLen, @@ -76,16 +76,16 @@ void orca_log(log_level level, int msgLen, char* msg) { - orca_debug_overlay* debug = &__orcaApp.debugOverlay; + oc_debug_overlay* debug = &__orcaApp.debugOverlay; //NOTE: recycle first entry if we exceeded the max entry count debug->entryCount++; if(debug->entryCount > debug->maxEntries) { - log_entry* e = list_pop_entry(&debug->logEntries, log_entry, listElt); + log_entry* e = oc_list_pop_entry(&debug->logEntries, log_entry, listElt); if(e) { - list_push(&debug->logFreeList, &e->listElt); + oc_list_push(&debug->logFreeList, &e->listElt); debug->entryCount--; } } @@ -95,11 +95,11 @@ void orca_log(log_level level, //NOTE: allocate a new entry //TODO: should probably use a buddy allocator over the arena or something log_entry* entry = 0; - for_list(&debug->logFreeList, elt, log_entry, listElt) + oc_list_for(&debug->logFreeList, elt, log_entry, listElt) { if(elt->cap >= cap) { - list_remove(&debug->logFreeList, &elt->listElt); + oc_list_remove(&debug->logFreeList, &elt->listElt); entry = elt; break; } @@ -107,7 +107,7 @@ void orca_log(log_level level, if(!entry) { - char* mem = mem_arena_alloc(&debug->logArena, cap); + char* mem = oc_arena_push(&debug->logArena, cap); entry = (log_entry*)mem; entry->cap = cap; } @@ -134,80 +134,80 @@ void orca_log(log_level level, entry->recordIndex = debug->logEntryTotalCount; debug->logEntryTotalCount++; - list_push_back(&debug->logEntries, &entry->listElt); + oc_list_push_back(&debug->logEntries, &entry->listElt); - log_push(level, - file, - function, - line, - "%.*s\n", - msgLen, - msg); + oc_log_ext(level, + file, + function, + line, + "%.*s\n", + msgLen, + msg); } typedef struct orca_surface_create_data { - mp_window window; - mg_surface_api api; - mg_surface surface; + oc_window window; + oc_surface_api api; + oc_surface surface; } orca_surface_create_data; i32 orca_surface_callback(void* user) { orca_surface_create_data* data = (orca_surface_create_data*)user; - data->surface = mg_surface_create_for_window(data->window, data->api); + data->surface = oc_surface_create_for_window(data->window, data->api); //NOTE: this will be called on main thread, so we need to deselect the surface here, // and reselect it on the orca thread - mg_surface_deselect(); + oc_surface_deselect(); return(0); } -mg_surface orca_surface_canvas(void) +oc_surface orca_surface_canvas(void) { orca_surface_create_data data = { - .surface = mg_surface_nil(), + .surface = oc_surface_nil(), .window = __orcaApp.window, - .api = MG_CANVAS + .api = OC_CANVAS }; - mp_dispatch_on_main_thread_sync(__orcaApp.window, orca_surface_callback, (void*)&data); - mg_surface_prepare(data.surface); + oc_dispatch_on_main_thread_sync(__orcaApp.window, orca_surface_callback, (void*)&data); + oc_surface_select(data.surface); return(data.surface); } -mg_surface orca_surface_gles(void) +oc_surface orca_surface_gles(void) { orca_surface_create_data data = { - .surface = mg_surface_nil(), + .surface = oc_surface_nil(), .window = __orcaApp.window, - .api = MG_GLES + .api = OC_GLES }; - mp_dispatch_on_main_thread_sync(__orcaApp.window, orca_surface_callback, (void*)&data); - mg_surface_prepare(data.surface); + oc_dispatch_on_main_thread_sync(__orcaApp.window, orca_surface_callback, (void*)&data); + oc_surface_select(data.surface); return(data.surface); } -void orca_surface_render_commands(mg_surface surface, - mg_color clearColor, +void orca_surface_render_commands(oc_surface surface, + oc_color clearColor, u32 primitiveCount, - mg_primitive* primitives, + oc_primitive* primitives, u32 eltCount, - mg_path_elt* elements) + oc_path_elt* elements) { - orca_app* app = &__orcaApp; + oc_runtime* app = &__orcaApp; char* memBase = app->runtime.wasmMemory.ptr; u32 memSize = app->runtime.wasmMemory.committed; if( ((char*)primitives > memBase) - &&((char*)primitives + primitiveCount*sizeof(mg_primitive) - memBase <= memSize) + &&((char*)primitives + primitiveCount*sizeof(oc_primitive) - memBase <= memSize) &&((char*)elements > memBase) - &&((char*)elements + eltCount*sizeof(mg_path_elt) - memBase <= memSize)) + &&((char*)elements + eltCount*sizeof(oc_path_elt) - memBase <= memSize)) { - mg_surface_render_commands(surface, + oc_surface_render_commands(surface, clearColor, primitiveCount, primitives, @@ -216,10 +216,10 @@ void orca_surface_render_commands(mg_surface surface, } } -void debug_overlay_toggle(orca_debug_overlay* overlay) +void debug_overlay_toggle(oc_debug_overlay* overlay) { overlay->show = !overlay->show; - mg_surface_set_hidden(overlay->surface, !overlay->show); + oc_surface_set_hidden(overlay->surface, !overlay->show); if(overlay->show) { @@ -228,57 +228,57 @@ void debug_overlay_toggle(orca_debug_overlay* overlay) } -void log_entry_ui(orca_debug_overlay* overlay, log_entry* entry) +void log_entry_ui(oc_debug_overlay* overlay, log_entry* entry) { static const char* levelNames[] = {"Error: ", "Warning: ", "Info: "}; - static const mg_color levelColors[] = {{0.8, 0, 0, 1}, + static const oc_color levelColors[] = {{0.8, 0, 0, 1}, {1, 0.5, 0, 1}, {0, 0.8, 0, 1}}; - static const mg_color bgColors[3][2] = {//errors + static const oc_color bgColors[3][2] = {//errors {{0.6, 0, 0, 0.5}, {0.8, 0, 0, 0.5}}, //warning {{0.4, 0.4, 0.4, 0.5}, {0.5, 0.5, 0.5, 0.5}}, //info {{0.4, 0.4, 0.4, 0.5}, {0.5, 0.5, 0.5, 0.5}}}; - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_CHILDREN}, - .layout.axis = UI_AXIS_Y, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_CHILDREN}, + .layout.axis = OC_UI_AXIS_Y, .layout.margin.x = 10, .layout.margin.y = 5, .bgColor = bgColors[entry->level][entry->recordIndex & 1]}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_AXIS - |UI_STYLE_LAYOUT_MARGINS - |UI_STYLE_BG_COLOR); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_AXIS + |OC_UI_STYLE_LAYOUT_MARGINS + |OC_UI_STYLE_BG_COLOR); - str8 key = str8_pushf(mem_scratch(), "%ull", entry->recordIndex); + oc_str8 key = oc_str8_pushf(oc_scratch(), "%ull", entry->recordIndex); - ui_container_str8(key, UI_FLAG_DRAW_BACKGROUND) + oc_ui_container_str8(key, OC_UI_FLAG_DRAW_BACKGROUND) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_CHILDREN}, - .layout.axis = UI_AXIS_X}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_AXIS); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_CHILDREN}, + .layout.axis = OC_UI_AXIS_X}, + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_AXIS); - ui_container("header", 0) + oc_ui_container("header", 0) { - ui_style_next(&(ui_style){.color = levelColors[entry->level], + oc_ui_style_next(&(oc_ui_style){.color = levelColors[entry->level], .font = overlay->fontBold}, - UI_STYLE_COLOR - |UI_STYLE_FONT); - ui_label(levelNames[entry->level]); + OC_UI_STYLE_COLOR + |OC_UI_STYLE_FONT); + oc_ui_label(levelNames[entry->level]); - str8 loc = str8_pushf(mem_scratch(), + oc_str8 loc = oc_str8_pushf(oc_scratch(), "%.*s() in %.*s:%i:", - str8_ip(entry->file), - str8_ip(entry->function), + oc_str8_ip(entry->file), + oc_str8_ip(entry->function), entry->line); - ui_label_str8(loc); + oc_ui_label_str8(loc); } - ui_label_str8(entry->msg); + oc_ui_label_str8(entry->msg); } } @@ -304,13 +304,13 @@ char m3_type_to_tag(M3ValueType type) } } -void orca_runtime_init(orca_runtime* runtime) +void oc_runtime_env_init(oc_runtime_env* runtime) { - memset(runtime, 0, sizeof(orca_runtime)); - mem_base_allocator* allocator = mem_base_allocator_default(); + memset(runtime, 0, sizeof(oc_runtime_env)); + oc_base_allocator* allocator = oc_base_allocator_default(); runtime->wasmMemory.committed = 0; runtime->wasmMemory.reserved = 4ULL<<30; - runtime->wasmMemory.ptr = mem_base_reserve(allocator, runtime->wasmMemory.reserved); + runtime->wasmMemory.ptr = oc_base_reserve(allocator, runtime->wasmMemory.reserved); } #include"wasmbind/core_api_bind_gen.c" @@ -327,11 +327,11 @@ void orca_wasm3_abort(IM3Runtime runtime, M3Result res, const char* file, const m3_GetErrorInfo(runtime, &errInfo); if(errInfo.message && res == errInfo.result) { - orca_abort(file, function, line, "%s: %s (%s)", msg, res, errInfo.message); + oc_abort_ext(file, function, line, "%s: %s (%s)", msg, res, errInfo.message); } else { - orca_abort(file, function, line, "%s: %s", msg, res); + oc_abort_ext(file, function, line, "%s: %s", msg, res); } } @@ -339,18 +339,18 @@ void orca_wasm3_abort(IM3Runtime runtime, M3Result res, const char* file, const i32 orca_runloop(void* user) { - orca_app* app = &__orcaApp; + oc_runtime* app = &__orcaApp; - orca_runtime_init(&app->runtime); + oc_runtime_env_init(&app->runtime); //NOTE: loads wasm module const char* bundleNameCString = "module"; - str8 modulePath = path_executable_relative(mem_scratch(), STR8("../app/wasm/module.wasm")); + oc_str8 modulePath = oc_path_executable_relative(oc_scratch(), OC_STR8("../app/wasm/module.wasm")); FILE* file = fopen(modulePath.ptr, "rb"); if(!file) { - ORCA_ABORT("The application couldn't load: web assembly module not found"); + OC_ABORT("The application couldn't load: web assembly module not found"); } fseek(file, 0, SEEK_END); @@ -358,7 +358,7 @@ i32 orca_runloop(void* user) rewind(file); app->runtime.wasmBytecode.len = wasmSize; - app->runtime.wasmBytecode.ptr = malloc_array(char, wasmSize); + app->runtime.wasmBytecode.ptr = oc_malloc_array(char, wasmSize); fread(app->runtime.wasmBytecode.ptr, 1, app->runtime.wasmBytecode.len, file); fclose(file); @@ -382,7 +382,7 @@ i32 orca_runloop(void* user) } m3_SetModuleName(app->runtime.m3Module, bundleNameCString); - mem_arena_clear(mem_scratch()); + oc_arena_clear(oc_scratch()); //NOTE: bind orca APIs { @@ -396,7 +396,7 @@ i32 orca_runloop(void* user) if(err) { - ORCA_ABORT("The application couldn't link one or more functions to its web assembly module (see console log for more information)"); + OC_ABORT("The application couldn't link one or more functions to its web assembly module (see console log for more information)"); } } //NOTE: compile @@ -407,9 +407,9 @@ i32 orca_runloop(void* user) } //NOTE: Find and type check event handlers. - for(int i=0; iruntime.m3Runtime, desc->name.ptr); @@ -456,99 +456,99 @@ i32 orca_runloop(void* user) } else { - log_error("type mismatch for event handler %.*s\n", (int)desc->name.len, desc->name.ptr); + oc_log_error("type mismatch for event handler %.*s\n", (int)desc->name.len, desc->name.ptr); } } } //NOTE: get location of the raw event slot - IM3Global rawEventGlobal = m3_FindGlobal(app->runtime.m3Module, "_OrcaRawEvent"); + IM3Global rawEventGlobal = m3_FindGlobal(app->runtime.m3Module, "oc_rawEvent"); app->runtime.rawEventOffset = (u32)rawEventGlobal->intValue; //NOTE: preopen the app local root dir { - str8 localRootPath = path_executable_relative(mem_scratch(), STR8("../app/data")); + oc_str8 localRootPath = oc_path_executable_relative(oc_scratch(), OC_STR8("../app/data")); - io_req req = {.op = IO_OP_OPEN_AT, - .open.rights = FILE_ACCESS_READ|FILE_ACCESS_WRITE, + oc_io_req req = {.op = OC_IO_OPEN_AT, + .open.rights = OC_FILE_ACCESS_READ|OC_FILE_ACCESS_WRITE, .size = localRootPath.len, .buffer = localRootPath.ptr}; - io_cmp cmp = io_wait_single_req_with_table(&req, &app->fileTable); + oc_io_cmp cmp = oc_io_wait_single_req_with_table(&req, &app->fileTable); app->rootDir = cmp.handle; } IM3Function* exports = app->runtime.exports; //NOTE: call init handler - if(exports[G_EXPORT_ON_INIT]) + if(exports[OC_EXPORT_ON_INIT]) { - M3Result res = m3_Call(exports[G_EXPORT_ON_INIT], 0, 0); + M3Result res = m3_Call(exports[OC_EXPORT_ON_INIT], 0, 0); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); } } - if(exports[G_EXPORT_FRAME_RESIZE]) + if(exports[OC_EXPORT_FRAME_RESIZE]) { - mp_rect content = mp_window_get_content_rect(app->window); + oc_rect content = oc_window_get_content_rect(app->window); u32 width = (u32)content.w; u32 height = (u32)content.h; const void* args[2] = {&width, &height}; - M3Result res = m3_Call(exports[G_EXPORT_FRAME_RESIZE], 2, args); + M3Result res = m3_Call(exports[OC_EXPORT_FRAME_RESIZE], 2, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); } } - ui_set_context(&app->debugOverlay.ui); + oc_ui_set_context(&app->debugOverlay.ui); - while(!mp_should_quit()) + while(!oc_should_quit()) { - mp_event* event = 0; - while((event = mp_next_event(mem_scratch())) != 0) + oc_event* event = 0; + while((event = oc_next_event(oc_scratch())) != 0) { if(app->debugOverlay.show) { - ui_process_event(event); + oc_ui_process_event(event); } - if(exports[G_EXPORT_RAW_EVENT]) + if(exports[OC_EXPORT_RAW_EVENT]) { #ifndef M3_BIG_ENDIAN - mp_event* eventPtr = (mp_event*)wasm_memory_offset_to_ptr(&app->runtime.wasmMemory, app->runtime.rawEventOffset); + oc_event* eventPtr = (oc_event*)wasm_memory_offset_to_ptr(&app->runtime.wasmMemory, app->runtime.rawEventOffset); memcpy(eventPtr, event, sizeof(*event)); const void* args[1] = {&app->runtime.rawEventOffset}; - M3Result res = m3_Call(exports[G_EXPORT_RAW_EVENT], 1, args); + M3Result res = m3_Call(exports[OC_EXPORT_RAW_EVENT], 1, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); } #else - log_error("OnRawEvent() is not supported on big endian platforms"); + oc_log_error("oc_on_raw_event() is not supported on big endian platforms"); #endif } switch(event->type) { - case MP_EVENT_WINDOW_CLOSE: + case OC_EVENT_WINDOW_CLOSE: { - mp_request_quit(); + oc_request_quit(); } break; - case MP_EVENT_WINDOW_RESIZE: + case OC_EVENT_WINDOW_RESIZE: { - mp_rect frame = {0, 0, event->move.frame.w, event->move.frame.h}; + oc_rect frame = {0, 0, event->move.frame.w, event->move.frame.h}; - if(exports[G_EXPORT_FRAME_RESIZE]) + if(exports[OC_EXPORT_FRAME_RESIZE]) { u32 width = (u32)event->move.content.w; u32 height = (u32)event->move.content.h; const void* args[2] = {&width, &height}; - M3Result res = m3_Call(exports[G_EXPORT_FRAME_RESIZE], 2, args); + M3Result res = m3_Call(exports[OC_EXPORT_FRAME_RESIZE], 2, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); @@ -556,15 +556,15 @@ i32 orca_runloop(void* user) } } break; - case MP_EVENT_MOUSE_BUTTON: + case OC_EVENT_MOUSE_BUTTON: { - if(event->key.action == MP_KEY_PRESS) + if(event->key.action == OC_KEY_PRESS) { - if(exports[G_EXPORT_MOUSE_DOWN]) + if(exports[OC_EXPORT_MOUSE_DOWN]) { int key = event->key.code; const void* args[1] = {&key}; - M3Result res = m3_Call(exports[G_EXPORT_MOUSE_DOWN], 1, args); + M3Result res = m3_Call(exports[OC_EXPORT_MOUSE_DOWN], 1, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); @@ -573,11 +573,11 @@ i32 orca_runloop(void* user) } else { - if(exports[G_EXPORT_MOUSE_UP]) + if(exports[OC_EXPORT_MOUSE_UP]) { int key = event->key.code; const void* args[1] = {&key}; - M3Result res = m3_Call(exports[G_EXPORT_MOUSE_UP], 1, args); + M3Result res = m3_Call(exports[OC_EXPORT_MOUSE_UP], 1, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); @@ -586,12 +586,12 @@ i32 orca_runloop(void* user) } } break; - case MP_EVENT_MOUSE_MOVE: + case OC_EVENT_MOUSE_MOVE: { - if(exports[G_EXPORT_MOUSE_MOVE]) + if(exports[OC_EXPORT_MOUSE_MOVE]) { const void* args[4] = {&event->mouse.x, &event->mouse.y, &event->mouse.deltaX, &event->mouse.deltaY}; - M3Result res = m3_Call(exports[G_EXPORT_MOUSE_MOVE], 4, args); + M3Result res = m3_Call(exports[OC_EXPORT_MOUSE_MOVE], 4, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); @@ -599,33 +599,33 @@ i32 orca_runloop(void* user) } } break; - case MP_EVENT_KEYBOARD_KEY: + case OC_EVENT_KEYBOARD_KEY: { - if(event->key.action == MP_KEY_PRESS) + if(event->key.action == OC_KEY_PRESS) { - if(event->key.code == MP_KEY_D && (event->key.mods & (MP_KEYMOD_SHIFT | MP_KEYMOD_CMD))) + if(event->key.code == OC_KEY_D && (event->key.mods & (OC_KEYMOD_SHIFT | OC_KEYMOD_CMD))) { #if 1 // EPILEPSY WARNING! on windows this has a bug which causes a pretty strong stroboscopic effect debug_overlay_toggle(&app->debugOverlay); #endif } - if(exports[G_EXPORT_KEY_DOWN]) + if(exports[OC_EXPORT_KEY_DOWN]) { const void* args[1] = {&event->key.code}; - M3Result res = m3_Call(exports[G_EXPORT_KEY_DOWN], 1, args); + M3Result res = m3_Call(exports[OC_EXPORT_KEY_DOWN], 1, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); } } } - else if(event->key.action == MP_KEY_RELEASE) + else if(event->key.action == OC_KEY_RELEASE) { - if(exports[G_EXPORT_KEY_UP]) + if(exports[OC_EXPORT_KEY_UP]) { const void* args[1] = {&event->key.code}; - M3Result res = m3_Call(exports[G_EXPORT_KEY_UP], 1, args); + M3Result res = m3_Call(exports[OC_EXPORT_KEY_UP], 1, args); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); @@ -641,110 +641,110 @@ i32 orca_runloop(void* user) if(app->debugOverlay.show) { - ui_style debugUIDefaultStyle = {.bgColor = {0}, + oc_ui_style debugUIDefaultStyle = {.bgColor = {0}, .color = {1, 1, 1, 1}, .font = app->debugOverlay.fontReg, .fontSize = 16, .borderColor = {1, 0, 0, 1}, .borderSize = 2}; - ui_style_mask debugUIDefaultMask = UI_STYLE_BG_COLOR - | UI_STYLE_COLOR - | UI_STYLE_BORDER_COLOR - | UI_STYLE_BORDER_SIZE - | UI_STYLE_FONT - | UI_STYLE_FONT_SIZE; + oc_ui_style_mask debugUIDefaultMask = OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_COLOR + | OC_UI_STYLE_BORDER_COLOR + | OC_UI_STYLE_BORDER_SIZE + | OC_UI_STYLE_FONT + | OC_UI_STYLE_FONT_SIZE; - vec2 frameSize = mg_surface_get_size(app->debugOverlay.surface); + oc_vec2 frameSize = oc_surface_get_size(app->debugOverlay.surface); - ui_frame(frameSize, &debugUIDefaultStyle, debugUIDefaultMask) + oc_ui_frame(frameSize, &debugUIDefaultStyle, debugUIDefaultMask) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 1, 1}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 1, 1}}, + OC_UI_STYLE_SIZE); - ui_container("overlay area", 0) + oc_ui_container("overlay area", 0) { //... } - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 0.4}, - .layout.axis = UI_AXIS_Y, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 0.4}, + .layout.axis = OC_UI_AXIS_Y, .bgColor = {0, 0, 0, 0.5}}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_AXIS - |UI_STYLE_BG_COLOR); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_AXIS + |OC_UI_STYLE_BG_COLOR); - ui_container("log console", UI_FLAG_DRAW_BACKGROUND) + oc_ui_container("log console", OC_UI_FLAG_DRAW_BACKGROUND) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_CHILDREN}, - .layout.axis = UI_AXIS_X, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_CHILDREN}, + .layout.axis = OC_UI_AXIS_X, .layout.spacing = 10, .layout.margin.x = 10, .layout.margin.y = 10}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT); - ui_container("log toolbar", 0) + oc_ui_container("log toolbar", 0) { - ui_style buttonStyle = {.layout.margin.x = 4, + oc_ui_style buttonStyle = {.layout.margin.x = 4, .layout.margin.y = 4, .roundness = 2, .bgColor = {0, 0, 0, 0.5}, .color = {1, 1, 1, 1}}; - ui_style_mask buttonStyleMask = UI_STYLE_LAYOUT_MARGINS - | UI_STYLE_ROUNDNESS - | UI_STYLE_BG_COLOR - | UI_STYLE_COLOR; + oc_ui_style_mask buttonStyleMask = OC_UI_STYLE_LAYOUT_MARGINS + | OC_UI_STYLE_ROUNDNESS + | OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_COLOR; - ui_style_match_after(ui_pattern_all(), &buttonStyle, buttonStyleMask); - if(ui_button("Clear").clicked) + oc_ui_style_match_after(oc_ui_pattern_all(), &buttonStyle, buttonStyleMask); + if(oc_ui_button("Clear").clicked) { - for_list_safe(&app->debugOverlay.logEntries, entry, log_entry, listElt) + oc_list_for_safe(&app->debugOverlay.logEntries, entry, log_entry, listElt) { - list_remove(&app->debugOverlay.logEntries, &entry->listElt); - list_push(&app->debugOverlay.logFreeList, &entry->listElt); + oc_list_remove(&app->debugOverlay.logEntries, &entry->listElt); + oc_list_push(&app->debugOverlay.logFreeList, &entry->listElt); app->debugOverlay.entryCount--; } } } - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 1, 1}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 1, 1}}, + OC_UI_STYLE_SIZE); - //TODO: this is annoying to have to do that. Basically there's another 'contents' box inside ui_panel, + //TODO: this is annoying to have to do that. Basically there's another 'contents' box inside oc_ui_panel, // and we need to change that to size according to its parent (whereas the default is sizing according // to its children) - ui_pattern pattern = {0}; - ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_OWNER}); - ui_pattern_push(mem_scratch(), &pattern, (ui_selector){.kind = UI_SEL_TEXT, .text = STR8("contents")}); - ui_style_match_after(pattern, &(ui_style){.size.width = {UI_SIZE_PARENT, 1}}, UI_STYLE_SIZE_WIDTH); + oc_ui_pattern pattern = {0}; + oc_ui_pattern_push(oc_scratch(), &pattern, (oc_ui_selector){.kind = OC_UI_SEL_OWNER}); + oc_ui_pattern_push(oc_scratch(), &pattern, (oc_ui_selector){.kind = OC_UI_SEL_TEXT, .text = OC_STR8("contents")}); + oc_ui_style_match_after(pattern, &(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}}, OC_UI_STYLE_SIZE_WIDTH); - ui_box* panel = ui_box_lookup("log view"); + oc_ui_box* panel = oc_ui_box_lookup("log view"); f32 scrollY = 0; if(panel) { scrollY = panel->scroll.y; } - ui_panel("log view", UI_FLAG_SCROLL_WHEEL_Y) + oc_ui_panel("log view", OC_UI_FLAG_SCROLL_WHEEL_Y) { - panel = ui_box_top(); + panel = oc_ui_box_top(); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_CHILDREN}, - .layout.axis = UI_AXIS_Y, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_CHILDREN}, + .layout.axis = OC_UI_AXIS_Y, .layout.margin.y = 5}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_AXIS); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_AXIS); - ui_container("contents", 0) + oc_ui_container("contents", 0) { - for_list(&app->debugOverlay.logEntries, entry, log_entry, listElt) + oc_list_for(&app->debugOverlay.logEntries, entry, log_entry, listElt) { log_entry_ui(&app->debugOverlay, entry); } @@ -754,7 +754,7 @@ i32 orca_runloop(void* user) { if(panel->scroll.y >= scrollY) { - panel->scroll.y = ClampLowBound(panel->childrenSum[1] - panel->rect.h, 0); + panel->scroll.y = oc_clamp_low(panel->childrenSum[1] - panel->rect.h, 0); } else { @@ -768,16 +768,16 @@ i32 orca_runloop(void* user) } } - mg_surface_prepare(app->debugOverlay.surface); - mg_canvas_set_current(app->debugOverlay.canvas); - ui_draw(); + oc_surface_select(app->debugOverlay.surface); + oc_canvas_set_current(app->debugOverlay.canvas); + oc_ui_draw(); - mg_render(app->debugOverlay.surface, app->debugOverlay.canvas); + oc_render(app->debugOverlay.surface, app->debugOverlay.canvas); } - if(exports[G_EXPORT_FRAME_REFRESH]) + if(exports[OC_EXPORT_FRAME_REFRESH]) { - M3Result res = m3_Call(exports[G_EXPORT_FRAME_REFRESH], 0, 0); + M3Result res = m3_Call(exports[OC_EXPORT_FRAME_REFRESH], 0, 0); if(res) { ORCA_WASM3_ABORT(app->runtime.m3Runtime, res, "Runtime error"); @@ -786,11 +786,11 @@ i32 orca_runloop(void* user) if(app->debugOverlay.show) { - mg_surface_prepare(app->debugOverlay.surface); - mg_surface_present(app->debugOverlay.surface); + oc_surface_select(app->debugOverlay.surface); + oc_surface_present(app->debugOverlay.surface); } - mem_arena_clear(mem_scratch()); + oc_arena_clear(oc_scratch()); } return(0); @@ -798,64 +798,64 @@ i32 orca_runloop(void* user) int main(int argc, char** argv) { - log_set_level(LOG_LEVEL_INFO); + oc_log_set_level(OC_LOG_LEVEL_INFO); - mp_init(); - mp_clock_init(); + oc_init(); + oc_clock_init(); - orca_app* app = &__orcaApp; + oc_runtime* app = &__orcaApp; //NOTE: create window and surfaces - mp_rect windowRect = {.x = 100, .y = 100, .w = 810, .h = 610}; - app->window = mp_window_create(windowRect, "orca", 0); + oc_rect windowRect = {.x = 100, .y = 100, .w = 810, .h = 610}; + app->window = oc_window_create(windowRect, OC_STR8("orca"), 0); app->debugOverlay.show = false; - app->debugOverlay.surface = mg_surface_create_for_window(app->window, MG_CANVAS); - app->debugOverlay.canvas = mg_canvas_create(); + app->debugOverlay.surface = oc_surface_create_for_window(app->window, OC_CANVAS); + app->debugOverlay.canvas = oc_canvas_create(); app->debugOverlay.fontReg = orca_font_create("../resources/Menlo.ttf"); app->debugOverlay.fontBold = orca_font_create("../resources/Menlo Bold.ttf"); app->debugOverlay.maxEntries = 200; - mem_arena_init(&app->debugOverlay.logArena); + oc_arena_init(&app->debugOverlay.logArena); - mg_surface_swap_interval(app->debugOverlay.surface, 0); + oc_surface_swap_interval(app->debugOverlay.surface, 0); - mg_surface_set_hidden(app->debugOverlay.surface, true); + oc_surface_set_hidden(app->debugOverlay.surface, true); - mg_surface_deselect(); + oc_surface_deselect(); //WARN: this is a workaround to avoid stalling the first few times we acquire drawables from // the surfaces... This should probably be fixed in the implementation of mtl_surface! for(int i=0; i<3; i++) { - mg_surface_prepare(app->debugOverlay.surface); - mg_canvas_set_current(app->debugOverlay.canvas); - mg_render(app->debugOverlay.surface, app->debugOverlay.canvas); - mg_surface_present(app->debugOverlay.surface); + oc_surface_select(app->debugOverlay.surface); + oc_canvas_set_current(app->debugOverlay.canvas); + oc_render(app->debugOverlay.surface, app->debugOverlay.canvas); + oc_surface_present(app->debugOverlay.surface); } - ui_init(&app->debugOverlay.ui); + oc_ui_init(&app->debugOverlay.ui); //NOTE: show window and start runloop - mp_window_bring_to_front(app->window); - mp_window_focus(app->window); - mp_window_center(app->window); + oc_window_bring_to_front(app->window); + oc_window_focus(app->window); + oc_window_center(app->window); - mp_thread* runloopThread = mp_thread_create(orca_runloop, 0); + oc_thread* runloopThread = oc_thread_create(orca_runloop, 0); - while(!mp_should_quit()) + while(!oc_should_quit()) { - mp_pump_events(-1); + oc_pump_events(-1); //TODO: what to do with mem scratch here? } - mp_thread_join(runloopThread, NULL); + oc_thread_join(runloopThread, NULL); - mg_canvas_destroy(app->debugOverlay.canvas); - mg_surface_destroy(app->debugOverlay.surface); + oc_canvas_destroy(app->debugOverlay.canvas); + oc_surface_destroy(app->debugOverlay.surface); - mp_window_destroy(app->window); + oc_window_destroy(app->window); - mp_terminate(); + oc_terminate(); return(0); } diff --git a/src/runtime.h b/src/runtime.h index e1b2b70..d6b29fc 100644 --- a/src/runtime.h +++ b/src/runtime.h @@ -14,42 +14,41 @@ #include"m3_env.h" #include"m3_compile.h" -#define G_EXPORTS(X) \ - X(G_EXPORT_ON_INIT, "OnInit", "", "") \ - X(G_EXPORT_MOUSE_DOWN, "OnMouseDown", "", "i") \ - X(G_EXPORT_MOUSE_UP, "OnMouseUp", "", "i") \ - X(G_EXPORT_MOUSE_ENTER, "OnMouseEnter", "", "") \ - X(G_EXPORT_MOUSE_LEAVE, "OnMouseLeave", "", "") \ - X(G_EXPORT_MOUSE_MOVE, "OnMouseMove", "", "ffff") \ - X(G_EXPORT_MOUSE_WHEEL, "OnMouseWheel", "", "ff") \ - X(G_EXPORT_KEY_DOWN, "OnKeyDown", "", "i") \ - X(G_EXPORT_KEY_UP, "OnKeyUp", "", "i") \ - X(G_EXPORT_FRAME_REFRESH, "OnFrameRefresh", "", "") \ - X(G_EXPORT_FRAME_RESIZE, "OnFrameResize", "", "ii") \ - X(G_EXPORT_RAW_EVENT, "OnRawEvent", "", "i") \ +#define OC_EXPORTS(X) \ + X(OC_EXPORT_ON_INIT, "oc_on_init", "", "") \ + X(OC_EXPORT_MOUSE_DOWN, "oc_on_mouse_down", "", "i") \ + X(OC_EXPORT_MOUSE_UP, "oc_on_mouse_up", "", "i") \ + X(OC_EXPORT_MOUSE_ENTER, "oc_on_mouse_enter", "", "") \ + X(OC_EXPORT_MOUSE_LEAVE, "oc_on_mouse_leave", "", "") \ + X(OC_EXPORT_MOUSE_MOVE, "oc_on_mouse_move", "", "ffff") \ + X(OC_EXPORT_MOUSE_WHEEL, "oc_on_mouse_wheel", "", "ff") \ + X(OC_EXPORT_KEY_DOWN, "oc_on_key_down", "", "i") \ + X(OC_EXPORT_KEY_UP, "oc_on_key_up", "", "i") \ + X(OC_EXPORT_FRAME_REFRESH, "oc_on_frame_refresh", "", "") \ + X(OC_EXPORT_FRAME_RESIZE, "oc_on_resize", "", "ii") \ + X(OC_EXPORT_RAW_EVENT, "oc_on_raw_event", "", "i") \ typedef enum { - #define G_EXPORT_KIND(kind, ...) kind, - G_EXPORTS(G_EXPORT_KIND) - G_EXPORT_COUNT + #define OC_EXPORT_KIND(kind, ...) kind, + OC_EXPORTS(OC_EXPORT_KIND) + OC_EXPORT_COUNT } guest_export_kind; -typedef struct g_export_desc +typedef struct oc_export_desc { - str8 name; - str8 retTags; - str8 argTags; -} g_export_desc; + oc_str8 name; + oc_str8 retTags; + oc_str8 argTags; +} oc_export_desc; -const g_export_desc G_EXPORT_DESC[] = { - #define STR8LIT(s) {sizeof(s)-1, s} //NOTE: msvc doesn't accept STR8(s) as compile-time constant... - #define G_EXPORT_DESC_ENTRY(kind, name, rets, args) {STR8LIT(name), STR8LIT(rets), STR8LIT(args)}, +const oc_export_desc OC_EXPORT_DESC[] = { + #define OC_EXPORT_DESC_ENTRY(kind, name, rets, args) {OC_STR8_LIT(name), OC_STR8_LIT(rets), OC_STR8_LIT(args)}, - G_EXPORTS(G_EXPORT_DESC_ENTRY) + OC_EXPORTS(OC_EXPORT_DESC_ENTRY) - #undef G_EXPORT_DESC_ENTRY - #undef STR8LIT + #undef OC_EXPORT_DESC_ENTRY + #undef OC_STR8_LIT }; typedef struct wasm_memory @@ -60,69 +59,69 @@ typedef struct wasm_memory } wasm_memory; -typedef struct orca_runtime +typedef struct oc_runtime_env { - str8 wasmBytecode; + oc_str8 wasmBytecode; wasm_memory wasmMemory; // wasm3 data IM3Environment m3Env; IM3Runtime m3Runtime; IM3Module m3Module; - IM3Function exports[G_EXPORT_COUNT]; + IM3Function exports[OC_EXPORT_COUNT]; u32 rawEventOffset; -} orca_runtime; +} oc_runtime_env; typedef struct log_entry { - list_elt listElt; + oc_list_elt listElt; u64 cap; - log_level level; - str8 file; - str8 function; + oc_log_level level; + oc_str8 file; + oc_str8 function; int line; - str8 msg; + oc_str8 msg; u64 recordIndex; } log_entry; -typedef struct orca_debug_overlay +typedef struct oc_debug_overlay { bool show; - mg_surface surface; - mg_canvas canvas; - mg_font fontReg; - mg_font fontBold; - ui_context ui; + oc_surface surface; + oc_canvas canvas; + oc_font fontReg; + oc_font fontBold; + oc_ui_context ui; - mem_arena logArena; - list_info logEntries; - list_info logFreeList; + oc_arena logArena; + oc_list logEntries; + oc_list logFreeList; u32 entryCount; u32 maxEntries; u64 logEntryTotalCount; bool logScrollToLast; -} orca_debug_overlay; +} oc_debug_overlay; -typedef struct orca_app +typedef struct oc_runtime { - mp_window window; + oc_window window; - file_table fileTable; - file_handle rootDir; + oc_file_table fileTable; + oc_file rootDir; - orca_runtime runtime; + oc_runtime_env runtime; - orca_debug_overlay debugOverlay; + oc_debug_overlay debugOverlay; -} orca_app; +} oc_runtime; -orca_app* orca_app_get(); -orca_runtime* orca_runtime_get(); +oc_runtime* oc_runtime_get(); +oc_runtime_env* oc_runtime_env_get(); #endif //__RUNTIME_H_ diff --git a/src/runtime_io.c b/src/runtime_io.c index 06c5cde..31e14a3 100644 --- a/src/runtime_io.c +++ b/src/runtime_io.c @@ -8,13 +8,13 @@ #include"platform/platform_io_internal.h" #include"runtime.h" -io_cmp orca_io_wait_single_req(io_req* wasmReq) +oc_io_cmp oc_runtime_io_wait_single_req(oc_io_req* wasmReq) { - orca_app* orca = orca_app_get(); - mem_arena* scratch = mem_scratch(); + oc_runtime* orca = oc_runtime_get(); + oc_arena* scratch = oc_scratch(); - io_cmp cmp = {0}; - io_req req = *wasmReq; + oc_io_cmp cmp = {0}; + oc_io_req req = *wasmReq; //NOTE: convert the req->buffer wasm pointer to a native pointer // for some reason, wasm3 memory doesn't start at the beginning of the block we give it. u64 bufferIndex = (u64)req.buffer & 0xffffffff; @@ -23,22 +23,22 @@ io_cmp orca_io_wait_single_req(io_req* wasmReq) if(bufferIndex + req.size > memSize) { - cmp.error = IO_ERR_ARG; + cmp.error = OC_IO_ERR_ARG; } else { req.buffer = memory + bufferIndex; - if(req.op == IO_OP_OPEN_AT) + if(req.op == OC_IO_OPEN_AT) { if(req.handle.h == 0) { //NOTE: change root to app local folder req.handle = orca->rootDir; - req.open.flags |= FILE_OPEN_RESTRICT; + req.open.flags |= OC_FILE_OPEN_RESTRICT; } } - cmp = io_wait_single_req_with_table(&req, &orca->fileTable); + cmp = oc_io_wait_single_req_with_table(&req, &orca->fileTable); } return(cmp); } diff --git a/src/runtime_memory.c b/src/runtime_memory.c index 945e405..cbdc74d 100644 --- a/src/runtime_memory.c +++ b/src/runtime_memory.c @@ -20,14 +20,14 @@ void* wasm_memory_resize_callback(void* p, unsigned long size, void* userData) { u32 commitSize = size - memory->committed; - mem_base_allocator* allocator = mem_base_allocator_default(); - mem_base_commit(allocator, memory->ptr + memory->committed, commitSize); + oc_base_allocator* allocator = oc_base_allocator_default(); + oc_base_commit(allocator, memory->ptr + memory->committed, commitSize); memory->committed += commitSize; return(memory->ptr); } else { - DEBUG_ASSERT(0, "Out of memory"); + OC_ABORT("Out of memory"); return(0); } } @@ -36,17 +36,17 @@ void wasm_memory_free_callback(void* p, void* userData) { wasm_memory* memory = (wasm_memory*)userData; - mem_base_allocator* allocator = mem_base_allocator_default(); - mem_base_release(allocator, memory->ptr, memory->reserved); + oc_base_allocator* allocator = oc_base_allocator_default(); + oc_base_release(allocator, memory->ptr, memory->reserved); memset(memory, 0, sizeof(wasm_memory)); } -extern u32 orca_mem_grow(u64 size) +extern u32 oc_mem_grow(u64 size) { - orca_runtime* runtime = orca_runtime_get(); + oc_runtime_env* runtime = oc_runtime_env_get(); wasm_memory* memory = &runtime->wasmMemory; - size = AlignUpOnPow2(size, d_m3MemPageSize); + size = oc_align_up_pow2(size, d_m3MemPageSize); u64 totalSize = size + m3_GetMemorySize(runtime->m3Runtime); u32 addr = memory->committed; @@ -61,6 +61,6 @@ extern u32 orca_mem_grow(u64 size) void* wasm_memory_offset_to_ptr(wasm_memory* memory, u32 offset) { M3MemoryHeader* header = (M3MemoryHeader*)(memory->ptr); - DEBUG_ASSERT(offset < header->length, "Wasm offset exceeds memory length") + OC_DEBUG_ASSERT(offset < header->length, "Wasm offset exceeds memory length"); return memory->ptr + sizeof(M3MemoryHeader) + offset; } diff --git a/src/ui/input_state.c b/src/ui/input_state.c index 074c805..5d7e2c1 100644 --- a/src/ui/input_state.c +++ b/src/ui/input_state.c @@ -11,7 +11,7 @@ // Input state updating //--------------------------------------------------------------- -static void mp_update_key_state(mp_input_state* state, mp_key_state* key, mp_key_action action) +static void oc_update_key_state(oc_input_state* state, oc_key_state* key, oc_key_action action) { u64 frameCounter = state->frameCounter; if(key->lastUpdate != frameCounter) @@ -25,7 +25,7 @@ static void mp_update_key_state(mp_input_state* state, mp_key_state* key, mp_key switch(action) { - case MP_KEY_PRESS: + case OC_KEY_PRESS: { if(!key->down) { @@ -34,13 +34,13 @@ static void mp_update_key_state(mp_input_state* state, mp_key_state* key, mp_key key->down = true; } break; - case MP_KEY_REPEAT: + case OC_KEY_REPEAT: { key->repeatCount++; key->down = true; } break; - case MP_KEY_RELEASE: + case OC_KEY_RELEASE: { if(key->down) { @@ -54,44 +54,44 @@ static void mp_update_key_state(mp_input_state* state, mp_key_state* key, mp_key } } -static void mp_update_key_mods(mp_input_state* state, mp_keymod_flags mods) +static void oc_update_key_mods(oc_input_state* state, oc_keymod_flags mods) { state->keyboard.mods = mods; } -static void mp_update_mouse_move(mp_input_state* state, f32 x, f32 y, f32 deltaX, f32 deltaY) +static void oc_update_mouse_move(oc_input_state* state, f32 x, f32 y, f32 deltaX, f32 deltaY) { u64 frameCounter = state->frameCounter; - mp_mouse_state* mouse = &state->mouse; + oc_mouse_state* mouse = &state->mouse; if(mouse->lastUpdate != frameCounter) { - mouse->delta = (vec2){0, 0}; - mouse->wheel = (vec2){0, 0}; + mouse->delta = (oc_vec2){0, 0}; + mouse->wheel = (oc_vec2){0, 0}; mouse->lastUpdate = frameCounter; } - mouse->pos = (vec2){x, y}; + mouse->pos = (oc_vec2){x, y}; mouse->delta.x += deltaX; mouse->delta.y += deltaY; } -static void mp_update_mouse_wheel(mp_input_state* state, f32 deltaX, f32 deltaY) +static void oc_update_mouse_wheel(oc_input_state* state, f32 deltaX, f32 deltaY) { u64 frameCounter = state->frameCounter; - mp_mouse_state* mouse = &state->mouse; + oc_mouse_state* mouse = &state->mouse; if(mouse->lastUpdate != frameCounter) { - mouse->delta = (vec2){0, 0}; - mouse->wheel = (vec2){0, 0}; + mouse->delta = (oc_vec2){0, 0}; + mouse->wheel = (oc_vec2){0, 0}; mouse->lastUpdate = frameCounter; } mouse->wheel.x += deltaX; mouse->wheel.y += deltaY; } -static void mp_update_text(mp_input_state* state, utf32 codepoint) +static void oc_update_text(oc_input_state* state, oc_utf32 codepoint) { u64 frameCounter = state->frameCounter; - mp_text_state* text = &state->text; + oc_text_state* text = &state->text; if(text->lastUpdate != frameCounter) { @@ -100,55 +100,55 @@ static void mp_update_text(mp_input_state* state, utf32 codepoint) } text->codePoints.ptr = text->backing; - if(text->codePoints.len < MP_INPUT_TEXT_BACKING_SIZE) + if(text->codePoints.len < OC_INPUT_TEXT_BACKING_SIZE) { text->codePoints.ptr[text->codePoints.len] = codepoint; text->codePoints.len++; } else { - log_warning("too many input codepoints per frame, dropping input"); + oc_log_warning("too many input codepoints per frame, dropping input"); } } -void mp_input_next_frame(mp_input_state* state) +void oc_input_next_frame(oc_input_state* state) { state->frameCounter++; } -void mp_input_process_event(mp_input_state* state, mp_event* event) +void oc_input_process_event(oc_input_state* state, oc_event* event) { switch(event->type) { - case MP_EVENT_KEYBOARD_KEY: + case OC_EVENT_KEYBOARD_KEY: { - mp_key_state* key = &state->keyboard.keys[event->key.code]; - mp_update_key_state(state, key, event->key.action); - mp_update_key_mods(state, event->key.mods); + oc_key_state* key = &state->keyboard.keys[event->key.code]; + oc_update_key_state(state, key, event->key.action); + oc_update_key_mods(state, event->key.mods); } break; - case MP_EVENT_KEYBOARD_CHAR: - mp_update_text(state, event->character.codepoint); + case OC_EVENT_KEYBOARD_CHAR: + oc_update_text(state, event->character.codepoint); break; - case MP_EVENT_KEYBOARD_MODS: - mp_update_key_mods(state, event->key.mods); + case OC_EVENT_KEYBOARD_MODS: + oc_update_key_mods(state, event->key.mods); break; - case MP_EVENT_MOUSE_MOVE: - mp_update_mouse_move(state, event->mouse.x, event->mouse.y, event->mouse.deltaX, event->mouse.deltaY); + case OC_EVENT_MOUSE_MOVE: + oc_update_mouse_move(state, event->mouse.x, event->mouse.y, event->mouse.deltaX, event->mouse.deltaY); break; - case MP_EVENT_MOUSE_WHEEL: - mp_update_mouse_wheel(state, event->mouse.deltaX, event->mouse.deltaY); + case OC_EVENT_MOUSE_WHEEL: + oc_update_mouse_wheel(state, event->mouse.deltaX, event->mouse.deltaY); break; - case MP_EVENT_MOUSE_BUTTON: + case OC_EVENT_MOUSE_BUTTON: { - mp_key_state* key = &state->mouse.buttons[event->key.code]; - mp_update_key_state(state, key, event->key.action); + oc_key_state* key = &state->mouse.buttons[event->key.code]; + oc_update_key_state(state, key, event->key.action); - if(event->key.action == MP_KEY_PRESS) + if(event->key.action == OC_KEY_PRESS) { if(event->key.clickCount >= 1) { @@ -160,7 +160,7 @@ void mp_input_process_event(mp_input_state* state, mp_event* event) } } - mp_update_key_mods(state, event->key.mods); + oc_update_key_mods(state, event->key.mods); } break; default: @@ -172,27 +172,27 @@ void mp_input_process_event(mp_input_state* state, mp_event* event) // Input state polling //-------------------------------------------------------------------- -mp_key_state mp_key_get_state(mp_input_state* input, mp_key_code key) +oc_key_state oc_key_get_state(oc_input_state* input, oc_key_code key) { - mp_key_state state = {0}; - if(key <= MP_KEY_COUNT) + oc_key_state state = {0}; + if(key <= OC_KEY_COUNT) { state = input->keyboard.keys[key]; } return(state); } -mp_key_state mp_mouse_button_get_state(mp_input_state* input, mp_mouse_button button) +oc_key_state oc_mouse_button_get_state(oc_input_state* input, oc_mouse_button button) { - mp_key_state state = {0}; - if(button <= MP_MOUSE_BUTTON_COUNT) + oc_key_state state = {0}; + if(button <= OC_MOUSE_BUTTON_COUNT) { state = input->mouse.buttons[button]; } return(state); } -int mp_key_state_press_count(mp_input_state* input, mp_key_state* key) +int oc_key_state_press_count(oc_input_state* input, oc_key_state* key) { int count = 0; if(key->lastUpdate == input->frameCounter) @@ -207,7 +207,7 @@ int mp_key_state_press_count(mp_input_state* input, mp_key_state* key) return(count); } -int mp_key_state_release_count(mp_input_state* input, mp_key_state* key) +int oc_key_state_release_count(oc_input_state* input, oc_key_state* key) { int count = 0; if(key->lastUpdate == input->frameCounter) @@ -222,7 +222,7 @@ int mp_key_state_release_count(mp_input_state* input, mp_key_state* key) return(count); } -int mp_key_state_repeat_count(mp_input_state* input, mp_key_state* key) +int oc_key_state_repeat_count(oc_input_state* input, oc_key_state* key) { int count = 0; if(key->lastUpdate == input->frameCounter) @@ -232,78 +232,78 @@ int mp_key_state_repeat_count(mp_input_state* input, mp_key_state* key) return(count); } -bool mp_key_down(mp_input_state* input, mp_key_code key) +bool oc_key_down(oc_input_state* input, oc_key_code key) { - mp_key_state state = mp_key_get_state(input, key); + oc_key_state state = oc_key_get_state(input, key); return(state.down); } -int mp_key_pressed(mp_input_state* input, mp_key_code key) +int oc_key_pressed(oc_input_state* input, oc_key_code key) { - mp_key_state state = mp_key_get_state(input, key); - int res = mp_key_state_press_count(input, &state); + oc_key_state state = oc_key_get_state(input, key); + int res = oc_key_state_press_count(input, &state); return(res); } -int mp_key_released(mp_input_state* input, mp_key_code key) +int oc_key_released(oc_input_state* input, oc_key_code key) { - mp_key_state state = mp_key_get_state(input, key); - int res = mp_key_state_release_count(input, &state); + oc_key_state state = oc_key_get_state(input, key); + int res = oc_key_state_release_count(input, &state); return(res); } -int mp_key_repeated(mp_input_state* input, mp_key_code key) +int oc_key_repeated(oc_input_state* input, oc_key_code key) { - mp_key_state state = mp_key_get_state(input, key); - int res = mp_key_state_repeat_count(input, &state); + oc_key_state state = oc_key_get_state(input, key); + int res = oc_key_state_repeat_count(input, &state); return(res); } -bool mp_mouse_down(mp_input_state* input, mp_mouse_button button) +bool oc_mouse_down(oc_input_state* input, oc_mouse_button button) { - mp_key_state state = mp_mouse_button_get_state(input, button); + oc_key_state state = oc_mouse_button_get_state(input, button); return(state.down); } -int mp_mouse_pressed(mp_input_state* input, mp_mouse_button button) +int oc_mouse_pressed(oc_input_state* input, oc_mouse_button button) { - mp_key_state state = mp_mouse_button_get_state(input, button); - int res = mp_key_state_press_count(input, &state); + oc_key_state state = oc_mouse_button_get_state(input, button); + int res = oc_key_state_press_count(input, &state); return(res); } -int mp_mouse_released(mp_input_state* input, mp_mouse_button button) +int oc_mouse_released(oc_input_state* input, oc_mouse_button button) { - mp_key_state state = mp_mouse_button_get_state(input, button); - int res = mp_key_state_release_count(input, &state); + oc_key_state state = oc_mouse_button_get_state(input, button); + int res = oc_key_state_release_count(input, &state); return(res); } -bool mp_mouse_clicked(mp_input_state* input, mp_mouse_button button) +bool oc_mouse_clicked(oc_input_state* input, oc_mouse_button button) { - mp_key_state state = mp_mouse_button_get_state(input, button); + oc_key_state state = oc_mouse_button_get_state(input, button); bool clicked = state.sysClicked && (state.lastUpdate == input->frameCounter); return(clicked); } -bool mp_mouse_double_clicked(mp_input_state* input, mp_mouse_button button) +bool oc_mouse_double_clicked(oc_input_state* input, oc_mouse_button button) { - mp_key_state state = mp_mouse_button_get_state(input, button); + oc_key_state state = oc_mouse_button_get_state(input, button); bool doubleClicked = state.sysClicked && (state.lastUpdate == input->frameCounter); return(doubleClicked); } -mp_keymod_flags mp_key_mods(mp_input_state* input) +oc_keymod_flags oc_key_mods(oc_input_state* input) { return(input->keyboard.mods); } -vec2 mp_mouse_position(mp_input_state* input) +oc_vec2 oc_mouse_position(oc_input_state* input) { return(input->mouse.pos); } -vec2 mp_mouse_delta(mp_input_state* input) +oc_vec2 oc_mouse_delta(oc_input_state* input) { if(input->mouse.lastUpdate == input->frameCounter) { @@ -311,11 +311,11 @@ vec2 mp_mouse_delta(mp_input_state* input) } else { - return((vec2){0, 0}); + return((oc_vec2){0, 0}); } } -vec2 mp_mouse_wheel(mp_input_state* input) +oc_vec2 oc_mouse_wheel(oc_input_state* input) { if(input->mouse.lastUpdate == input->frameCounter) { @@ -323,26 +323,26 @@ vec2 mp_mouse_wheel(mp_input_state* input) } else { - return((vec2){0, 0}); + return((oc_vec2){0, 0}); } } -str32 mp_input_text_utf32(mp_input_state* input, mem_arena* arena) +oc_str32 oc_input_text_utf32(oc_input_state* input, oc_arena* arena) { - str32 res = {0}; + oc_str32 res = {0}; if(input->text.lastUpdate == input->frameCounter) { - res = str32_push_copy(arena, input->text.codePoints); + res = oc_str32_push_copy(arena, input->text.codePoints); } return(res); } -str8 mp_input_text_utf8(mp_input_state* input, mem_arena* arena) +oc_str8 oc_input_text_utf8(oc_input_state* input, oc_arena* arena) { - str8 res = {0}; + oc_str8 res = {0}; if(input->text.lastUpdate == input->frameCounter) { - res = utf8_push_from_codepoints(arena, input->text.codePoints); + res = oc_utf8_push_from_codepoints(arena, input->text.codePoints); } return(res); } diff --git a/src/ui/input_state.h b/src/ui/input_state.h index e9d92d1..0d9c81c 100644 --- a/src/ui/input_state.h +++ b/src/ui/input_state.h @@ -12,9 +12,9 @@ #include"util/typedefs.h" #include"util/strings.h" #include"util/utf8.h" -#include"app/mp_app.h" +#include"app/app.h" -typedef struct mp_key_state +typedef struct oc_key_state { u64 lastUpdate; u32 transitionCount; @@ -23,74 +23,74 @@ typedef struct mp_key_state bool sysClicked; bool sysDoubleClicked; -} mp_key_state; +} oc_key_state; -typedef struct mp_keyboard_state +typedef struct oc_keyboard_state { - mp_key_state keys[MP_KEY_COUNT]; - mp_keymod_flags mods; -} mp_keyboard_state; + oc_key_state keys[OC_KEY_COUNT]; + oc_keymod_flags mods; +} oc_keyboard_state; -typedef struct mp_mouse_state +typedef struct oc_mouse_state { u64 lastUpdate; bool posValid; - vec2 pos; - vec2 delta; - vec2 wheel; + oc_vec2 pos; + oc_vec2 delta; + oc_vec2 wheel; union { - mp_key_state buttons[MP_MOUSE_BUTTON_COUNT]; + oc_key_state buttons[OC_MOUSE_BUTTON_COUNT]; struct { - mp_key_state left; - mp_key_state right; - mp_key_state middle; - mp_key_state ext1; - mp_key_state ext2; + oc_key_state left; + oc_key_state right; + oc_key_state middle; + oc_key_state ext1; + oc_key_state ext2; }; }; -} mp_mouse_state; +} oc_mouse_state; -enum { MP_INPUT_TEXT_BACKING_SIZE = 64 }; +enum { OC_INPUT_TEXT_BACKING_SIZE = 64 }; -typedef struct mp_text_state +typedef struct oc_text_state { u64 lastUpdate; - utf32 backing[MP_INPUT_TEXT_BACKING_SIZE]; - str32 codePoints; -} mp_text_state; + oc_utf32 backing[OC_INPUT_TEXT_BACKING_SIZE]; + oc_str32 codePoints; +} oc_text_state; -typedef struct mp_input_state +typedef struct oc_input_state { u64 frameCounter; - mp_keyboard_state keyboard; - mp_mouse_state mouse; - mp_text_state text; -} mp_input_state; + oc_keyboard_state keyboard; + oc_mouse_state mouse; + oc_text_state text; +} oc_input_state; -MP_API void mp_input_process_event(mp_input_state* state, mp_event* event); -MP_API void mp_input_next_frame(mp_input_state* state); +ORCA_API void oc_input_process_event(oc_input_state* state, oc_event* event); +ORCA_API void oc_input_next_frame(oc_input_state* state); -MP_API bool mp_key_down(mp_input_state* state, mp_key_code key); -MP_API int mp_key_pressed(mp_input_state* state, mp_key_code key); -MP_API int mp_key_released(mp_input_state* state, mp_key_code key); -MP_API int mp_key_repeated(mp_input_state* state, mp_key_code key); +ORCA_API bool oc_key_down(oc_input_state* state, oc_key_code key); +ORCA_API int oc_key_pressed(oc_input_state* state, oc_key_code key); +ORCA_API int oc_key_released(oc_input_state* state, oc_key_code key); +ORCA_API int oc_key_repeated(oc_input_state* state, oc_key_code key); -MP_API bool mp_mouse_down(mp_input_state* state, mp_mouse_button button); -MP_API int mp_mouse_pressed(mp_input_state* state, mp_mouse_button button); -MP_API int mp_mouse_released(mp_input_state* state, mp_mouse_button button); -MP_API bool mp_mouse_clicked(mp_input_state* state, mp_mouse_button button); -MP_API bool mp_mouse_double_clicked(mp_input_state* state, mp_mouse_button button); +ORCA_API bool oc_mouse_down(oc_input_state* state, oc_mouse_button button); +ORCA_API int oc_mouse_pressed(oc_input_state* state, oc_mouse_button button); +ORCA_API int oc_mouse_released(oc_input_state* state, oc_mouse_button button); +ORCA_API bool oc_mouse_clicked(oc_input_state* state, oc_mouse_button button); +ORCA_API bool oc_mouse_double_clicked(oc_input_state* state, oc_mouse_button button); -MP_API vec2 mp_mouse_position(mp_input_state* state); -MP_API vec2 mp_mouse_delta(mp_input_state* state); -MP_API vec2 mp_mouse_wheel(mp_input_state* state); +ORCA_API oc_vec2 oc_mouse_position(oc_input_state* state); +ORCA_API oc_vec2 oc_mouse_delta(oc_input_state* state); +ORCA_API oc_vec2 oc_mouse_wheel(oc_input_state* state); -MP_API str32 mp_input_text_utf32(mp_input_state* state, mem_arena* arena); -MP_API str8 mp_input_text_utf8(mp_input_state* state, mem_arena* arena); +ORCA_API oc_str32 oc_input_text_utf32(oc_input_state* state, oc_arena* arena); +ORCA_API oc_str8 oc_input_text_utf8(oc_input_state* state, oc_arena* arena); -MP_API mp_keymod_flags mp_key_mods(mp_input_state* state); +ORCA_API oc_keymod_flags oc_key_mods(oc_input_state* state); #endif //__INPUT_STATE_H_ diff --git a/src/ui/ui.c b/src/ui/ui.c index 725c697..82c8b63 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -13,48 +13,48 @@ #include"util/hash.h" #include"ui.h" -static ui_style UI_STYLE_DEFAULTS = +static oc_ui_style OC_UI_STYLE_DEFAULTS = { - .size.width = {.kind = UI_SIZE_CHILDREN, + .size.width = {.kind = OC_UI_SIZE_CHILDREN, .value = 0, .relax = 0}, - .size.height = {.kind = UI_SIZE_CHILDREN, + .size.height = {.kind = OC_UI_SIZE_CHILDREN, .value = 0, .relax = 0}, - .layout = {.axis = UI_AXIS_Y, - .align = {UI_ALIGN_START, - UI_ALIGN_START}}, + .layout = {.axis = OC_UI_AXIS_Y, + .align = {OC_UI_ALIGN_START, + OC_UI_ALIGN_START}}, .color = {0, 0, 0, 1}, .fontSize = 16, }; -mp_thread_local ui_context __uiThreadContext = {0}; -mp_thread_local ui_context* __uiCurrentContext = 0; +oc_thread_local oc_ui_context oc_uiThreadContext = {0}; +oc_thread_local oc_ui_context* oc_uiCurrentContext = 0; -ui_context* ui_get_context(void) +oc_ui_context* oc_ui_get_context(void) { - return(__uiCurrentContext); + return(oc_uiCurrentContext); } -void ui_set_context(ui_context* context) +void oc_ui_set_context(oc_ui_context* context) { - __uiCurrentContext = context; + oc_uiCurrentContext = context; } //----------------------------------------------------------------------------- // stacks //----------------------------------------------------------------------------- -ui_stack_elt* ui_stack_push(ui_context* ui, ui_stack_elt** stack) +oc_ui_stack_elt* oc_ui_stack_push(oc_ui_context* ui, oc_ui_stack_elt** stack) { - ui_stack_elt* elt = mem_arena_alloc_type(&ui->frameArena, ui_stack_elt); - memset(elt, 0, sizeof(ui_stack_elt)); + oc_ui_stack_elt* elt = oc_arena_push_type(&ui->frameArena, oc_ui_stack_elt); + memset(elt, 0, sizeof(oc_ui_stack_elt)); elt->parent = *stack; *stack = elt; return(elt); } -void ui_stack_pop(ui_stack_elt** stack) +void oc_ui_stack_pop(oc_ui_stack_elt** stack) { if(*stack) { @@ -62,26 +62,26 @@ void ui_stack_pop(ui_stack_elt** stack) } else { - log_error("ui stack underflow\n"); + oc_log_error("ui stack underflow\n"); } } -mp_rect ui_intersect_rects(mp_rect lhs, mp_rect rhs) +oc_rect oc_ui_intersect_rects(oc_rect lhs, oc_rect rhs) { //NOTE(martin): intersect with current clip - f32 x0 = maximum(lhs.x, rhs.x); - f32 y0 = maximum(lhs.y, rhs.y); - f32 x1 = minimum(lhs.x + lhs.w, rhs.x + rhs.w); - f32 y1 = minimum(lhs.y + lhs.h, rhs.y + rhs.h); - mp_rect r = {x0, y0, maximum(0, x1-x0), maximum(0, y1-y0)}; + f32 x0 = oc_max(lhs.x, rhs.x); + f32 y0 = oc_max(lhs.y, rhs.y); + f32 x1 = oc_min(lhs.x + lhs.w, rhs.x + rhs.w); + f32 y1 = oc_min(lhs.y + lhs.h, rhs.y + rhs.h); + oc_rect r = {x0, y0, oc_max(0, x1-x0), oc_max(0, y1-y0)}; return(r); } -mp_rect ui_clip_top(void) +oc_rect oc_ui_clip_top(void) { - mp_rect r = {-FLT_MAX/2, -FLT_MAX/2, FLT_MAX, FLT_MAX}; - ui_context* ui = ui_get_context(); - ui_stack_elt* elt = ui->clipStack; + oc_rect r = {-FLT_MAX/2, -FLT_MAX/2, FLT_MAX, FLT_MAX}; + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_stack_elt* elt = ui->clipStack; if(elt) { r = elt->clip; @@ -89,50 +89,50 @@ mp_rect ui_clip_top(void) return(r); } -void ui_clip_push(mp_rect clip) +void oc_ui_clip_push(oc_rect clip) { - ui_context* ui = ui_get_context(); - mp_rect current = ui_clip_top(); - ui_stack_elt* elt = ui_stack_push(ui, &ui->clipStack); - elt->clip = ui_intersect_rects(current, clip); + oc_ui_context* ui = oc_ui_get_context(); + oc_rect current = oc_ui_clip_top(); + oc_ui_stack_elt* elt = oc_ui_stack_push(ui, &ui->clipStack); + elt->clip = oc_ui_intersect_rects(current, clip); } -void ui_clip_pop(void) +void oc_ui_clip_pop(void) { - ui_context* ui = ui_get_context(); - ui_stack_pop(&ui->clipStack); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_stack_pop(&ui->clipStack); } -ui_box* ui_box_top(void) +oc_ui_box* oc_ui_box_top(void) { - ui_context* ui = ui_get_context(); - ui_stack_elt* elt = ui->boxStack; - ui_box* box = elt ? elt->box : 0; + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_stack_elt* elt = ui->boxStack; + oc_ui_box* box = elt ? elt->box : 0; return(box); } -void ui_box_push(ui_box* box) +void oc_ui_box_push(oc_ui_box* box) { - ui_context* ui = ui_get_context(); - ui_stack_elt* elt = ui_stack_push(ui, &ui->boxStack); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_stack_elt* elt = oc_ui_stack_push(ui, &ui->boxStack); elt->box = box; - if(box->flags & UI_FLAG_CLIP) + if(box->flags & OC_UI_FLAG_CLIP) { - ui_clip_push(box->rect); + oc_ui_clip_push(box->rect); } } -void ui_box_pop(void) +void oc_ui_box_pop(void) { - ui_context* ui = ui_get_context(); - ui_box* box = ui_box_top(); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_box* box = oc_ui_box_top(); if(box) { - if(box->flags & UI_FLAG_CLIP) + if(box->flags & OC_UI_FLAG_CLIP) { - ui_clip_pop(); + oc_ui_clip_pop(); } - ui_stack_pop(&ui->boxStack); + oc_ui_stack_pop(&ui->boxStack); } } @@ -140,82 +140,82 @@ void ui_box_pop(void) // tagging //----------------------------------------------------------------------------- -ui_tag ui_tag_make_str8(str8 string) +oc_ui_tag oc_ui_tag_make_str8(oc_str8 string) { - ui_tag tag = {.hash = mp_hash_xx64_string(string)}; + oc_ui_tag tag = {.hash = oc_hash_xx64_string(string)}; return(tag); } -void ui_tag_box_str8(ui_box* box, str8 string) +void oc_ui_tag_box_str8(oc_ui_box* box, oc_str8 string) { - ui_context* ui = ui_get_context(); - ui_tag_elt* elt = mem_arena_alloc_type(&ui->frameArena, ui_tag_elt); - elt->tag = ui_tag_make_str8(string); - list_append(&box->tags, &elt->listElt); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_tag_elt* elt = oc_arena_push_type(&ui->frameArena, oc_ui_tag_elt); + elt->tag = oc_ui_tag_make_str8(string); + oc_list_append(&box->tags, &elt->listElt); } -void ui_tag_next_str8(str8 string) +void oc_ui_tag_next_str8(oc_str8 string) { - ui_context* ui = ui_get_context(); - ui_tag_elt* elt = mem_arena_alloc_type(&ui->frameArena, ui_tag_elt); - elt->tag = ui_tag_make_str8(string); - list_append(&ui->nextBoxTags, &elt->listElt); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_tag_elt* elt = oc_arena_push_type(&ui->frameArena, oc_ui_tag_elt); + elt->tag = oc_ui_tag_make_str8(string); + oc_list_append(&ui->nextBoxTags, &elt->listElt); } //----------------------------------------------------------------------------- // key hashing and caching //----------------------------------------------------------------------------- -ui_key ui_key_make_str8(str8 string) +oc_ui_key oc_ui_key_make_str8(oc_str8 string) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); u64 seed = 0; - ui_box* parent = ui_box_top(); + oc_ui_box* parent = oc_ui_box_top(); if(parent) { seed = parent->key.hash; } - ui_key key = {0}; - key.hash = mp_hash_xx64_string_seed(string, seed); + oc_ui_key key = {0}; + key.hash = oc_hash_xx64_string_seed(string, seed); return(key); } -ui_key ui_key_make_path(str8_list path) +oc_ui_key oc_ui_key_make_path(oc_str8_list path) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); u64 seed = 0; - ui_box* parent = ui_box_top(); + oc_ui_box* parent = oc_ui_box_top(); if(parent) { seed = parent->key.hash; } - for_list(&path.list, elt, str8_elt, listElt) + oc_list_for(&path.list, elt, oc_str8_elt, listElt) { - seed = mp_hash_xx64_string_seed(elt->string, seed); + seed = oc_hash_xx64_string_seed(elt->string, seed); } - ui_key key = {seed}; + oc_ui_key key = {seed}; return(key); } -bool ui_key_equal(ui_key a, ui_key b) +bool oc_ui_key_equal(oc_ui_key a, oc_ui_key b) { return(a.hash == b.hash); } -void ui_box_cache(ui_context* ui, ui_box* box) +void oc_ui_box_cache(oc_ui_context* ui, oc_ui_box* box) { - u64 index = box->key.hash & (UI_BOX_MAP_BUCKET_COUNT-1); - list_append(&(ui->boxMap[index]), &box->bucketElt); + u64 index = box->key.hash & (OC_UI_BOX_MAP_BUCKET_COUNT-1); + oc_list_append(&(ui->boxMap[index]), &box->bucketElt); } -ui_box* ui_box_lookup_key(ui_key key) +oc_ui_box* oc_ui_box_lookup_key(oc_ui_key key) { - ui_context* ui = ui_get_context(); - u64 index = key.hash & (UI_BOX_MAP_BUCKET_COUNT-1); + oc_ui_context* ui = oc_ui_get_context(); + u64 index = key.hash & (OC_UI_BOX_MAP_BUCKET_COUNT-1); - for_list(&ui->boxMap[index], box, ui_box, bucketElt) + oc_list_for(&ui->boxMap[index], box, oc_ui_box, bucketElt) { - if(ui_key_equal(key, box->key)) + if(oc_ui_key_equal(key, box->key)) { return(box); } @@ -223,102 +223,102 @@ ui_box* ui_box_lookup_key(ui_key key) return(0); } -ui_box* ui_box_lookup_str8(str8 string) +oc_ui_box* oc_ui_box_lookup_str8(oc_str8 string) { - ui_key key = ui_key_make_str8(string); - return(ui_box_lookup_key(key)); + oc_ui_key key = oc_ui_key_make_str8(string); + return(oc_ui_box_lookup_key(key)); } //----------------------------------------------------------------------------- // styling //----------------------------------------------------------------------------- -void ui_pattern_push(mem_arena* arena, ui_pattern* pattern, ui_selector selector) +void oc_ui_pattern_push(oc_arena* arena, oc_ui_pattern* pattern, oc_ui_selector selector) { - ui_selector* copy = mem_arena_alloc_type(arena, ui_selector); + oc_ui_selector* copy = oc_arena_push_type(arena, oc_ui_selector); *copy = selector; - list_append(&pattern->l, ©->listElt); + oc_list_append(&pattern->l, ©->listElt); } -ui_pattern ui_pattern_all(void) +oc_ui_pattern oc_ui_pattern_all(void) { - ui_context* ui = ui_get_context(); - ui_pattern pattern = {0}; - ui_pattern_push(&ui->frameArena, &pattern, (ui_selector){.kind = UI_SEL_ANY}); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_pattern pattern = {0}; + oc_ui_pattern_push(&ui->frameArena, &pattern, (oc_ui_selector){.kind = OC_UI_SEL_ANY}); return(pattern); } -ui_pattern ui_pattern_owner(void) +oc_ui_pattern oc_ui_pattern_owner(void) { - ui_context* ui = ui_get_context(); - ui_pattern pattern = {0}; - ui_pattern_push(&ui->frameArena, &pattern, (ui_selector){.kind = UI_SEL_OWNER}); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_pattern pattern = {0}; + oc_ui_pattern_push(&ui->frameArena, &pattern, (oc_ui_selector){.kind = OC_UI_SEL_OWNER}); return(pattern); } -void ui_style_match_before(ui_pattern pattern, ui_style* style, ui_style_mask mask) +void oc_ui_style_match_before(oc_ui_pattern pattern, oc_ui_style* style, oc_ui_style_mask mask) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); if(ui) { - ui_style_rule* rule = mem_arena_alloc_type(&ui->frameArena, ui_style_rule); + oc_ui_style_rule* rule = oc_arena_push_type(&ui->frameArena, oc_ui_style_rule); rule->pattern = pattern; rule->mask = mask; - rule->style = mem_arena_alloc_type(&ui->frameArena, ui_style); + rule->style = oc_arena_push_type(&ui->frameArena, oc_ui_style); *rule->style = *style; - list_append(&ui->nextBoxBeforeRules, &rule->boxElt); + oc_list_append(&ui->nextBoxBeforeRules, &rule->boxElt); } } -void ui_style_match_after(ui_pattern pattern, ui_style* style, ui_style_mask mask) +void oc_ui_style_match_after(oc_ui_pattern pattern, oc_ui_style* style, oc_ui_style_mask mask) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); if(ui) { - ui_style_rule* rule = mem_arena_alloc_type(&ui->frameArena, ui_style_rule); + oc_ui_style_rule* rule = oc_arena_push_type(&ui->frameArena, oc_ui_style_rule); rule->pattern = pattern; rule->mask = mask; - rule->style = mem_arena_alloc_type(&ui->frameArena, ui_style); + rule->style = oc_arena_push_type(&ui->frameArena, oc_ui_style); *rule->style = *style; - list_append(&ui->nextBoxAfterRules, &rule->boxElt); + oc_list_append(&ui->nextBoxAfterRules, &rule->boxElt); } } -void ui_style_next(ui_style* style, ui_style_mask mask) +void oc_ui_style_next(oc_ui_style* style, oc_ui_style_mask mask) { - ui_style_match_before(ui_pattern_owner(), style, mask); + oc_ui_style_match_before(oc_ui_pattern_owner(), style, mask); } -void ui_style_box_before(ui_box* box, ui_pattern pattern, ui_style* style, ui_style_mask mask) +void oc_ui_style_box_before(oc_ui_box* box, oc_ui_pattern pattern, oc_ui_style* style, oc_ui_style_mask mask) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); if(ui) { - ui_style_rule* rule = mem_arena_alloc_type(&ui->frameArena, ui_style_rule); + oc_ui_style_rule* rule = oc_arena_push_type(&ui->frameArena, oc_ui_style_rule); rule->pattern = pattern; rule->mask = mask; - rule->style = mem_arena_alloc_type(&ui->frameArena, ui_style); + rule->style = oc_arena_push_type(&ui->frameArena, oc_ui_style); *rule->style = *style; - list_append(&box->beforeRules, &rule->boxElt); + oc_list_append(&box->beforeRules, &rule->boxElt); rule->owner = box; } } -void ui_style_box_after(ui_box* box, ui_pattern pattern, ui_style* style, ui_style_mask mask) +void oc_ui_style_box_after(oc_ui_box* box, oc_ui_pattern pattern, oc_ui_style* style, oc_ui_style_mask mask) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); if(ui) { - ui_style_rule* rule = mem_arena_alloc_type(&ui->frameArena, ui_style_rule); + oc_ui_style_rule* rule = oc_arena_push_type(&ui->frameArena, oc_ui_style_rule); rule->pattern = pattern; rule->mask = mask; - rule->style = mem_arena_alloc_type(&ui->frameArena, ui_style); + rule->style = oc_arena_push_type(&ui->frameArena, oc_ui_style); *rule->style = *style; - list_append(&box->afterRules, &rule->boxElt); + oc_list_append(&box->afterRules, &rule->boxElt); rule->owner = box; } } @@ -327,30 +327,30 @@ void ui_style_box_after(ui_box* box, ui_pattern pattern, ui_style* style, ui_sty // input //----------------------------------------------------------------------------- -void ui_process_event(mp_event* event) +void oc_ui_process_event(oc_event* event) { - ui_context* ui = ui_get_context(); - mp_input_process_event(&ui->input, event); + oc_ui_context* ui = oc_ui_get_context(); + oc_input_process_event(&ui->input, event); } -vec2 ui_mouse_position(void) +oc_vec2 oc_ui_mouse_position(void) { - ui_context* ui = ui_get_context(); - vec2 mousePos = mp_mouse_position(&ui->input); + oc_ui_context* ui = oc_ui_get_context(); + oc_vec2 mousePos = oc_mouse_position(&ui->input); return(mousePos); } -vec2 ui_mouse_delta(void) +oc_vec2 oc_ui_mouse_delta(void) { - ui_context* ui = ui_get_context(); - vec2 delta = mp_mouse_delta(&ui->input); + oc_ui_context* ui = oc_ui_get_context(); + oc_vec2 delta = oc_mouse_delta(&ui->input); return(delta); } -vec2 ui_mouse_wheel(void) +oc_vec2 oc_ui_mouse_wheel(void) { - ui_context* ui = ui_get_context(); - vec2 delta = mp_mouse_wheel(&ui->input); + oc_ui_context* ui = oc_ui_get_context(); + oc_vec2 delta = oc_mouse_wheel(&ui->input); return(delta); } @@ -358,7 +358,7 @@ vec2 ui_mouse_wheel(void) // ui boxes //----------------------------------------------------------------------------- -bool ui_rect_hit(mp_rect r, vec2 p) +bool oc_ui_rect_hit(oc_rect r, oc_vec2 p) { return( (p.x > r.x) &&(p.x < r.x + r.w) @@ -366,32 +366,32 @@ bool ui_rect_hit(mp_rect r, vec2 p) &&(p.y < r.y + r.h)); } -bool ui_box_hovering(ui_box* box, vec2 p) +bool oc_ui_box_hovering(oc_ui_box* box, oc_vec2 p) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - mp_rect clip = ui_clip_top(); - mp_rect rect = ui_intersect_rects(clip, box->rect); - bool hit = ui_rect_hit(rect, p); + oc_rect clip = oc_ui_clip_top(); + oc_rect rect = oc_ui_intersect_rects(clip, box->rect); + bool hit = oc_ui_rect_hit(rect, p); bool result = hit && (!ui->hovered || box->z >= ui->hovered->z); return(result); } -ui_box* ui_box_make_str8(str8 string, ui_flags flags) +oc_ui_box* oc_ui_box_make_str8(oc_str8 string, oc_ui_flags flags) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_key key = ui_key_make_str8(string); - ui_box* box = ui_box_lookup_key(key); + oc_ui_key key = oc_ui_key_make_str8(string); + oc_ui_box* box = oc_ui_box_lookup_key(key); if(!box) { - box = mem_pool_alloc_type(&ui->boxPool, ui_box); - memset(box, 0, sizeof(ui_box)); + box = oc_pool_alloc_type(&ui->boxPool, oc_ui_box); + memset(box, 0, sizeof(oc_ui_box)); box->key = key; box->fresh = true; - ui_box_cache(ui, box); + oc_ui_box_cache(ui, box); } else { @@ -401,62 +401,62 @@ ui_box* ui_box_make_str8(str8 string, ui_flags flags) //NOTE: setup hierarchy if(box->frameCounter != ui->frameCounter) { - list_init(&box->children); - box->parent = ui_box_top(); + oc_list_init(&box->children); + box->parent = oc_ui_box_top(); if(box->parent) { - list_append(&box->parent->children, &box->listElt); + oc_list_append(&box->parent->children, &box->listElt); box->parentClosed = box->parent->closed || box->parent->parentClosed; } - if(box->flags & UI_FLAG_OVERLAY) + if(box->flags & OC_UI_FLAG_OVERLAY) { - list_append(&ui->overlayList, &box->overlayElt); + oc_list_append(&ui->overlayList, &box->overlayElt); } } else { //maybe this should be a warning that we're trying to make the box twice in the same frame? - log_warning("trying to make ui box '%.*s' multiple times in the same frame\n", (int)box->string.len, box->string.ptr); + oc_log_warning("trying to make ui box '%.*s' multiple times in the same frame\n", (int)box->string.len, box->string.ptr); } //NOTE: setup per-frame state box->frameCounter = ui->frameCounter; - box->string = str8_push_copy(&ui->frameArena, string); + box->string = oc_str8_push_copy(&ui->frameArena, string); box->flags = flags; //NOTE: create style and setup non-inherited attributes to default values - box->targetStyle = mem_arena_alloc_type(&ui->frameArena, ui_style); - ui_apply_style_with_mask(box->targetStyle, &UI_STYLE_DEFAULTS, ~0ULL); + box->targetStyle = oc_arena_push_type(&ui->frameArena, oc_ui_style); + oc_ui_apply_style_with_mask(box->targetStyle, &OC_UI_STYLE_DEFAULTS, ~0ULL); //NOTE: set tags, before rules and last box box->tags = ui->nextBoxTags; - ui->nextBoxTags = (list_info){0}; + ui->nextBoxTags = (oc_list){0}; box->beforeRules = ui->nextBoxBeforeRules; - for_list(&box->beforeRules, rule, ui_style_rule, boxElt) + oc_list_for(&box->beforeRules, rule, oc_ui_style_rule, boxElt) { rule->owner = box; } - ui->nextBoxBeforeRules = (list_info){0}; + ui->nextBoxBeforeRules = (oc_list){0}; box->afterRules = ui->nextBoxAfterRules; - for_list(&box->afterRules, rule, ui_style_rule, boxElt) + oc_list_for(&box->afterRules, rule, oc_ui_style_rule, boxElt) { rule->owner = box; } - ui->nextBoxAfterRules = (list_info){0}; + ui->nextBoxAfterRules = (oc_list){0}; //NOTE: set scroll - if(ui_box_hovering(box, ui_mouse_position())) + if(oc_ui_box_hovering(box, oc_ui_mouse_position())) { - vec2 wheel = ui_mouse_wheel(); - if(box->flags & UI_FLAG_SCROLL_WHEEL_X) + oc_vec2 wheel = oc_ui_mouse_wheel(); + if(box->flags & OC_UI_FLAG_SCROLL_WHEEL_X) { box->scroll.x += wheel.x; } - if(box->flags & UI_FLAG_SCROLL_WHEEL_Y) + if(box->flags & OC_UI_FLAG_SCROLL_WHEEL_Y) { box->scroll.y += wheel.y; } @@ -464,90 +464,90 @@ ui_box* ui_box_make_str8(str8 string, ui_flags flags) return(box); } -ui_box* ui_box_begin_str8(str8 string, ui_flags flags) +oc_ui_box* oc_ui_box_begin_str8(oc_str8 string, oc_ui_flags flags) { - ui_context* ui = ui_get_context(); - ui_box* box = ui_box_make_str8(string, flags); - ui_box_push(box); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_box* box = oc_ui_box_make_str8(string, flags); + oc_ui_box_push(box); return(box); } -ui_box* ui_box_end(void) +oc_ui_box* oc_ui_box_end(void) { - ui_context* ui = ui_get_context(); - ui_box* box = ui_box_top(); - DEBUG_ASSERT(box, "box stack underflow"); + oc_ui_context* ui = oc_ui_get_context(); + oc_ui_box* box = oc_ui_box_top(); + OC_DEBUG_ASSERT(box, "box stack underflow"); - ui_box_pop(); + oc_ui_box_pop(); return(box); } -void ui_box_set_draw_proc(ui_box* box, ui_box_draw_proc proc, void* data) +void oc_ui_box_set_draw_proc(oc_ui_box* box, oc_ui_box_draw_proc proc, void* data) { box->drawProc = proc; box->drawData = data; } -void ui_box_set_closed(ui_box* box, bool closed) +void oc_ui_box_set_closed(oc_ui_box* box, bool closed) { box->closed = closed; } -bool ui_box_closed(ui_box* box) +bool oc_ui_box_closed(oc_ui_box* box) { return(box->closed); } -void ui_box_activate(ui_box* box) +void oc_ui_box_activate(oc_ui_box* box) { box->active = true; } -void ui_box_deactivate(ui_box* box) +void oc_ui_box_deactivate(oc_ui_box* box) { box->active = false; } -bool ui_box_active(ui_box* box) +bool oc_ui_box_active(oc_ui_box* box) { return(box->active); } -void ui_box_set_hot(ui_box* box, bool hot) +void oc_ui_box_set_hot(oc_ui_box* box, bool hot) { box->hot = hot; } -bool ui_box_hot(ui_box* box) +bool oc_ui_box_hot(oc_ui_box* box) { return(box->hot); } -ui_sig ui_box_sig(ui_box* box) +oc_ui_sig oc_ui_box_sig(oc_ui_box* box) { //NOTE: compute input signals - ui_sig sig = {0}; + oc_ui_sig sig = {0}; - ui_context* ui = ui_get_context(); - mp_input_state* input = &ui->input; + oc_ui_context* ui = oc_ui_get_context(); + oc_input_state* input = &ui->input; sig.box = box; if(!box->closed && !box->parentClosed) { - vec2 mousePos = ui_mouse_position(); + oc_vec2 mousePos = oc_ui_mouse_position(); - sig.mouse = (vec2){mousePos.x - box->rect.x, mousePos.y - box->rect.y}; - sig.delta = ui_mouse_delta(); - sig.wheel = ui_mouse_wheel(); - sig.hovering = ui_box_hovering(box, mousePos); + sig.mouse = (oc_vec2){mousePos.x - box->rect.x, mousePos.y - box->rect.y}; + sig.delta = oc_ui_mouse_delta(); + sig.wheel = oc_ui_mouse_wheel(); + sig.hovering = oc_ui_box_hovering(box, mousePos); - if(box->flags & UI_FLAG_CLICKABLE) + if(box->flags & OC_UI_FLAG_CLICKABLE) { if(sig.hovering) { - sig.pressed = mp_mouse_pressed(input, MP_MOUSE_LEFT); + sig.pressed = oc_mouse_pressed(input, OC_MOUSE_LEFT); if(sig.pressed) { if(!box->dragging) @@ -556,11 +556,11 @@ ui_sig ui_box_sig(ui_box* box) } box->dragging = true; } - sig.doubleClicked = mp_mouse_double_clicked(input, MP_MOUSE_LEFT); - sig.rightPressed = mp_mouse_pressed(input, MP_MOUSE_RIGHT); + sig.doubleClicked = oc_mouse_double_clicked(input, OC_MOUSE_LEFT); + sig.rightPressed = oc_mouse_pressed(input, OC_MOUSE_RIGHT); } - sig.released = mp_mouse_released(input, MP_MOUSE_LEFT); + sig.released = oc_mouse_released(input, OC_MOUSE_LEFT); if(sig.released) { if(box->dragging && sig.hovering) @@ -569,7 +569,7 @@ ui_sig ui_box_sig(ui_box* box) } } - if(!mp_mouse_down(input, MP_MOUSE_LEFT)) + if(!oc_mouse_down(input, OC_MOUSE_LEFT)) { box->dragging = false; } @@ -581,7 +581,7 @@ ui_sig ui_box_sig(ui_box* box) return(sig); } -bool ui_box_hidden(ui_box* box) +bool oc_ui_box_hidden(oc_ui_box* box) { return(box->closed || box->parentClosed); } @@ -590,7 +590,7 @@ bool ui_box_hidden(ui_box* box) // Auto-layout //----------------------------------------------------------------------------- -void ui_animate_f32(ui_context* ui, f32* value, f32 target, f32 animationTime) +void oc_ui_animate_f32(oc_ui_context* ui, f32* value, f32 target, f32 animationTime) { if( animationTime < 1e-6 || fabs(*value - target) < 0.001) @@ -614,30 +614,30 @@ void ui_animate_f32(ui_context* ui, f32* value, f32 target, f32 animationTime) } } -void ui_animate_color(ui_context* ui, mg_color* color, mg_color target, f32 animationTime) +void oc_ui_animate_color(oc_ui_context* ui, oc_color* color, oc_color target, f32 animationTime) { for(int i=0; i<4; i++) { - ui_animate_f32(ui, &color->c[i], target.c[i], animationTime); + oc_ui_animate_f32(ui, &color->c[i], target.c[i], animationTime); } } -void ui_animate_ui_size(ui_context* ui, ui_size* size, ui_size target, f32 animationTime) +void oc_ui_animate_oc_ui_size(oc_ui_context* ui, oc_ui_size* size, oc_ui_size target, f32 animationTime) { size->kind = target.kind; - ui_animate_f32(ui, &size->value, target.value, animationTime); - ui_animate_f32(ui, &size->relax, target.relax, animationTime); + oc_ui_animate_f32(ui, &size->value, target.value, animationTime); + oc_ui_animate_f32(ui, &size->relax, target.relax, animationTime); } -void ui_box_animate_style(ui_context* ui, ui_box* box) +void oc_ui_box_animate_style(oc_ui_context* ui, oc_ui_box* box) { - ui_style* targetStyle = box->targetStyle; - DEBUG_ASSERT(targetStyle); + oc_ui_style* targetStyle = box->targetStyle; + OC_DEBUG_ASSERT(targetStyle); f32 animationTime = targetStyle->animationTime; //NOTE: interpolate based on transition values - ui_style_mask mask = box->targetStyle->animationMask; + oc_ui_style_mask mask = box->targetStyle->animationMask; if(box->fresh) { @@ -645,27 +645,27 @@ void ui_box_animate_style(ui_context* ui, ui_box* box) } else { - if(mask & UI_STYLE_SIZE_WIDTH) + if(mask & OC_UI_STYLE_SIZE_WIDTH) { - ui_animate_ui_size(ui, &box->style.size.c[UI_AXIS_X], targetStyle->size.c[UI_AXIS_X], animationTime); + oc_ui_animate_oc_ui_size(ui, &box->style.size.c[OC_UI_AXIS_X], targetStyle->size.c[OC_UI_AXIS_X], animationTime); } else { - box->style.size.c[UI_AXIS_X] = targetStyle->size.c[UI_AXIS_X]; + box->style.size.c[OC_UI_AXIS_X] = targetStyle->size.c[OC_UI_AXIS_X]; } - if(mask & UI_STYLE_SIZE_HEIGHT) + if(mask & OC_UI_STYLE_SIZE_HEIGHT) { - ui_animate_ui_size(ui, &box->style.size.c[UI_AXIS_Y], targetStyle->size.c[UI_AXIS_Y], animationTime); + oc_ui_animate_oc_ui_size(ui, &box->style.size.c[OC_UI_AXIS_Y], targetStyle->size.c[OC_UI_AXIS_Y], animationTime); } else { - box->style.size.c[UI_AXIS_Y] = targetStyle->size.c[UI_AXIS_Y]; + box->style.size.c[OC_UI_AXIS_Y] = targetStyle->size.c[OC_UI_AXIS_Y]; } - if(mask & UI_STYLE_COLOR) + if(mask & OC_UI_STYLE_COLOR) { - ui_animate_color(ui, &box->style.color, targetStyle->color, animationTime); + oc_ui_animate_color(ui, &box->style.color, targetStyle->color, animationTime); } else { @@ -673,45 +673,45 @@ void ui_box_animate_style(ui_context* ui, ui_box* box) } - if(mask & UI_STYLE_BG_COLOR) + if(mask & OC_UI_STYLE_BG_COLOR) { - ui_animate_color(ui, &box->style.bgColor, targetStyle->bgColor, animationTime); + oc_ui_animate_color(ui, &box->style.bgColor, targetStyle->bgColor, animationTime); } else { box->style.bgColor = targetStyle->bgColor; } - if(mask & UI_STYLE_BORDER_COLOR) + if(mask & OC_UI_STYLE_BORDER_COLOR) { - ui_animate_color(ui, &box->style.borderColor, targetStyle->borderColor, animationTime); + oc_ui_animate_color(ui, &box->style.borderColor, targetStyle->borderColor, animationTime); } else { box->style.borderColor = targetStyle->borderColor; } - if(mask & UI_STYLE_FONT_SIZE) + if(mask & OC_UI_STYLE_FONT_SIZE) { - ui_animate_f32(ui, &box->style.fontSize, targetStyle->fontSize, animationTime); + oc_ui_animate_f32(ui, &box->style.fontSize, targetStyle->fontSize, animationTime); } else { box->style.fontSize = targetStyle->fontSize; } - if(mask & UI_STYLE_BORDER_SIZE) + if(mask & OC_UI_STYLE_BORDER_SIZE) { - ui_animate_f32(ui, &box->style.borderSize, targetStyle->borderSize, animationTime); + oc_ui_animate_f32(ui, &box->style.borderSize, targetStyle->borderSize, animationTime); } else { box->style.borderSize = targetStyle->borderSize; } - if(mask & UI_STYLE_ROUNDNESS) + if(mask & OC_UI_STYLE_ROUNDNESS) { - ui_animate_f32(ui, &box->style.roundness, targetStyle->roundness, animationTime); + oc_ui_animate_f32(ui, &box->style.roundness, targetStyle->roundness, animationTime); } else { @@ -727,109 +727,109 @@ void ui_box_animate_style(ui_context* ui, ui_box* box) } } -void ui_apply_style_with_mask(ui_style* dst, ui_style* src, ui_style_mask mask) +void oc_ui_apply_style_with_mask(oc_ui_style* dst, oc_ui_style* src, oc_ui_style_mask mask) { - if(mask & UI_STYLE_SIZE_WIDTH) + if(mask & OC_UI_STYLE_SIZE_WIDTH) { - dst->size.c[UI_AXIS_X] = src->size.c[UI_AXIS_X]; + dst->size.c[OC_UI_AXIS_X] = src->size.c[OC_UI_AXIS_X]; } - if(mask & UI_STYLE_SIZE_HEIGHT) + if(mask & OC_UI_STYLE_SIZE_HEIGHT) { - dst->size.c[UI_AXIS_Y] = src->size.c[UI_AXIS_Y]; + dst->size.c[OC_UI_AXIS_Y] = src->size.c[OC_UI_AXIS_Y]; } - if(mask & UI_STYLE_LAYOUT_AXIS) + if(mask & OC_UI_STYLE_LAYOUT_AXIS) { dst->layout.axis = src->layout.axis; } - if(mask & UI_STYLE_LAYOUT_ALIGN_X) + if(mask & OC_UI_STYLE_LAYOUT_ALIGN_X) { dst->layout.align.x = src->layout.align.x; } - if(mask & UI_STYLE_LAYOUT_ALIGN_Y) + if(mask & OC_UI_STYLE_LAYOUT_ALIGN_Y) { dst->layout.align.y = src->layout.align.y; } - if(mask & UI_STYLE_LAYOUT_SPACING) + if(mask & OC_UI_STYLE_LAYOUT_SPACING) { dst->layout.spacing = src->layout.spacing; } - if(mask & UI_STYLE_LAYOUT_MARGIN_X) + if(mask & OC_UI_STYLE_LAYOUT_MARGIN_X) { dst->layout.margin.x = src->layout.margin.x; } - if(mask & UI_STYLE_LAYOUT_MARGIN_Y) + if(mask & OC_UI_STYLE_LAYOUT_MARGIN_Y) { dst->layout.margin.y = src->layout.margin.y; } - if(mask & UI_STYLE_FLOAT_X) + if(mask & OC_UI_STYLE_FLOAT_X) { - dst->floating.c[UI_AXIS_X] = src->floating.c[UI_AXIS_X]; + dst->floating.c[OC_UI_AXIS_X] = src->floating.c[OC_UI_AXIS_X]; dst->floatTarget.x = src->floatTarget.x; } - if(mask & UI_STYLE_FLOAT_Y) + if(mask & OC_UI_STYLE_FLOAT_Y) { - dst->floating.c[UI_AXIS_Y] = src->floating.c[UI_AXIS_Y]; + dst->floating.c[OC_UI_AXIS_Y] = src->floating.c[OC_UI_AXIS_Y]; dst->floatTarget.y = src->floatTarget.y; } - if(mask & UI_STYLE_COLOR) + if(mask & OC_UI_STYLE_COLOR) { dst->color = src->color; } - if(mask & UI_STYLE_BG_COLOR) + if(mask & OC_UI_STYLE_BG_COLOR) { dst->bgColor = src->bgColor; } - if(mask & UI_STYLE_BORDER_COLOR) + if(mask & OC_UI_STYLE_BORDER_COLOR) { dst->borderColor = src->borderColor; } - if(mask & UI_STYLE_BORDER_SIZE) + if(mask & OC_UI_STYLE_BORDER_SIZE) { dst->borderSize = src->borderSize; } - if(mask & UI_STYLE_ROUNDNESS) + if(mask & OC_UI_STYLE_ROUNDNESS) { dst->roundness = src->roundness; } - if(mask & UI_STYLE_FONT) + if(mask & OC_UI_STYLE_FONT) { dst->font = src->font; } - if(mask & UI_STYLE_FONT_SIZE) + if(mask & OC_UI_STYLE_FONT_SIZE) { dst->fontSize = src->fontSize; } - if(mask & UI_STYLE_ANIMATION_TIME) + if(mask & OC_UI_STYLE_ANIMATION_TIME) { dst->animationTime = src->animationTime; } - if(mask & UI_STYLE_ANIMATION_MASK) + if(mask & OC_UI_STYLE_ANIMATION_MASK) { dst->animationMask = src->animationMask; } } -bool ui_style_selector_match(ui_box* box, ui_style_rule* rule, ui_selector* selector) +bool oc_ui_style_selector_match(oc_ui_box* box, oc_ui_style_rule* rule, oc_ui_selector* selector) { bool res = false; switch(selector->kind) { - case UI_SEL_ANY: + case OC_UI_SEL_ANY: res = true; break; - case UI_SEL_OWNER: + case OC_UI_SEL_OWNER: res = (box == rule->owner); break; - case UI_SEL_TEXT: - res = !str8_cmp(box->string, selector->text); + case OC_UI_SEL_TEXT: + res = !oc_str8_cmp(box->string, selector->text); break; - case UI_SEL_TAG: + case OC_UI_SEL_TAG: { - for_list(&box->tags, elt, ui_tag_elt, listElt) + oc_list_for(&box->tags, elt, oc_ui_tag_elt, listElt) { if(elt->tag.hash == selector->tag.hash) { @@ -839,170 +839,170 @@ bool ui_style_selector_match(ui_box* box, ui_style_rule* rule, ui_selector* sele } } break; - case UI_SEL_STATUS: + case OC_UI_SEL_STATUS: { res = true; - if(selector->status & UI_HOVER) + if(selector->status & OC_UI_HOVER) { - res = res && ui_box_hovering(box, ui_mouse_position()); + res = res && oc_ui_box_hovering(box, oc_ui_mouse_position()); } - if(selector->status & UI_ACTIVE) + if(selector->status & OC_UI_ACTIVE) { res = res && box->active; } - if(selector->status & UI_DRAGGING) + if(selector->status & OC_UI_DRAGGING) { res = res && box->dragging; } } break; - case UI_SEL_KEY: - res = ui_key_equal(box->key, selector->key); + case OC_UI_SEL_KEY: + res = oc_ui_key_equal(box->key, selector->key); default: break; } return(res); } -void ui_style_rule_match(ui_context* ui, ui_box* box, ui_style_rule* rule, list_info* buildList, list_info* tmpList) +void oc_ui_style_rule_match(oc_ui_context* ui, oc_ui_box* box, oc_ui_style_rule* rule, oc_list* buildList, oc_list* tmpList) { - ui_selector* selector = list_first_entry(&rule->pattern.l, ui_selector, listElt); - bool match = ui_style_selector_match(box, rule, selector); + oc_ui_selector* selector = oc_list_first_entry(&rule->pattern.l, oc_ui_selector, listElt); + bool match = oc_ui_style_selector_match(box, rule, selector); - selector = list_next_entry(&rule->pattern.l, selector, ui_selector, listElt); - while(match && selector && selector->op == UI_SEL_AND) + selector = oc_list_next_entry(&rule->pattern.l, selector, oc_ui_selector, listElt); + while(match && selector && selector->op == OC_UI_SEL_AND) { - match = match && ui_style_selector_match(box, rule, selector); - selector = list_next_entry(&rule->pattern.l, selector, ui_selector, listElt); + match = match && oc_ui_style_selector_match(box, rule, selector); + selector = oc_list_next_entry(&rule->pattern.l, selector, oc_ui_selector, listElt); } if(match) { if(!selector) { - ui_apply_style_with_mask(box->targetStyle, rule->style, rule->mask); + oc_ui_apply_style_with_mask(box->targetStyle, rule->style, rule->mask); } else { //NOTE create derived rule if there's more than one selector - ui_style_rule* derived = mem_arena_alloc_type(&ui->frameArena, ui_style_rule); + oc_ui_style_rule* derived = oc_arena_push_type(&ui->frameArena, oc_ui_style_rule); derived->mask = rule->mask; derived->style = rule->style; - derived->pattern.l = (list_info){&selector->listElt, rule->pattern.l.last}; + derived->pattern.l = (oc_list){&selector->listElt, rule->pattern.l.last}; - list_append(buildList, &derived->buildElt); - list_append(tmpList, &derived->tmpElt); + oc_list_append(buildList, &derived->buildElt); + oc_list_append(tmpList, &derived->tmpElt); } } } -void ui_styling_prepass(ui_context* ui, ui_box* box, list_info* before, list_info* after) +void oc_ui_styling_prepass(oc_ui_context* ui, oc_ui_box* box, oc_list* before, oc_list* after) { //NOTE: inherit style from parent if(box->parent) { - ui_apply_style_with_mask(box->targetStyle, + oc_ui_apply_style_with_mask(box->targetStyle, box->parent->targetStyle, - UI_STYLE_MASK_INHERITED); + OC_UI_STYLE_MASK_INHERITED); } //NOTE: append box before rules to before and tmp - list_info tmpBefore = {0}; - for_list(&box->beforeRules, rule, ui_style_rule, boxElt) + oc_list tmpBefore = {0}; + oc_list_for(&box->beforeRules, rule, oc_ui_style_rule, boxElt) { - list_append(before, &rule->buildElt); - list_append(&tmpBefore, &rule->tmpElt); + oc_list_append(before, &rule->buildElt); + oc_list_append(&tmpBefore, &rule->tmpElt); } //NOTE: match before rules - for_list(before, rule, ui_style_rule, buildElt) + oc_list_for(before, rule, oc_ui_style_rule, buildElt) { - ui_style_rule_match(ui, box, rule, before, &tmpBefore); + oc_ui_style_rule_match(ui, box, rule, before, &tmpBefore); } //NOTE: prepend box after rules to after and append them to tmp - list_info tmpAfter = {0}; - for_list_reverse(&box->afterRules, rule, ui_style_rule, boxElt) + oc_list tmpAfter = {0}; + oc_list_for_reverse(&box->afterRules, rule, oc_ui_style_rule, boxElt) { - list_push(after, &rule->buildElt); - list_append(&tmpAfter, &rule->tmpElt); + oc_list_push(after, &rule->buildElt); + oc_list_append(&tmpAfter, &rule->tmpElt); } //NOTE: match after rules - for_list(after, rule, ui_style_rule, buildElt) + oc_list_for(after, rule, oc_ui_style_rule, buildElt) { - ui_style_rule_match(ui, box, rule, after, &tmpAfter); + oc_ui_style_rule_match(ui, box, rule, after, &tmpAfter); } //NOTE: compute static sizes - ui_box_animate_style(ui, box); + oc_ui_box_animate_style(ui, box); - if(ui_box_hidden(box)) + if(oc_ui_box_hidden(box)) { return; } - ui_style* style = &box->style; + oc_ui_style* style = &box->style; - mp_rect textBox = {0}; - ui_size desiredSize[2] = {box->style.size.c[UI_AXIS_X], - box->style.size.c[UI_AXIS_Y]}; + oc_rect textBox = {0}; + oc_ui_size desiredSize[2] = {box->style.size.c[OC_UI_AXIS_X], + box->style.size.c[OC_UI_AXIS_Y]}; - if( desiredSize[UI_AXIS_X].kind == UI_SIZE_TEXT - ||desiredSize[UI_AXIS_Y].kind == UI_SIZE_TEXT) + if( desiredSize[OC_UI_AXIS_X].kind == OC_UI_SIZE_TEXT + ||desiredSize[OC_UI_AXIS_Y].kind == OC_UI_SIZE_TEXT) { - textBox = mg_text_bounding_box(style->font, style->fontSize, box->string); + textBox = oc_text_bounding_box(style->font, style->fontSize, box->string); } - for(int i=0; ilayout.margin.c[i]; box->rect.c[2+i] = textBox.c[2+i] + margin*2; } - else if(size.kind == UI_SIZE_PIXELS) + else if(size.kind == OC_UI_SIZE_PIXELS) { box->rect.c[2+i] = size.value; } } //NOTE: descend in children - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - ui_styling_prepass(ui, child, before, after); + oc_ui_styling_prepass(ui, child, before, after); } //NOTE: remove temporary rules - for_list(&tmpBefore, rule, ui_style_rule, tmpElt) + oc_list_for(&tmpBefore, rule, oc_ui_style_rule, tmpElt) { - list_remove(before, &rule->buildElt); + oc_list_remove(before, &rule->buildElt); } - for_list(&tmpAfter, rule, ui_style_rule, tmpElt) + oc_list_for(&tmpAfter, rule, oc_ui_style_rule, tmpElt) { - list_remove(after, &rule->buildElt); + oc_list_remove(after, &rule->buildElt); } } -bool ui_layout_downward_dependency(ui_box* child, int axis) +bool oc_ui_layout_downward_dependency(oc_ui_box* child, int axis) { - return( !ui_box_hidden(child) + return( !oc_ui_box_hidden(child) && !child->style.floating.c[axis] - && child->style.size.c[axis].kind != UI_SIZE_PARENT - && child->style.size.c[axis].kind != UI_SIZE_PARENT_MINUS_PIXELS); + && child->style.size.c[axis].kind != OC_UI_SIZE_PARENT + && child->style.size.c[axis].kind != OC_UI_SIZE_PARENT_MINUS_PIXELS); } -void ui_layout_downward_dependent_size(ui_context* ui, ui_box* box, int axis) +void oc_ui_layout_downward_dependent_size(oc_ui_context* ui, oc_ui_box* box, int axis) { //NOTE: layout children and compute spacing f32 count = 0; - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - if(!ui_box_hidden(child)) + if(!oc_ui_box_hidden(child)) { - ui_layout_downward_dependent_size(ui, child, axis); + oc_ui_layout_downward_dependent_size(ui, child, axis); if( box->style.layout.axis == axis && !child->style.floating.c[axis]) @@ -1011,10 +1011,10 @@ void ui_layout_downward_dependent_size(ui_context* ui, ui_box* box, int axis) } } } - box->spacing[axis] = maximum(0, count-1)*box->style.layout.spacing; + box->spacing[axis] = oc_max(0, count-1)*box->style.layout.spacing; - ui_size* size = &box->style.size.c[axis]; - if(size->kind == UI_SIZE_CHILDREN) + oc_ui_size* size = &box->style.size.c[axis]; + if(size->kind == OC_UI_SIZE_CHILDREN) { //NOTE: if box is dependent on children, compute children's size. If we're in the layout // axis this is the sum of each child size, otherwise it is the maximum child size @@ -1022,9 +1022,9 @@ void ui_layout_downward_dependent_size(ui_context* ui, ui_box* box, int axis) if(box->style.layout.axis == axis) { - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - if(ui_layout_downward_dependency(child, axis)) + if(oc_ui_layout_downward_dependency(child, axis)) { sum += child->rect.c[2+axis]; } @@ -1032,11 +1032,11 @@ void ui_layout_downward_dependent_size(ui_context* ui, ui_box* box, int axis) } else { - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - if(ui_layout_downward_dependency(child, axis)) + if(oc_ui_layout_downward_dependency(child, axis)) { - sum = maximum(sum, child->rect.c[2+axis]); + sum = oc_max(sum, child->rect.c[2+axis]); } } } @@ -1045,28 +1045,28 @@ void ui_layout_downward_dependent_size(ui_context* ui, ui_box* box, int axis) } } -void ui_layout_upward_dependent_size(ui_context* ui, ui_box* box, int axis) +void oc_ui_layout_upward_dependent_size(oc_ui_context* ui, oc_ui_box* box, int axis) { //NOTE: re-compute/set size of children that depend on box's size f32 margin = box->style.layout.margin.c[axis]; - f32 availableSize = maximum(0, box->rect.c[2+axis] - box->spacing[axis] - 2*margin); + f32 availableSize = oc_max(0, box->rect.c[2+axis] - box->spacing[axis] - 2*margin); - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - ui_size* size = &child->style.size.c[axis]; - if(size->kind == UI_SIZE_PARENT) + oc_ui_size* size = &child->style.size.c[axis]; + if(size->kind == OC_UI_SIZE_PARENT) { child->rect.c[2+axis] = availableSize * size->value; } - else if(size->kind == UI_SIZE_PARENT_MINUS_PIXELS) + else if(size->kind == OC_UI_SIZE_PARENT_MINUS_PIXELS) { - child->rect.c[2+axis] = maximum(0, availableSize - size->value); + child->rect.c[2+axis] = oc_max(0, availableSize - size->value); } } //NOTE: solve downard conflicts - int overflowFlag = (UI_FLAG_ALLOW_OVERFLOW_X << axis); + int overflowFlag = (OC_UI_FLAG_ALLOW_OVERFLOW_X << axis); f32 sum = 0; if(box->style.layout.axis == axis) @@ -1075,9 +1075,9 @@ void ui_layout_upward_dependent_size(ui_context* ui, ui_box* box, int axis) // total slack available f32 slack = 0; - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - if( !ui_box_hidden(child) + if( !oc_ui_box_hidden(child) && !child->style.floating.c[axis]) { sum += child->rect.c[2+axis]; @@ -1089,11 +1089,11 @@ void ui_layout_upward_dependent_size(ui_context* ui, ui_box* box, int axis) { //NOTE: then remove excess proportionally to each box slack, and recompute children sum. f32 totalContents = sum + box->spacing[axis] + 2*box->style.layout.margin.c[axis]; - f32 excess = ClampLowBound(totalContents - box->rect.c[2+axis], 0); - f32 alpha = Clamp(excess / slack, 0, 1); + f32 excess = oc_clamp_low(totalContents - box->rect.c[2+axis], 0); + f32 alpha = oc_clamp(excess / slack, 0, 1); sum = 0; - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { f32 relax = child->style.size.c[axis].relax; child->rect.c[2+axis] -= alpha * child->rect.c[2+axis] * relax; @@ -1106,18 +1106,18 @@ void ui_layout_upward_dependent_size(ui_context* ui, ui_box* box, int axis) //NOTE: if we're solving on the secondary axis, we remove excess to each box individually // according to its own slack. Children sum is the maximum child size. - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - if(!ui_box_hidden(child) && !child->style.floating.c[axis]) + if(!oc_ui_box_hidden(child) && !child->style.floating.c[axis]) { if(!(box->flags & overflowFlag)) { f32 totalContents = child->rect.c[2+axis] + 2*box->style.layout.margin.c[axis]; - f32 excess = ClampLowBound(totalContents - box->rect.c[2+axis], 0); + f32 excess = oc_clamp_low(totalContents - box->rect.c[2+axis], 0); f32 relax = child->style.size.c[axis].relax; - child->rect.c[2+axis] -= minimum(excess, child->rect.c[2+axis]*relax); + child->rect.c[2+axis] -= oc_min(excess, child->rect.c[2+axis]*relax); } - sum = maximum(sum, child->rect.c[2+axis]); + sum = oc_max(sum, child->rect.c[2+axis]); } } } @@ -1125,15 +1125,15 @@ void ui_layout_upward_dependent_size(ui_context* ui, ui_box* box, int axis) box->childrenSum[axis] = sum; //NOTE: recurse in children - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - ui_layout_upward_dependent_size(ui, child, axis); + oc_ui_layout_upward_dependent_size(ui, child, axis); } } -void ui_layout_compute_rect(ui_context* ui, ui_box* box, vec2 pos) +void oc_ui_layout_compute_rect(oc_ui_context* ui, oc_ui_box* box, oc_vec2 pos) { - if(ui_box_hidden(box)) + if(oc_ui_box_hidden(box)) { return; } @@ -1143,30 +1143,30 @@ void ui_layout_compute_rect(ui_context* ui, ui_box* box, vec2 pos) box->z = ui->z; ui->z++; - ui_axis layoutAxis = box->style.layout.axis; - ui_axis secondAxis = (layoutAxis == UI_AXIS_X) ? UI_AXIS_Y : UI_AXIS_X; + oc_ui_axis layoutAxis = box->style.layout.axis; + oc_ui_axis secondAxis = (layoutAxis == OC_UI_AXIS_X) ? OC_UI_AXIS_Y : OC_UI_AXIS_X; f32 spacing = box->style.layout.spacing; - ui_align* align = box->style.layout.align.c; + oc_ui_align* align = box->style.layout.align.c; - vec2 origin = {box->rect.x, + oc_vec2 origin = {box->rect.x, box->rect.y}; - vec2 currentPos = origin; + oc_vec2 currentPos = origin; - vec2 margin = {box->style.layout.margin.x, + oc_vec2 margin = {box->style.layout.margin.x, box->style.layout.margin.y}; currentPos.x += margin.x; currentPos.y += margin.y; - for(int i=0; irect.c[2+i] - (box->childrenSum[i] + box->spacing[i] + margin.c[i]); } } - if(align[layoutAxis] == UI_ALIGN_CENTER) + if(align[layoutAxis] == OC_UI_ALIGN_CENTER) { currentPos.c[layoutAxis] = origin.c[layoutAxis] + 0.5*(box->rect.c[2+layoutAxis] @@ -1176,23 +1176,23 @@ void ui_layout_compute_rect(ui_context* ui, ui_box* box, vec2 pos) currentPos.x -= box->scroll.x; currentPos.y -= box->scroll.y; - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - if(align[secondAxis] == UI_ALIGN_CENTER) + if(align[secondAxis] == OC_UI_ALIGN_CENTER) { currentPos.c[secondAxis] = origin.c[secondAxis] + 0.5*(box->rect.c[2+secondAxis] - child->rect.c[2+secondAxis]); } - vec2 childPos = currentPos; - for(int i=0; istyle.floating.c[i]) { - ui_style* style = child->targetStyle; - if((child->targetStyle->animationMask & (UI_STYLE_FLOAT_X << i)) + oc_ui_style* style = child->targetStyle; + if((child->targetStyle->animationMask & (OC_UI_STYLE_FLOAT_X << i)) && !child->fresh) { - ui_animate_f32(ui, &child->floatPos.c[i], child->style.floatTarget.c[i], style->animationTime); + oc_ui_animate_f32(ui, &child->floatPos.c[i], child->style.floatTarget.c[i], style->animationTime); } else { @@ -1202,7 +1202,7 @@ void ui_layout_compute_rect(ui_context* ui, ui_box* box, vec2 pos) } } - ui_layout_compute_rect(ui, child, childPos); + oc_ui_layout_compute_rect(ui, child, childPos); if(!child->style.floating.c[layoutAxis]) { @@ -1211,300 +1211,300 @@ void ui_layout_compute_rect(ui_context* ui, ui_box* box, vec2 pos) } } -void ui_layout_find_next_hovered_recursive(ui_context* ui, ui_box* box, vec2 p) +void oc_ui_layout_find_next_hovered_recursive(oc_ui_context* ui, oc_ui_box* box, oc_vec2 p) { - if(ui_box_hidden(box)) + if(oc_ui_box_hidden(box)) { return; } - bool hit = ui_rect_hit(box->rect, p); - if(hit && (box->flags & UI_FLAG_BLOCK_MOUSE)) + bool hit = oc_ui_rect_hit(box->rect, p); + if(hit && (box->flags & OC_UI_FLAG_BLOCK_MOUSE)) { ui->hovered = box; } - if(hit || !(box->flags & UI_FLAG_CLIP)) + if(hit || !(box->flags & OC_UI_FLAG_CLIP)) { - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - ui_layout_find_next_hovered_recursive(ui, child, p); + oc_ui_layout_find_next_hovered_recursive(ui, child, p); } } } -void ui_layout_find_next_hovered(ui_context* ui, vec2 p) +void oc_ui_layout_find_next_hovered(oc_ui_context* ui, oc_vec2 p) { ui->hovered = 0; - ui_layout_find_next_hovered_recursive(ui, ui->root, p); + oc_ui_layout_find_next_hovered_recursive(ui, ui->root, p); } -void ui_solve_layout(ui_context* ui) +void oc_ui_solve_layout(oc_ui_context* ui) { - list_info beforeRules = {0}; - list_info afterRules = {0}; + oc_list beforeRules = {0}; + oc_list afterRules = {0}; //NOTE: style and compute static sizes - ui_styling_prepass(ui, ui->root, &beforeRules, &afterRules); + oc_ui_styling_prepass(ui, ui->root, &beforeRules, &afterRules); //NOTE: reparent overlay boxes - for_list(&ui->overlayList, box, ui_box, overlayElt) + oc_list_for(&ui->overlayList, box, oc_ui_box, overlayElt) { if(box->parent) { - list_remove(&box->parent->children, &box->listElt); - list_append(&ui->overlay->children, &box->listElt); + oc_list_remove(&box->parent->children, &box->listElt); + oc_list_append(&ui->overlay->children, &box->listElt); } } //NOTE: compute layout - for(int axis=0; axisroot, axis); - ui_layout_upward_dependent_size(ui, ui->root, axis); + oc_ui_layout_downward_dependent_size(ui, ui->root, axis); + oc_ui_layout_upward_dependent_size(ui, ui->root, axis); } - ui_layout_compute_rect(ui, ui->root, (vec2){0, 0}); + oc_ui_layout_compute_rect(ui, ui->root, (oc_vec2){0, 0}); - vec2 p = ui_mouse_position(); - ui_layout_find_next_hovered(ui, p); + oc_vec2 p = oc_ui_mouse_position(); + oc_ui_layout_find_next_hovered(ui, p); } //----------------------------------------------------------------------------- // Drawing //----------------------------------------------------------------------------- -void ui_rectangle_fill(mp_rect rect, f32 roundness) +void oc_ui_rectangle_fill(oc_rect rect, f32 roundness) { if(roundness) { - mg_rounded_rectangle_fill(rect.x, rect.y, rect.w, rect.h, roundness); + oc_rounded_rectangle_fill(rect.x, rect.y, rect.w, rect.h, roundness); } else { - mg_rectangle_fill(rect.x, rect.y, rect.w, rect.h); + oc_rectangle_fill(rect.x, rect.y, rect.w, rect.h); } } -void ui_rectangle_stroke(mp_rect rect, f32 roundness) +void oc_ui_rectangle_stroke(oc_rect rect, f32 roundness) { if(roundness) { - mg_rounded_rectangle_stroke(rect.x, rect.y, rect.w, rect.h, roundness); + oc_rounded_rectangle_stroke(rect.x, rect.y, rect.w, rect.h, roundness); } else { - mg_rectangle_stroke(rect.x, rect.y, rect.w, rect.h); + oc_rectangle_stroke(rect.x, rect.y, rect.w, rect.h); } } -void ui_draw_box(ui_box* box) +void oc_ui_draw_box(oc_ui_box* box) { - if(ui_box_hidden(box)) + if(oc_ui_box_hidden(box)) { return; } - ui_style* style = &box->style; + oc_ui_style* style = &box->style; - if(box->flags & UI_FLAG_CLIP) + if(box->flags & OC_UI_FLAG_CLIP) { - mg_clip_push(box->rect.x, box->rect.y, box->rect.w, box->rect.h); + oc_clip_push(box->rect.x, box->rect.y, box->rect.w, box->rect.h); } - if(box->flags & UI_FLAG_DRAW_BACKGROUND) + if(box->flags & OC_UI_FLAG_DRAW_BACKGROUND) { - mg_set_color(style->bgColor); - ui_rectangle_fill(box->rect, style->roundness); + oc_set_color(style->bgColor); + oc_ui_rectangle_fill(box->rect, style->roundness); } - if((box->flags & UI_FLAG_DRAW_PROC) && box->drawProc) + if((box->flags & OC_UI_FLAG_DRAW_PROC) && box->drawProc) { box->drawProc(box, box->drawData); } - for_list(&box->children, child, ui_box, listElt) + oc_list_for(&box->children, child, oc_ui_box, listElt) { - ui_draw_box(child); + oc_ui_draw_box(child); } - if(box->flags & UI_FLAG_DRAW_TEXT) + if(box->flags & OC_UI_FLAG_DRAW_TEXT) { - mp_rect textBox = mg_text_bounding_box(style->font, style->fontSize, box->string); + oc_rect textBox = oc_text_bounding_box(style->font, style->fontSize, box->string); f32 x = 0; f32 y = 0; switch(style->layout.align.x) { - case UI_ALIGN_START: + case OC_UI_ALIGN_START: x = box->rect.x + style->layout.margin.x; break; - case UI_ALIGN_END: + case OC_UI_ALIGN_END: x = box->rect.x + box->rect.w - style->layout.margin.x - textBox.w; break; - case UI_ALIGN_CENTER: + case OC_UI_ALIGN_CENTER: x = box->rect.x + 0.5*(box->rect.w - textBox.w); break; } switch(style->layout.align.y) { - case UI_ALIGN_START: + case OC_UI_ALIGN_START: y = box->rect.y + style->layout.margin.y - textBox.y; break; - case UI_ALIGN_END: + case OC_UI_ALIGN_END: y = box->rect.y + box->rect.h - style->layout.margin.y - textBox.h + textBox.y; break; - case UI_ALIGN_CENTER: + case OC_UI_ALIGN_CENTER: y = box->rect.y + 0.5*(box->rect.h - textBox.h) - textBox.y; break; } - mg_set_font(style->font); - mg_set_font_size(style->fontSize); - mg_set_color(style->color); + oc_set_font(style->font); + oc_set_font_size(style->fontSize); + oc_set_color(style->color); - mg_move_to(x, y); - mg_text_outlines(box->string); - mg_fill(); + oc_move_to(x, y); + oc_text_outlines(box->string); + oc_fill(); } - if(box->flags & UI_FLAG_CLIP) + if(box->flags & OC_UI_FLAG_CLIP) { - mg_clip_pop(); + oc_clip_pop(); } - if(box->flags & UI_FLAG_DRAW_BORDER) + if(box->flags & OC_UI_FLAG_DRAW_BORDER) { - mg_set_width(style->borderSize); - mg_set_color(style->borderColor); - ui_rectangle_stroke(box->rect, style->roundness); + oc_set_width(style->borderSize); + oc_set_color(style->borderColor); + oc_ui_rectangle_stroke(box->rect, style->roundness); } } -void ui_draw() +void oc_ui_draw() { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); //NOTE: draw - bool oldTextFlip = mg_get_text_flip(); - mg_set_text_flip(false); + bool oldTextFlip = oc_get_text_flip(); + oc_set_text_flip(false); - ui_draw_box(ui->root); + oc_ui_draw_box(ui->root); - mg_set_text_flip(oldTextFlip); + oc_set_text_flip(oldTextFlip); } //----------------------------------------------------------------------------- // frame begin/end //----------------------------------------------------------------------------- -void ui_begin_frame(vec2 size, ui_style* defaultStyle, ui_style_mask defaultMask) +void oc_ui_begin_frame(oc_vec2 size, oc_ui_style* defaultStyle, oc_ui_style_mask defaultMask) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - mem_arena_clear(&ui->frameArena); + oc_arena_clear(&ui->frameArena); ui->frameCounter++; - f64 time = mp_get_time(MP_CLOCK_MONOTONIC); + f64 time = oc_clock_time(OC_CLOCK_MONOTONIC); ui->lastFrameDuration = time - ui->frameTime; ui->frameTime = time; ui->clipStack = 0; ui->z = 0; - defaultMask &= UI_STYLE_COLOR - | UI_STYLE_BG_COLOR - | UI_STYLE_BORDER_COLOR - | UI_STYLE_FONT - | UI_STYLE_FONT_SIZE; + defaultMask &= OC_UI_STYLE_COLOR + | OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_BORDER_COLOR + | OC_UI_STYLE_FONT + | OC_UI_STYLE_FONT_SIZE; - ui_style_match_before(ui_pattern_all(), defaultStyle, defaultMask); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, size.x}, - .size.height = {UI_SIZE_PIXELS, size.y}}, - UI_STYLE_SIZE); + oc_ui_style_match_before(oc_ui_pattern_all(), defaultStyle, defaultMask); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, size.x}, + .size.height = {OC_UI_SIZE_PIXELS, size.y}}, + OC_UI_STYLE_SIZE); - ui->root = ui_box_begin("_root_", 0); + ui->root = oc_ui_box_begin("_root_", 0); - ui_style_mask contentStyleMask = UI_STYLE_SIZE - | UI_STYLE_LAYOUT - | UI_STYLE_FLOAT; + oc_ui_style_mask contentStyleMask = OC_UI_STYLE_SIZE + | OC_UI_STYLE_LAYOUT + | OC_UI_STYLE_FLOAT; - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 1}, - .layout = {UI_AXIS_Y, UI_ALIGN_START, UI_ALIGN_START}, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 1}, + .layout = {OC_UI_AXIS_Y, OC_UI_ALIGN_START, OC_UI_ALIGN_START}, .floating = {true, true}, .floatTarget = {0, 0}}, contentStyleMask); - ui_box* contents = ui_box_make("_contents_", 0); + oc_ui_box* contents = oc_ui_box_make("_contents_", 0); - ui_style_next(&(ui_style){.layout = {UI_AXIS_Y, UI_ALIGN_START, UI_ALIGN_START}, + oc_ui_style_next(&(oc_ui_style){.layout = {OC_UI_AXIS_Y, OC_UI_ALIGN_START, OC_UI_ALIGN_START}, .floating = {true, true}, .floatTarget = {0, 0}}, - UI_STYLE_LAYOUT | UI_STYLE_FLOAT_X | UI_STYLE_FLOAT_Y); + OC_UI_STYLE_LAYOUT | OC_UI_STYLE_FLOAT_X | OC_UI_STYLE_FLOAT_Y); - ui->overlay = ui_box_make("_overlay_", 0); - ui->overlayList = (list_info){0}; + ui->overlay = oc_ui_box_make("_overlay_", 0); + ui->overlayList = (oc_list){0}; - ui->nextBoxBeforeRules = (list_info){0}; - ui->nextBoxAfterRules = (list_info){0}; - ui->nextBoxTags = (list_info){0}; + ui->nextBoxBeforeRules = (oc_list){0}; + ui->nextBoxAfterRules = (oc_list){0}; + ui->nextBoxTags = (oc_list){0}; - ui_box_push(contents); + oc_ui_box_push(contents); } -void ui_end_frame(void) +void oc_ui_end_frame(void) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_box_pop(); + oc_ui_box_pop(); - ui_box* box = ui_box_end(); - DEBUG_ASSERT(box == ui->root, "unbalanced box stack"); + oc_ui_box* box = oc_ui_box_end(); + OC_DEBUG_ASSERT(box == ui->root, "unbalanced box stack"); //TODO: check balancing of style stacks //NOTE: layout - ui_solve_layout(ui); + oc_ui_solve_layout(ui); //NOTE: prune unused boxes - for(int i=0; iboxMap[i], box, ui_box, bucketElt) + oc_list_for_safe(&ui->boxMap[i], box, oc_ui_box, bucketElt) { if(box->frameCounter < ui->frameCounter) { - list_remove(&ui->boxMap[i], &box->bucketElt); + oc_list_remove(&ui->boxMap[i], &box->bucketElt); } } } - mp_input_next_frame(&ui->input); + oc_input_next_frame(&ui->input); } //----------------------------------------------------------------------------- // Init / cleanup //----------------------------------------------------------------------------- -void ui_init(ui_context* ui) +void oc_ui_init(oc_ui_context* ui) { - __uiCurrentContext = &__uiThreadContext; + oc_uiCurrentContext = &oc_uiThreadContext; - memset(ui, 0, sizeof(ui_context)); - mem_arena_init(&ui->frameArena); - mem_pool_init(&ui->boxPool, sizeof(ui_box)); + memset(ui, 0, sizeof(oc_ui_context)); + oc_arena_init(&ui->frameArena); + oc_pool_init(&ui->boxPool, sizeof(oc_ui_box)); ui->init = true; - ui_set_context(ui); + oc_ui_set_context(ui); } -void ui_cleanup(void) +void oc_ui_cleanup(void) { - ui_context* ui = ui_get_context(); - mem_arena_release(&ui->frameArena); - mem_pool_release(&ui->boxPool); + oc_ui_context* ui = oc_ui_get_context(); + oc_arena_cleanup(&ui->frameArena); + oc_pool_cleanup(&ui->boxPool); ui->init = false; } @@ -1513,60 +1513,60 @@ void ui_cleanup(void) // label //----------------------------------------------------------------------------- -ui_sig ui_label_str8(str8 label) +oc_ui_sig oc_ui_label_str8(oc_str8 label) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_TEXT, 0, 0}, - .size.height = {UI_SIZE_TEXT, 0, 0}}, - UI_STYLE_SIZE_WIDTH | UI_STYLE_SIZE_HEIGHT); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_TEXT, 0, 0}, + .size.height = {OC_UI_SIZE_TEXT, 0, 0}}, + OC_UI_STYLE_SIZE_WIDTH | OC_UI_STYLE_SIZE_HEIGHT); - ui_flags flags = UI_FLAG_CLIP - | UI_FLAG_DRAW_TEXT; - ui_box* box = ui_box_make_str8(label, flags); + oc_ui_flags flags = OC_UI_FLAG_CLIP + | OC_UI_FLAG_DRAW_TEXT; + oc_ui_box* box = oc_ui_box_make_str8(label, flags); - ui_sig sig = ui_box_sig(box); + oc_ui_sig sig = oc_ui_box_sig(box); return(sig); } -ui_sig ui_label(const char* label) +oc_ui_sig oc_ui_label(const char* label) { - return(ui_label_str8(STR8((char*)label))); + return(oc_ui_label_str8(OC_STR8((char*)label))); } //------------------------------------------------------------------------------ // button //------------------------------------------------------------------------------ -ui_sig ui_button_behavior(ui_box* box) +oc_ui_sig oc_ui_button_behavior(oc_ui_box* box) { - ui_sig sig = ui_box_sig(box); + oc_ui_sig sig = oc_ui_box_sig(box); if(sig.hovering) { - ui_box_set_hot(box, true); + oc_ui_box_set_hot(box, true); if(sig.dragging) { - ui_box_activate(box); + oc_ui_box_activate(box); } } else { - ui_box_set_hot(box, false); + oc_ui_box_set_hot(box, false); } if(!sig.dragging) { - ui_box_deactivate(box); + oc_ui_box_deactivate(box); } return(sig); } -ui_sig ui_button_str8(str8 label) +oc_ui_sig oc_ui_button_str8(oc_str8 label) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_style defaultStyle = {.size.width = {UI_SIZE_TEXT}, - .size.height = {UI_SIZE_TEXT}, - .layout.align.x = UI_ALIGN_CENTER, - .layout.align.y = UI_ALIGN_CENTER, + oc_ui_style defaultStyle = {.size.width = {OC_UI_SIZE_TEXT}, + .size.height = {OC_UI_SIZE_TEXT}, + .layout.align.x = OC_UI_ALIGN_CENTER, + .layout.align.y = OC_UI_ALIGN_CENTER, .layout.margin.x = 5, .layout.margin.y = 5, .bgColor = {0.5, 0.5, 0.5, 1}, @@ -1574,121 +1574,121 @@ ui_sig ui_button_str8(str8 label) .borderSize = 1, .roundness = 10}; - ui_style_mask defaultMask = UI_STYLE_SIZE_WIDTH - | UI_STYLE_SIZE_HEIGHT - | UI_STYLE_LAYOUT_MARGIN_X - | UI_STYLE_LAYOUT_MARGIN_Y - | UI_STYLE_LAYOUT_ALIGN_X - | UI_STYLE_LAYOUT_ALIGN_Y - | UI_STYLE_BG_COLOR - | UI_STYLE_BORDER_COLOR - | UI_STYLE_BORDER_SIZE - | UI_STYLE_ROUNDNESS; + oc_ui_style_mask defaultMask = OC_UI_STYLE_SIZE_WIDTH + | OC_UI_STYLE_SIZE_HEIGHT + | OC_UI_STYLE_LAYOUT_MARGIN_X + | OC_UI_STYLE_LAYOUT_MARGIN_Y + | OC_UI_STYLE_LAYOUT_ALIGN_X + | OC_UI_STYLE_LAYOUT_ALIGN_Y + | OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_BORDER_COLOR + | OC_UI_STYLE_BORDER_SIZE + | OC_UI_STYLE_ROUNDNESS; - ui_style_next(&defaultStyle, defaultMask); + oc_ui_style_next(&defaultStyle, defaultMask); - ui_style activeStyle = {.bgColor = {0.3, 0.3, 0.3, 1}, + oc_ui_style activeStyle = {.bgColor = {0.3, 0.3, 0.3, 1}, .borderColor = {0.2, 0.2, 0.2, 1}, .borderSize = 2}; - ui_style_mask activeMask = UI_STYLE_BG_COLOR - | UI_STYLE_BORDER_COLOR - | UI_STYLE_BORDER_SIZE; - ui_pattern activePattern = {0}; - ui_pattern_push(&ui->frameArena, + oc_ui_style_mask activeMask = OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_BORDER_COLOR + | OC_UI_STYLE_BORDER_SIZE; + oc_ui_pattern activePattern = {0}; + oc_ui_pattern_push(&ui->frameArena, &activePattern, - (ui_selector){.kind = UI_SEL_STATUS, - .status = UI_ACTIVE|UI_HOVER}); - ui_style_match_before(activePattern, &activeStyle, activeMask); + (oc_ui_selector){.kind = OC_UI_SEL_STATUS, + .status = OC_UI_ACTIVE|OC_UI_HOVER}); + oc_ui_style_match_before(activePattern, &activeStyle, activeMask); - ui_flags flags = UI_FLAG_CLICKABLE - | UI_FLAG_CLIP - | UI_FLAG_DRAW_BACKGROUND - | UI_FLAG_DRAW_BORDER - | UI_FLAG_DRAW_TEXT - | UI_FLAG_HOT_ANIMATION - | UI_FLAG_ACTIVE_ANIMATION; + oc_ui_flags flags = OC_UI_FLAG_CLICKABLE + | OC_UI_FLAG_CLIP + | OC_UI_FLAG_DRAW_BACKGROUND + | OC_UI_FLAG_DRAW_BORDER + | OC_UI_FLAG_DRAW_TEXT + | OC_UI_FLAG_HOT_ANIMATION + | OC_UI_FLAG_ACTIVE_ANIMATION; - ui_box* box = ui_box_make_str8(label, flags); - ui_tag_box(box, "button"); + oc_ui_box* box = oc_ui_box_make_str8(label, flags); + oc_ui_tag_box(box, "button"); - ui_sig sig = ui_button_behavior(box); + oc_ui_sig sig = oc_ui_button_behavior(box); return(sig); } -ui_sig ui_button(const char* label) +oc_ui_sig oc_ui_button(const char* label) { - return(ui_button_str8(STR8((char*)label))); + return(oc_ui_button_str8(OC_STR8((char*)label))); } -void ui_checkbox_draw(ui_box* box, void* data) +void oc_ui_checkbox_draw(oc_ui_box* box, void* data) { bool checked = *(bool*)data; if(checked) { - mg_move_to(box->rect.x + 0.2*box->rect.w, box->rect.y + 0.5*box->rect.h); - mg_line_to(box->rect.x + 0.4*box->rect.w, box->rect.y + 0.75*box->rect.h); - mg_line_to(box->rect.x + 0.8*box->rect.w, box->rect.y + 0.2*box->rect.h); + oc_move_to(box->rect.x + 0.2*box->rect.w, box->rect.y + 0.5*box->rect.h); + oc_line_to(box->rect.x + 0.4*box->rect.w, box->rect.y + 0.75*box->rect.h); + oc_line_to(box->rect.x + 0.8*box->rect.w, box->rect.y + 0.2*box->rect.h); - mg_set_color(box->style.color); - mg_set_width(0.2*box->rect.w); - mg_set_joint(MG_JOINT_MITER); - mg_set_max_joint_excursion(0.2 * box->rect.h); - mg_stroke(); + oc_set_color(box->style.color); + oc_set_width(0.2*box->rect.w); + oc_set_joint(OC_JOINT_MITER); + oc_set_max_joint_excursion(0.2 * box->rect.h); + oc_stroke(); } } -ui_sig ui_checkbox(const char* name, bool* checked) +oc_ui_sig oc_ui_checkbox(const char* name, bool* checked) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_style defaultStyle = {.size.width = {UI_SIZE_PIXELS, 20}, - .size.height = {UI_SIZE_PIXELS, 20}, + oc_ui_style defaultStyle = {.size.width = {OC_UI_SIZE_PIXELS, 20}, + .size.height = {OC_UI_SIZE_PIXELS, 20}, .bgColor = {1, 1, 1, 1}, .color = {0, 0, 0, 1}, .borderColor = {0.2, 0.2, 0.2, 1}, .borderSize = 1, .roundness = 5}; - ui_style_mask defaultMask = UI_STYLE_SIZE_WIDTH - | UI_STYLE_SIZE_HEIGHT - | UI_STYLE_BG_COLOR - | UI_STYLE_COLOR - | UI_STYLE_BORDER_COLOR - | UI_STYLE_BORDER_SIZE - | UI_STYLE_ROUNDNESS; + oc_ui_style_mask defaultMask = OC_UI_STYLE_SIZE_WIDTH + | OC_UI_STYLE_SIZE_HEIGHT + | OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_COLOR + | OC_UI_STYLE_BORDER_COLOR + | OC_UI_STYLE_BORDER_SIZE + | OC_UI_STYLE_ROUNDNESS; - ui_style_next(&defaultStyle, defaultMask); + oc_ui_style_next(&defaultStyle, defaultMask); - ui_style activeStyle = {.bgColor = {0.5, 0.5, 0.5, 1}, + oc_ui_style activeStyle = {.bgColor = {0.5, 0.5, 0.5, 1}, .borderColor = {0.2, 0.2, 0.2, 1}, .borderSize = 2}; - ui_style_mask activeMask = UI_STYLE_BG_COLOR - | UI_STYLE_BORDER_COLOR - | UI_STYLE_BORDER_SIZE; - ui_pattern activePattern = {0}; - ui_pattern_push(&ui->frameArena, + oc_ui_style_mask activeMask = OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_BORDER_COLOR + | OC_UI_STYLE_BORDER_SIZE; + oc_ui_pattern activePattern = {0}; + oc_ui_pattern_push(&ui->frameArena, &activePattern, - (ui_selector){.kind = UI_SEL_STATUS, - .status = UI_ACTIVE|UI_HOVER}); - ui_style_match_before(activePattern, &activeStyle, activeMask); + (oc_ui_selector){.kind = OC_UI_SEL_STATUS, + .status = OC_UI_ACTIVE|OC_UI_HOVER}); + oc_ui_style_match_before(activePattern, &activeStyle, activeMask); - ui_flags flags = UI_FLAG_CLICKABLE - | UI_FLAG_CLIP - | UI_FLAG_DRAW_BACKGROUND - | UI_FLAG_DRAW_PROC - | UI_FLAG_DRAW_BORDER - | UI_FLAG_HOT_ANIMATION - | UI_FLAG_ACTIVE_ANIMATION; + oc_ui_flags flags = OC_UI_FLAG_CLICKABLE + | OC_UI_FLAG_CLIP + | OC_UI_FLAG_DRAW_BACKGROUND + | OC_UI_FLAG_DRAW_PROC + | OC_UI_FLAG_DRAW_BORDER + | OC_UI_FLAG_HOT_ANIMATION + | OC_UI_FLAG_ACTIVE_ANIMATION; - ui_box* box = ui_box_make(name, flags); - ui_tag_box(box, "checkbox"); + oc_ui_box* box = oc_ui_box_make(name, flags); + oc_ui_tag_box(box, "checkbox"); - ui_sig sig = ui_button_behavior(box); + oc_ui_sig sig = oc_ui_button_behavior(box); if(sig.clicked) { *checked = !*checked; } - ui_box_set_draw_proc(box, ui_checkbox_draw, checked); + oc_ui_box_set_draw_proc(box, oc_ui_checkbox_draw, checked); return(sig); } @@ -1696,112 +1696,112 @@ ui_sig ui_checkbox(const char* name, bool* checked) //------------------------------------------------------------------------------ // slider / scrollbar //------------------------------------------------------------------------------ -ui_box* ui_slider(const char* label, f32 thumbRatio, f32* scrollValue) +oc_ui_box* oc_ui_slider(const char* label, f32 thumbRatio, f32* scrollValue) { - ui_style_match_before(ui_pattern_all(), &(ui_style){0}, UI_STYLE_LAYOUT); - ui_box* frame = ui_box_begin(label, 0); + oc_ui_style_match_before(oc_ui_pattern_all(), &(oc_ui_style){0}, OC_UI_STYLE_LAYOUT); + oc_ui_box* frame = oc_ui_box_begin(label, 0); { f32 beforeRatio = (*scrollValue) * (1. - thumbRatio); f32 afterRatio = (1. - *scrollValue) * (1. - thumbRatio); - ui_axis trackAxis = (frame->rect.w > frame->rect.h) ? UI_AXIS_X : UI_AXIS_Y; - ui_axis secondAxis = (trackAxis == UI_AXIS_Y) ? UI_AXIS_X : UI_AXIS_Y; + oc_ui_axis trackAxis = (frame->rect.w > frame->rect.h) ? OC_UI_AXIS_X : OC_UI_AXIS_Y; + oc_ui_axis secondAxis = (trackAxis == OC_UI_AXIS_Y) ? OC_UI_AXIS_X : OC_UI_AXIS_Y; f32 roundness = 0.5*frame->rect.c[2+secondAxis]; f32 animationTime = 0.5; - ui_style trackStyle = {.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_PARENT, 1}, + oc_ui_style trackStyle = {.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_PARENT, 1}, .layout.axis = trackAxis, - .layout.align.x = UI_ALIGN_START, - .layout.align.y = UI_ALIGN_START, + .layout.align.x = OC_UI_ALIGN_START, + .layout.align.y = OC_UI_ALIGN_START, .bgColor = {0.5, 0.5, 0.5, 1}, .roundness = roundness}; - ui_style beforeStyle = trackStyle; - beforeStyle.size.c[trackAxis] = (ui_size){UI_SIZE_PARENT, beforeRatio}; + oc_ui_style beforeStyle = trackStyle; + beforeStyle.size.c[trackAxis] = (oc_ui_size){OC_UI_SIZE_PARENT, beforeRatio}; - ui_style afterStyle = trackStyle; - afterStyle.size.c[trackAxis] = (ui_size){UI_SIZE_PARENT, afterRatio}; + oc_ui_style afterStyle = trackStyle; + afterStyle.size.c[trackAxis] = (oc_ui_size){OC_UI_SIZE_PARENT, afterRatio}; - ui_style thumbStyle = trackStyle; - thumbStyle.size.c[trackAxis] = (ui_size){UI_SIZE_PARENT, thumbRatio}; - thumbStyle.bgColor = (mg_color){0.3, 0.3, 0.3, 1}; + oc_ui_style thumbStyle = trackStyle; + thumbStyle.size.c[trackAxis] = (oc_ui_size){OC_UI_SIZE_PARENT, thumbRatio}; + thumbStyle.bgColor = (oc_color){0.3, 0.3, 0.3, 1}; - ui_style_mask styleMask = UI_STYLE_SIZE_WIDTH - | UI_STYLE_SIZE_HEIGHT - | UI_STYLE_LAYOUT - | UI_STYLE_BG_COLOR - | UI_STYLE_ROUNDNESS; + oc_ui_style_mask styleMask = OC_UI_STYLE_SIZE_WIDTH + | OC_UI_STYLE_SIZE_HEIGHT + | OC_UI_STYLE_LAYOUT + | OC_UI_STYLE_BG_COLOR + | OC_UI_STYLE_ROUNDNESS; - ui_flags trackFlags = UI_FLAG_CLIP - | UI_FLAG_DRAW_BACKGROUND - | UI_FLAG_HOT_ANIMATION - | UI_FLAG_ACTIVE_ANIMATION; + oc_ui_flags trackFlags = OC_UI_FLAG_CLIP + | OC_UI_FLAG_DRAW_BACKGROUND + | OC_UI_FLAG_HOT_ANIMATION + | OC_UI_FLAG_ACTIVE_ANIMATION; - ui_style_next(&trackStyle, styleMask); - ui_box* track = ui_box_begin("track", trackFlags); + oc_ui_style_next(&trackStyle, styleMask); + oc_ui_box* track = oc_ui_box_begin("track", trackFlags); - ui_style_next(&beforeStyle, UI_STYLE_SIZE_WIDTH|UI_STYLE_SIZE_HEIGHT); - ui_box* beforeSpacer = ui_box_make("before", 0); + oc_ui_style_next(&beforeStyle, OC_UI_STYLE_SIZE_WIDTH|OC_UI_STYLE_SIZE_HEIGHT); + oc_ui_box* beforeSpacer = oc_ui_box_make("before", 0); - ui_flags thumbFlags = UI_FLAG_CLICKABLE - | UI_FLAG_DRAW_BACKGROUND - | UI_FLAG_HOT_ANIMATION - | UI_FLAG_ACTIVE_ANIMATION; + oc_ui_flags thumbFlags = OC_UI_FLAG_CLICKABLE + | OC_UI_FLAG_DRAW_BACKGROUND + | OC_UI_FLAG_HOT_ANIMATION + | OC_UI_FLAG_ACTIVE_ANIMATION; - ui_style_next(&thumbStyle, styleMask); - ui_box* thumb = ui_box_make("thumb", thumbFlags); + oc_ui_style_next(&thumbStyle, styleMask); + oc_ui_box* thumb = oc_ui_box_make("thumb", thumbFlags); - ui_style_next(&afterStyle, UI_STYLE_SIZE_WIDTH|UI_STYLE_SIZE_HEIGHT); - ui_box* afterSpacer = ui_box_make("after", 0); + oc_ui_style_next(&afterStyle, OC_UI_STYLE_SIZE_WIDTH|OC_UI_STYLE_SIZE_HEIGHT); + oc_ui_box* afterSpacer = oc_ui_box_make("after", 0); - ui_box_end(); + oc_ui_box_end(); //NOTE: interaction - ui_sig thumbSig = ui_box_sig(thumb); - ui_sig trackSig = ui_box_sig(track); + oc_ui_sig thumbSig = oc_ui_box_sig(thumb); + oc_ui_sig trackSig = oc_ui_box_sig(track); if(thumbSig.dragging) { f32 trackExtents = track->rect.c[2+trackAxis] - thumb->rect.c[2+trackAxis]; *scrollValue = (trackSig.mouse.c[trackAxis] - thumb->pressedMouse.c[trackAxis]) / trackExtents; - *scrollValue = Clamp(*scrollValue, 0, 1); + *scrollValue = oc_clamp(*scrollValue, 0, 1); } - if(ui_box_active(frame)) + if(oc_ui_box_active(frame)) { //NOTE: activated from outside - ui_box_set_hot(track, true); - ui_box_set_hot(thumb, true); - ui_box_activate(track); - ui_box_activate(thumb); + oc_ui_box_set_hot(track, true); + oc_ui_box_set_hot(thumb, true); + oc_ui_box_activate(track); + oc_ui_box_activate(thumb); } if(trackSig.hovering) { - ui_box_set_hot(track, true); - ui_box_set_hot(thumb, true); + oc_ui_box_set_hot(track, true); + oc_ui_box_set_hot(thumb, true); } else if(thumbSig.wheel.c[trackAxis] == 0) { - ui_box_set_hot(track, false); - ui_box_set_hot(thumb, false); + oc_ui_box_set_hot(track, false); + oc_ui_box_set_hot(thumb, false); } if(thumbSig.dragging) { - ui_box_activate(track); - ui_box_activate(thumb); + oc_ui_box_activate(track); + oc_ui_box_activate(thumb); } else if(thumbSig.wheel.c[trackAxis] == 0) { - ui_box_deactivate(track); - ui_box_deactivate(thumb); - ui_box_deactivate(frame); + oc_ui_box_deactivate(track); + oc_ui_box_deactivate(thumb); + oc_ui_box_deactivate(frame); } - } ui_box_end(); + } oc_ui_box_end(); return(frame); } @@ -1809,32 +1809,32 @@ ui_box* ui_slider(const char* label, f32 thumbRatio, f32* scrollValue) //------------------------------------------------------------------------------ // panels //------------------------------------------------------------------------------ -void ui_panel_begin(const char* str, ui_flags flags) +void oc_ui_panel_begin(const char* str, oc_ui_flags flags) { flags = flags - | UI_FLAG_CLIP - | UI_FLAG_BLOCK_MOUSE - | UI_FLAG_ALLOW_OVERFLOW_X - | UI_FLAG_ALLOW_OVERFLOW_Y - | UI_FLAG_SCROLL_WHEEL_X - | UI_FLAG_SCROLL_WHEEL_Y; + | OC_UI_FLAG_CLIP + | OC_UI_FLAG_BLOCK_MOUSE + | OC_UI_FLAG_ALLOW_OVERFLOW_X + | OC_UI_FLAG_ALLOW_OVERFLOW_Y + | OC_UI_FLAG_SCROLL_WHEEL_X + | OC_UI_FLAG_SCROLL_WHEEL_Y; - ui_box_begin(str, flags); + oc_ui_box_begin(str, flags); } -void ui_panel_end(void) +void oc_ui_panel_end(void) { - ui_box* panel = ui_box_top(); - ui_sig sig = ui_box_sig(panel); + oc_ui_box* panel = oc_ui_box_top(); + oc_ui_sig sig = oc_ui_box_sig(panel); - f32 contentsW = ClampLowBound(panel->childrenSum[0], panel->rect.w); - f32 contentsH = ClampLowBound(panel->childrenSum[1], panel->rect.h); + f32 contentsW = oc_clamp_low(panel->childrenSum[0], panel->rect.w); + f32 contentsH = oc_clamp_low(panel->childrenSum[1], panel->rect.h); - contentsW = ClampLowBound(contentsW, 1); - contentsH = ClampLowBound(contentsH, 1); + contentsW = oc_clamp_low(contentsW, 1); + contentsH = oc_clamp_low(contentsH, 1); - ui_box* scrollBarX = 0; - ui_box* scrollBarY = 0; + oc_ui_box* scrollBarX = 0; + oc_ui_box* scrollBarY = 0; bool needsScrollX = contentsW > panel->rect.w; bool needsScrollY = contentsH > panel->rect.h; @@ -1844,20 +1844,20 @@ void ui_panel_end(void) f32 thumbRatioX = panel->rect.w / contentsW; f32 sliderX = panel->scroll.x /(contentsW - panel->rect.w); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1., 0}, - .size.height = {UI_SIZE_PIXELS, 10, 0}, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1., 0}, + .size.height = {OC_UI_SIZE_PIXELS, 10, 0}, .floating.x = true, .floating.y = true, .floatTarget = {0, panel->rect.h - 10}}, - UI_STYLE_SIZE - |UI_STYLE_FLOAT); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_FLOAT); - scrollBarX = ui_slider("scrollerX", thumbRatioX, &sliderX); + scrollBarX = oc_ui_slider("scrollerX", thumbRatioX, &sliderX); panel->scroll.x = sliderX * (contentsW - panel->rect.w); if(sig.hovering) { - ui_box_activate(scrollBarX); + oc_ui_box_activate(scrollBarX); } } @@ -1868,353 +1868,353 @@ void ui_panel_end(void) f32 spacerSize = needsScrollX ? 10 : 0; - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, 10, 0}, - .size.height = {UI_SIZE_PARENT_MINUS_PIXELS, spacerSize, 0}, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, 10, 0}, + .size.height = {OC_UI_SIZE_PARENT_MINUS_PIXELS, spacerSize, 0}, .floating.x = true, .floating.y = true, .floatTarget = {panel->rect.w - 10, 0}}, - UI_STYLE_SIZE - |UI_STYLE_FLOAT); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_FLOAT); - scrollBarY = ui_slider("scrollerY", thumbRatioY, &sliderY); + scrollBarY = oc_ui_slider("scrollerY", thumbRatioY, &sliderY); panel->scroll.y = sliderY * (contentsH - panel->rect.h); if(sig.hovering) { - ui_box_activate(scrollBarY); + oc_ui_box_activate(scrollBarY); } } - panel->scroll.x = Clamp(panel->scroll.x, 0, contentsW - panel->rect.w); - panel->scroll.y = Clamp(panel->scroll.y, 0, contentsH - panel->rect.h); + panel->scroll.x = oc_clamp(panel->scroll.x, 0, contentsW - panel->rect.w); + panel->scroll.y = oc_clamp(panel->scroll.y, 0, contentsH - panel->rect.h); - ui_box_end(); + oc_ui_box_end(); } //------------------------------------------------------------------------------ // tooltips //------------------------------------------------------------------------------ -ui_sig ui_tooltip_begin(const char* name) +oc_ui_sig oc_ui_tooltip_begin(const char* name) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - vec2 p = ui_mouse_position(); + oc_vec2 p = oc_ui_mouse_position(); - ui_style style = {.size.width = {UI_SIZE_CHILDREN}, - .size.height = {UI_SIZE_CHILDREN}, + oc_ui_style style = {.size.width = {OC_UI_SIZE_CHILDREN}, + .size.height = {OC_UI_SIZE_CHILDREN}, .floating.x = true, .floating.y = true, .floatTarget = {p.x, p.y}}; - ui_style_mask mask = UI_STYLE_SIZE | UI_STYLE_FLOAT; + oc_ui_style_mask mask = OC_UI_STYLE_SIZE | OC_UI_STYLE_FLOAT; - ui_style_next(&style, mask); + oc_ui_style_next(&style, mask); - ui_flags flags = UI_FLAG_OVERLAY - | UI_FLAG_DRAW_BACKGROUND - | UI_FLAG_DRAW_BORDER; + oc_ui_flags flags = OC_UI_FLAG_OVERLAY + | OC_UI_FLAG_DRAW_BACKGROUND + | OC_UI_FLAG_DRAW_BORDER; - ui_box* tooltip = ui_box_make(name, flags); - ui_box_push(tooltip); + oc_ui_box* tooltip = oc_ui_box_make(name, flags); + oc_ui_box_push(tooltip); - return(ui_box_sig(tooltip)); + return(oc_ui_box_sig(tooltip)); } -void ui_tooltip_end(void) +void oc_ui_tooltip_end(void) { - ui_box_pop(); // tooltip + oc_ui_box_pop(); // tooltip } //------------------------------------------------------------------------------ // Menus //------------------------------------------------------------------------------ -void ui_menu_bar_begin(const char* name) +void oc_ui_menu_bar_begin(const char* name) { - ui_style style = {.size.width = {UI_SIZE_PARENT, 1, 0}, - .size.height = {UI_SIZE_CHILDREN}, - .layout.axis = UI_AXIS_X, + oc_ui_style style = {.size.width = {OC_UI_SIZE_PARENT, 1, 0}, + .size.height = {OC_UI_SIZE_CHILDREN}, + .layout.axis = OC_UI_AXIS_X, .layout.spacing = 20,}; - ui_style_mask mask = UI_STYLE_SIZE - | UI_STYLE_LAYOUT_AXIS - | UI_STYLE_LAYOUT_SPACING; + oc_ui_style_mask mask = OC_UI_STYLE_SIZE + | OC_UI_STYLE_LAYOUT_AXIS + | OC_UI_STYLE_LAYOUT_SPACING; - ui_style_next(&style, mask); - ui_box* bar = ui_box_begin(name, UI_FLAG_DRAW_BACKGROUND); + oc_ui_style_next(&style, mask); + oc_ui_box* bar = oc_ui_box_begin(name, OC_UI_FLAG_DRAW_BACKGROUND); - ui_sig sig = ui_box_sig(bar); - ui_context* ui = ui_get_context(); - if(!sig.hovering && mp_mouse_released(&ui->input, MP_MOUSE_LEFT)) + oc_ui_sig sig = oc_ui_box_sig(bar); + oc_ui_context* ui = oc_ui_get_context(); + if(!sig.hovering && oc_mouse_released(&ui->input, OC_MOUSE_LEFT)) { - ui_box_deactivate(bar); + oc_ui_box_deactivate(bar); } } -void ui_menu_bar_end(void) +void oc_ui_menu_bar_end(void) { - ui_box_end(); // menu bar + oc_ui_box_end(); // menu bar } -void ui_menu_begin(const char* label) +void oc_ui_menu_begin(const char* label) { - ui_box* container = ui_box_make(label, 0); - ui_box_push(container); + oc_ui_box* container = oc_ui_box_make(label, 0); + oc_ui_box_push(container); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_TEXT}, - .size.height = {UI_SIZE_TEXT}}, - UI_STYLE_SIZE); + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_TEXT}, + .size.height = {OC_UI_SIZE_TEXT}}, + OC_UI_STYLE_SIZE); - ui_box* button = ui_box_make(label, UI_FLAG_CLICKABLE | UI_FLAG_DRAW_TEXT); - ui_box* bar = container->parent; + oc_ui_box* button = oc_ui_box_make(label, OC_UI_FLAG_CLICKABLE | OC_UI_FLAG_DRAW_TEXT); + oc_ui_box* bar = container->parent; - ui_sig sig = ui_box_sig(button); - ui_sig barSig = ui_box_sig(bar); + oc_ui_sig sig = oc_ui_box_sig(button); + oc_ui_sig barSig = oc_ui_box_sig(bar); - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_style style = {.size.width = {UI_SIZE_CHILDREN}, - .size.height = {UI_SIZE_CHILDREN}, + oc_ui_style style = {.size.width = {OC_UI_SIZE_CHILDREN}, + .size.height = {OC_UI_SIZE_CHILDREN}, .floating.x = true, .floating.y = true, .floatTarget = {button->rect.x, button->rect.y + button->rect.h}, - .layout.axis = UI_AXIS_Y, + .layout.axis = OC_UI_AXIS_Y, .layout.spacing = 5, .layout.margin.x = 0, .layout.margin.y = 5, .bgColor = {0.2, 0.2, 0.2, 1}}; - ui_style_mask mask = UI_STYLE_SIZE - | UI_STYLE_FLOAT - | UI_STYLE_LAYOUT - | UI_STYLE_BG_COLOR; + oc_ui_style_mask mask = OC_UI_STYLE_SIZE + | OC_UI_STYLE_FLOAT + | OC_UI_STYLE_LAYOUT + | OC_UI_STYLE_BG_COLOR; - ui_flags flags = UI_FLAG_OVERLAY - | UI_FLAG_DRAW_BACKGROUND - | UI_FLAG_DRAW_BORDER; + oc_ui_flags flags = OC_UI_FLAG_OVERLAY + | OC_UI_FLAG_DRAW_BACKGROUND + | OC_UI_FLAG_DRAW_BORDER; - ui_style_next(&style, mask); - ui_box* menu = ui_box_make("panel", flags); + oc_ui_style_next(&style, mask); + oc_ui_box* menu = oc_ui_box_make("panel", flags); - if(ui_box_active(bar)) + if(oc_ui_box_active(bar)) { if(sig.hovering) { - ui_box_activate(button); + oc_ui_box_activate(button); } else if(barSig.hovering) { - ui_box_deactivate(button); + oc_ui_box_deactivate(button); } } else { - ui_box_deactivate(button); + oc_ui_box_deactivate(button); if(sig.pressed) { - ui_box_activate(bar); - ui_box_activate(button); + oc_ui_box_activate(bar); + oc_ui_box_activate(button); } } - ui_box_set_closed(menu, !ui_box_active(button)); - ui_box_push(menu); + oc_ui_box_set_closed(menu, !oc_ui_box_active(button)); + oc_ui_box_push(menu); } -void ui_menu_end(void) +void oc_ui_menu_end(void) { - ui_box_pop(); // menu - ui_box_pop(); // container + oc_ui_box_pop(); // menu + oc_ui_box_pop(); // container } -ui_sig ui_menu_button(const char* name) +oc_ui_sig oc_ui_menu_button(const char* name) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_TEXT}, - .size.height = {UI_SIZE_TEXT}, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_TEXT}, + .size.height = {OC_UI_SIZE_TEXT}, .layout.margin.x = 5, .bgColor = {0, 0, 0, 0}}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_MARGIN_X - |UI_STYLE_BG_COLOR); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_MARGIN_X + |OC_UI_STYLE_BG_COLOR); - ui_pattern pattern = {0}; - ui_pattern_push(&ui->frameArena, &pattern, (ui_selector){.kind = UI_SEL_STATUS, .status = UI_HOVER}); + oc_ui_pattern pattern = {0}; + oc_ui_pattern_push(&ui->frameArena, &pattern, (oc_ui_selector){.kind = OC_UI_SEL_STATUS, .status = OC_UI_HOVER}); - ui_style style = {.bgColor = {0, 0, 1, 1}}; - ui_style_mask mask = UI_STYLE_BG_COLOR; - ui_style_match_before(pattern, &style, mask); + oc_ui_style style = {.bgColor = {0, 0, 1, 1}}; + oc_ui_style_mask mask = OC_UI_STYLE_BG_COLOR; + oc_ui_style_match_before(pattern, &style, mask); - ui_flags flags = UI_FLAG_CLICKABLE - | UI_FLAG_CLIP - | UI_FLAG_DRAW_TEXT - | UI_FLAG_DRAW_BACKGROUND; + oc_ui_flags flags = OC_UI_FLAG_CLICKABLE + | OC_UI_FLAG_CLIP + | OC_UI_FLAG_DRAW_TEXT + | OC_UI_FLAG_DRAW_BACKGROUND; - ui_box* box = ui_box_make(name, flags); - ui_sig sig = ui_box_sig(box); + oc_ui_box* box = oc_ui_box_make(name, flags); + oc_ui_sig sig = oc_ui_box_sig(box); return(sig); } -void ui_select_popup_draw_arrow(ui_box* box, void* data) +void oc_ui_select_popup_draw_arrow(oc_ui_box* box, void* data) { - f32 r = minimum(box->parent->style.roundness, box->rect.w); + f32 r = oc_min(box->parent->style.roundness, box->rect.w); f32 cr = r*4*(sqrt(2)-1)/3; - mg_move_to(box->rect.x, box->rect.y); - mg_line_to(box->rect.x + box->rect.w - r, box->rect.y); - mg_cubic_to(box->rect.x + box->rect.w - cr, box->rect.y, + oc_move_to(box->rect.x, box->rect.y); + oc_line_to(box->rect.x + box->rect.w - r, box->rect.y); + oc_cubic_to(box->rect.x + box->rect.w - cr, box->rect.y, box->rect.x + box->rect.w, box->rect.y + cr, box->rect.x + box->rect.w, box->rect.y + r); - mg_line_to(box->rect.x + box->rect.w, box->rect.y + box->rect.h - r); - mg_cubic_to(box->rect.x + box->rect.w, box->rect.y + box->rect.h - cr, + oc_line_to(box->rect.x + box->rect.w, box->rect.y + box->rect.h - r); + oc_cubic_to(box->rect.x + box->rect.w, box->rect.y + box->rect.h - cr, box->rect.x + box->rect.w - cr, box->rect.y + box->rect.h, box->rect.x + box->rect.w - r, box->rect.y + box->rect.h); - mg_line_to(box->rect.x, box->rect.y + box->rect.h); + oc_line_to(box->rect.x, box->rect.y + box->rect.h); - mg_set_color(box->style.bgColor); - mg_fill(); + oc_set_color(box->style.bgColor); + oc_fill(); - mg_move_to(box->rect.x + 0.25*box->rect.w, box->rect.y + 0.45*box->rect.h); - mg_line_to(box->rect.x + 0.5*box->rect.w, box->rect.y + 0.75*box->rect.h); - mg_line_to(box->rect.x + 0.75*box->rect.w, box->rect.y + 0.45*box->rect.h); - mg_close_path(); + oc_move_to(box->rect.x + 0.25*box->rect.w, box->rect.y + 0.45*box->rect.h); + oc_line_to(box->rect.x + 0.5*box->rect.w, box->rect.y + 0.75*box->rect.h); + oc_line_to(box->rect.x + 0.75*box->rect.w, box->rect.y + 0.45*box->rect.h); + oc_close_path(); - mg_set_color(box->style.color); - mg_fill(); + oc_set_color(box->style.color); + oc_fill(); } -ui_select_popup_info ui_select_popup(const char* name, ui_select_popup_info* info) +oc_ui_select_popup_info oc_ui_select_popup(const char* name, oc_ui_select_popup_info* info) { - ui_select_popup_info result = *info; + oc_ui_select_popup_info result = *info; - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_container(name, 0) + oc_ui_container(name, 0) { - ui_box* button = ui_box_make("button", - UI_FLAG_CLICKABLE - |UI_FLAG_DRAW_BACKGROUND - |UI_FLAG_DRAW_BORDER - |UI_FLAG_ALLOW_OVERFLOW_X - |UI_FLAG_CLIP); + oc_ui_box* button = oc_ui_box_make("button", + OC_UI_FLAG_CLICKABLE + |OC_UI_FLAG_DRAW_BACKGROUND + |OC_UI_FLAG_DRAW_BORDER + |OC_UI_FLAG_ALLOW_OVERFLOW_X + |OC_UI_FLAG_CLIP); f32 maxOptionWidth = 0; f32 lineHeight = 0; - mp_rect bbox = {0}; + oc_rect bbox = {0}; for(int i=0; ioptionCount; i++) { - bbox = mg_text_bounding_box(button->style.font, button->style.fontSize, info->options[i]); - maxOptionWidth = maximum(maxOptionWidth, bbox.w); + bbox = oc_text_bounding_box(button->style.font, button->style.fontSize, info->options[i]); + maxOptionWidth = oc_max(maxOptionWidth, bbox.w); } f32 buttonWidth = maxOptionWidth + 2*button->style.layout.margin.x + button->rect.h; - ui_style_box_before(button, - ui_pattern_owner(), - &(ui_style){.size.width = {UI_SIZE_PIXELS, buttonWidth}, - .size.height = {UI_SIZE_CHILDREN}, + oc_ui_style_box_before(button, + oc_ui_pattern_owner(), + &(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, buttonWidth}, + .size.height = {OC_UI_SIZE_CHILDREN}, .layout.margin.x = 5, .layout.margin.y = 1, .roundness = 5, .borderSize = 1, .borderColor = {0.3, 0.3, 0.3, 1}}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_MARGIN_X - |UI_STYLE_LAYOUT_MARGIN_Y - |UI_STYLE_ROUNDNESS - |UI_STYLE_BORDER_SIZE - |UI_STYLE_BORDER_COLOR); - ui_box_push(button); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_MARGIN_X + |OC_UI_STYLE_LAYOUT_MARGIN_Y + |OC_UI_STYLE_ROUNDNESS + |OC_UI_STYLE_BORDER_SIZE + |OC_UI_STYLE_BORDER_COLOR); + oc_ui_box_push(button); { - ui_label_str8(info->options[info->selectedIndex]); + oc_ui_label_str8(info->options[info->selectedIndex]); - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PIXELS, button->rect.h}, - .size.height = {UI_SIZE_PIXELS, button->rect.h}, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, button->rect.h}, + .size.height = {OC_UI_SIZE_PIXELS, button->rect.h}, .floating.x = true, .floating.y = true, .floatTarget = {button->rect.w - button->rect.h, 0}, .color = {0, 0, 0, 1}, .bgColor = {0.7, 0.7, 0.7, 1}}, - UI_STYLE_SIZE - |UI_STYLE_FLOAT - |UI_STYLE_COLOR - |UI_STYLE_BG_COLOR); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_FLOAT + |OC_UI_STYLE_COLOR + |OC_UI_STYLE_BG_COLOR); - ui_box* arrow = ui_box_make("arrow", UI_FLAG_DRAW_PROC); - ui_box_set_draw_proc(arrow, ui_select_popup_draw_arrow, 0); + oc_ui_box* arrow = oc_ui_box_make("arrow", OC_UI_FLAG_DRAW_PROC); + oc_ui_box_set_draw_proc(arrow, oc_ui_select_popup_draw_arrow, 0); - } ui_box_pop(); + } oc_ui_box_pop(); //panel - ui_box* panel = ui_box_make("panel", - UI_FLAG_DRAW_BACKGROUND - |UI_FLAG_BLOCK_MOUSE - |UI_FLAG_OVERLAY); + oc_ui_box* panel = oc_ui_box_make("panel", + OC_UI_FLAG_DRAW_BACKGROUND + |OC_UI_FLAG_BLOCK_MOUSE + |OC_UI_FLAG_OVERLAY); //TODO: set width to max(button.w, max child...) - f32 containerWidth = maximum(maxOptionWidth + 2*panel->style.layout.margin.x, + f32 containerWidth = oc_max(maxOptionWidth + 2*panel->style.layout.margin.x, button->rect.w); - ui_style_box_before(panel, - ui_pattern_owner(), - &(ui_style){.size.width = {UI_SIZE_PIXELS, containerWidth}, - .size.height = {UI_SIZE_CHILDREN}, + oc_ui_style_box_before(panel, + oc_ui_pattern_owner(), + &(oc_ui_style){.size.width = {OC_UI_SIZE_PIXELS, containerWidth}, + .size.height = {OC_UI_SIZE_CHILDREN}, .floating.x = true, .floating.y = true, .floatTarget = {button->rect.x, button->rect.y + button->rect.h}, - .layout.axis = UI_AXIS_Y, + .layout.axis = OC_UI_AXIS_Y, .layout.margin.x = 0, .layout.margin.y = 5, .bgColor = {0.2, 0.2, 0.2, 1}}, - UI_STYLE_SIZE - |UI_STYLE_FLOAT - |UI_STYLE_LAYOUT - |UI_STYLE_BG_COLOR); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_FLOAT + |OC_UI_STYLE_LAYOUT + |OC_UI_STYLE_BG_COLOR); - ui_box_push(panel); + oc_ui_box_push(panel); { for(int i=0; ioptionCount; i++) { - ui_style_next(&(ui_style){.size.width = {UI_SIZE_PARENT, 1}, - .size.height = {UI_SIZE_TEXT}, - .layout.axis = UI_AXIS_Y, - .layout.align.x = UI_ALIGN_START, + oc_ui_style_next(&(oc_ui_style){.size.width = {OC_UI_SIZE_PARENT, 1}, + .size.height = {OC_UI_SIZE_TEXT}, + .layout.axis = OC_UI_AXIS_Y, + .layout.align.x = OC_UI_ALIGN_START, .layout.margin.x = 5, .layout.margin.y = 2.5}, - UI_STYLE_SIZE - |UI_STYLE_LAYOUT_AXIS - |UI_STYLE_LAYOUT_ALIGN_X - |UI_STYLE_LAYOUT_MARGIN_X - |UI_STYLE_LAYOUT_MARGIN_Y); + OC_UI_STYLE_SIZE + |OC_UI_STYLE_LAYOUT_AXIS + |OC_UI_STYLE_LAYOUT_ALIGN_X + |OC_UI_STYLE_LAYOUT_MARGIN_X + |OC_UI_STYLE_LAYOUT_MARGIN_Y); - ui_pattern pattern = {0}; - ui_pattern_push(&ui->frameArena, &pattern, (ui_selector){.kind = UI_SEL_STATUS, .status = UI_HOVER}); - ui_style_match_before(pattern, &(ui_style){.bgColor = {0, 0, 1, 1}}, UI_STYLE_BG_COLOR); + oc_ui_pattern pattern = {0}; + oc_ui_pattern_push(&ui->frameArena, &pattern, (oc_ui_selector){.kind = OC_UI_SEL_STATUS, .status = OC_UI_HOVER}); + oc_ui_style_match_before(pattern, &(oc_ui_style){.bgColor = {0, 0, 1, 1}}, OC_UI_STYLE_BG_COLOR); - ui_box* box = ui_box_make_str8(info->options[i], - UI_FLAG_DRAW_TEXT - |UI_FLAG_CLICKABLE - |UI_FLAG_DRAW_BACKGROUND); - ui_sig sig = ui_box_sig(box); + oc_ui_box* box = oc_ui_box_make_str8(info->options[i], + OC_UI_FLAG_DRAW_TEXT + |OC_UI_FLAG_CLICKABLE + |OC_UI_FLAG_DRAW_BACKGROUND); + oc_ui_sig sig = oc_ui_box_sig(box); if(sig.pressed) { result.selectedIndex = i; } } } - ui_box_pop(); + oc_ui_box_pop(); - ui_context* ui = ui_get_context(); - if(ui_box_active(panel) && mp_mouse_pressed(&ui->input, MP_MOUSE_LEFT)) + oc_ui_context* ui = oc_ui_get_context(); + if(oc_ui_box_active(panel) && oc_mouse_pressed(&ui->input, OC_MOUSE_LEFT)) { - ui_box_deactivate(panel); + oc_ui_box_deactivate(panel); } - else if(ui_box_sig(button).pressed) + else if(oc_ui_box_sig(button).pressed) { - ui_box_activate(panel); + oc_ui_box_activate(panel); } - ui_box_set_closed(panel, !ui_box_active(panel)); + oc_ui_box_set_closed(panel, !oc_ui_box_active(panel)); } return(result); } @@ -2222,230 +2222,230 @@ ui_select_popup_info ui_select_popup(const char* name, ui_select_popup_info* inf //------------------------------------------------------------------------------ // text box //------------------------------------------------------------------------------ -str32 ui_edit_replace_selection_with_codepoints(ui_context* ui, str32 codepoints, str32 input) +oc_str32 oc_ui_edit_replace_selection_with_codepoints(oc_ui_context* ui, oc_str32 codepoints, oc_str32 input) { - u32 start = minimum(ui->editCursor, ui->editMark); - u32 end = maximum(ui->editCursor, ui->editMark); + u32 start = oc_min(ui->editCursor, ui->editMark); + u32 end = oc_max(ui->editCursor, ui->editMark); - str32 before = str32_slice(codepoints, 0, start); - str32 after = str32_slice(codepoints, end, codepoints.len); + oc_str32 before = oc_str32_slice(codepoints, 0, start); + oc_str32 after = oc_str32_slice(codepoints, end, codepoints.len); - str32_list list = {0}; - str32_list_push(&ui->frameArena, &list, before); - str32_list_push(&ui->frameArena, &list, input); - str32_list_push(&ui->frameArena, &list, after); + oc_str32_list list = {0}; + oc_str32_list_push(&ui->frameArena, &list, before); + oc_str32_list_push(&ui->frameArena, &list, input); + oc_str32_list_push(&ui->frameArena, &list, after); - codepoints = str32_list_join(&ui->frameArena, list); + codepoints = oc_str32_list_join(&ui->frameArena, list); ui->editCursor = start + input.len; ui->editMark = ui->editCursor; return(codepoints); } -str32 ui_edit_delete_selection(ui_context* ui, str32 codepoints) +oc_str32 oc_ui_edit_delete_selection(oc_ui_context* ui, oc_str32 codepoints) { - return(ui_edit_replace_selection_with_codepoints(ui, codepoints, (str32){0})); + return(oc_ui_edit_replace_selection_with_codepoints(ui, codepoints, (oc_str32){0})); } -void ui_edit_copy_selection_to_clipboard(ui_context* ui, str32 codepoints) +void oc_ui_edit_copy_selection_to_clipboard(oc_ui_context* ui, oc_str32 codepoints) { - #if !PLATFORM_ORCA + #if !OC_PLATFORM_ORCA if(ui->editCursor == ui->editMark) { return; } - u32 start = minimum(ui->editCursor, ui->editMark); - u32 end = maximum(ui->editCursor, ui->editMark); - str32 selection = str32_slice(codepoints, start, end); - str8 string = utf8_push_from_codepoints(&ui->frameArena, selection); + u32 start = oc_min(ui->editCursor, ui->editMark); + u32 end = oc_max(ui->editCursor, ui->editMark); + oc_str32 selection = oc_str32_slice(codepoints, start, end); + oc_str8 string = oc_utf8_push_from_codepoints(&ui->frameArena, selection); - mp_clipboard_clear(); - mp_clipboard_set_string(string); + oc_clipboard_clear(); + oc_clipboard_set_string(string); #endif } -str32 ui_edit_replace_selection_with_clipboard(ui_context* ui, str32 codepoints) +oc_str32 oc_ui_edit_replace_selection_with_clipboard(oc_ui_context* ui, oc_str32 codepoints) { - #if PLATFORM_ORCA - str32 result = {0}; + #if OC_PLATFORM_ORCA + oc_str32 result = {0}; #else - str8 string = mp_clipboard_get_string(&ui->frameArena); - str32 input = utf8_push_to_codepoints(&ui->frameArena, string); - str32 result = ui_edit_replace_selection_with_codepoints(ui, codepoints, input); + oc_str8 string = oc_clipboard_get_string(&ui->frameArena); + oc_str32 input = oc_utf8_push_to_codepoints(&ui->frameArena, string); + oc_str32 result = oc_ui_edit_replace_selection_with_codepoints(ui, codepoints, input); #endif return(result); } typedef enum { - UI_EDIT_MOVE, - UI_EDIT_SELECT, - UI_EDIT_SELECT_EXTEND, - UI_EDIT_DELETE, - UI_EDIT_CUT, - UI_EDIT_COPY, - UI_EDIT_PASTE, - UI_EDIT_SELECT_ALL } ui_edit_op; + OC_UI_EDIT_MOVE, + OC_UI_EDIT_SELECT, + OC_UI_EDIT_SELECT_EXTEND, + OC_UI_EDIT_DELETE, + OC_UI_EDIT_CUT, + OC_UI_EDIT_COPY, + OC_UI_EDIT_PASTE, + OC_UI_EDIT_SELECT_ALL } oc_ui_edit_op; typedef enum { - UI_EDIT_MOVE_NONE = 0, - UI_EDIT_MOVE_ONE, - UI_EDIT_MOVE_WORD, - UI_EDIT_MOVE_LINE } ui_edit_move; + OC_UI_EDIT_MOVE_NONE = 0, + OC_UI_EDIT_MOVE_ONE, + OC_UI_EDIT_MOVE_WORD, + OC_UI_EDIT_MOVE_LINE } oc_ui_edit_move; -typedef struct ui_edit_command +typedef struct oc_ui_edit_command { - mp_key_code key; - mp_keymod_flags mods; + oc_key_code key; + oc_keymod_flags mods; - ui_edit_op operation; - ui_edit_move move; + oc_ui_edit_op operation; + oc_ui_edit_move move; int direction; -} ui_edit_command; +} oc_ui_edit_command; -const ui_edit_command UI_EDIT_COMMANDS[] = { +const oc_ui_edit_command OC_UI_EDIT_COMMANDS[] = { //NOTE(martin): move one left { - .key = MP_KEY_LEFT, - .operation = UI_EDIT_MOVE, - .move = UI_EDIT_MOVE_ONE, + .key = OC_KEY_LEFT, + .operation = OC_UI_EDIT_MOVE, + .move = OC_UI_EDIT_MOVE_ONE, .direction = -1 }, //NOTE(martin): move one right { - .key = MP_KEY_RIGHT, - .operation = UI_EDIT_MOVE, - .move = UI_EDIT_MOVE_ONE, + .key = OC_KEY_RIGHT, + .operation = OC_UI_EDIT_MOVE, + .move = OC_UI_EDIT_MOVE_ONE, .direction = 1 }, //NOTE(martin): move start { - .key = MP_KEY_Q, - .mods = MP_KEYMOD_CTRL, - .operation = UI_EDIT_MOVE, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_Q, + .mods = OC_KEYMOD_CTRL, + .operation = OC_UI_EDIT_MOVE, + .move = OC_UI_EDIT_MOVE_LINE, .direction = -1 }, { - .key = MP_KEY_UP, - .operation = UI_EDIT_MOVE, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_UP, + .operation = OC_UI_EDIT_MOVE, + .move = OC_UI_EDIT_MOVE_LINE, .direction = -1 }, //NOTE(martin): move end { - .key = MP_KEY_E, - .mods = MP_KEYMOD_CTRL, - .operation = UI_EDIT_MOVE, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_E, + .mods = OC_KEYMOD_CTRL, + .operation = OC_UI_EDIT_MOVE, + .move = OC_UI_EDIT_MOVE_LINE, .direction = 1 }, { - .key = MP_KEY_DOWN, - .operation = UI_EDIT_MOVE, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_DOWN, + .operation = OC_UI_EDIT_MOVE, + .move = OC_UI_EDIT_MOVE_LINE, .direction = 1 }, //NOTE(martin): select one left { - .key = MP_KEY_LEFT, - .mods = MP_KEYMOD_SHIFT, - .operation = UI_EDIT_SELECT, - .move = UI_EDIT_MOVE_ONE, + .key = OC_KEY_LEFT, + .mods = OC_KEYMOD_SHIFT, + .operation = OC_UI_EDIT_SELECT, + .move = OC_UI_EDIT_MOVE_ONE, .direction = -1 }, //NOTE(martin): select one right { - .key = MP_KEY_RIGHT, - .mods = MP_KEYMOD_SHIFT, - .operation = UI_EDIT_SELECT, - .move = UI_EDIT_MOVE_ONE, + .key = OC_KEY_RIGHT, + .mods = OC_KEYMOD_SHIFT, + .operation = OC_UI_EDIT_SELECT, + .move = OC_UI_EDIT_MOVE_ONE, .direction = 1 }, //NOTE(martin): extend select to start { - .key = MP_KEY_Q, - .mods = MP_KEYMOD_CTRL | MP_KEYMOD_SHIFT, - .operation = UI_EDIT_SELECT_EXTEND, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_Q, + .mods = OC_KEYMOD_CTRL | OC_KEYMOD_SHIFT, + .operation = OC_UI_EDIT_SELECT_EXTEND, + .move = OC_UI_EDIT_MOVE_LINE, .direction = -1 }, { - .key = MP_KEY_UP, - .mods = MP_KEYMOD_SHIFT, - .operation = UI_EDIT_SELECT_EXTEND, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_UP, + .mods = OC_KEYMOD_SHIFT, + .operation = OC_UI_EDIT_SELECT_EXTEND, + .move = OC_UI_EDIT_MOVE_LINE, .direction = -1 }, //NOTE(martin): extend select to end { - .key = MP_KEY_E, - .mods = MP_KEYMOD_CTRL | MP_KEYMOD_SHIFT, - .operation = UI_EDIT_SELECT_EXTEND, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_E, + .mods = OC_KEYMOD_CTRL | OC_KEYMOD_SHIFT, + .operation = OC_UI_EDIT_SELECT_EXTEND, + .move = OC_UI_EDIT_MOVE_LINE, .direction = 1 }, { - .key = MP_KEY_DOWN, - .mods = MP_KEYMOD_SHIFT, - .operation = UI_EDIT_SELECT_EXTEND, - .move = UI_EDIT_MOVE_LINE, + .key = OC_KEY_DOWN, + .mods = OC_KEYMOD_SHIFT, + .operation = OC_UI_EDIT_SELECT_EXTEND, + .move = OC_UI_EDIT_MOVE_LINE, .direction = 1 }, //NOTE(martin): select all { - .key = MP_KEY_Q, - .mods = MP_KEYMOD_MAIN_MODIFIER, - .operation = UI_EDIT_SELECT_ALL, - .move = UI_EDIT_MOVE_NONE + .key = OC_KEY_Q, + .mods = OC_KEYMOD_MAIN_MODIFIER, + .operation = OC_UI_EDIT_SELECT_ALL, + .move = OC_UI_EDIT_MOVE_NONE }, //NOTE(martin): delete { - .key = MP_KEY_DELETE, - .operation = UI_EDIT_DELETE, - .move = UI_EDIT_MOVE_ONE, + .key = OC_KEY_DELETE, + .operation = OC_UI_EDIT_DELETE, + .move = OC_UI_EDIT_MOVE_ONE, .direction = 1 }, //NOTE(martin): backspace { - .key = MP_KEY_BACKSPACE, - .operation = UI_EDIT_DELETE, - .move = UI_EDIT_MOVE_ONE, + .key = OC_KEY_BACKSPACE, + .operation = OC_UI_EDIT_DELETE, + .move = OC_UI_EDIT_MOVE_ONE, .direction = -1 }, //NOTE(martin): cut { - .key = MP_KEY_X, - .mods = MP_KEYMOD_MAIN_MODIFIER, - .operation = UI_EDIT_CUT, - .move = UI_EDIT_MOVE_NONE + .key = OC_KEY_X, + .mods = OC_KEYMOD_MAIN_MODIFIER, + .operation = OC_UI_EDIT_CUT, + .move = OC_UI_EDIT_MOVE_NONE }, //NOTE(martin): copy { - .key = MP_KEY_C, - .mods = MP_KEYMOD_MAIN_MODIFIER, - .operation = UI_EDIT_COPY, - .move = UI_EDIT_MOVE_NONE + .key = OC_KEY_C, + .mods = OC_KEYMOD_MAIN_MODIFIER, + .operation = OC_UI_EDIT_COPY, + .move = OC_UI_EDIT_MOVE_NONE }, //NOTE(martin): paste { - .key = MP_KEY_V, - .mods = MP_KEYMOD_MAIN_MODIFIER, - .operation = UI_EDIT_PASTE, - .move = UI_EDIT_MOVE_NONE + .key = OC_KEY_V, + .mods = OC_KEYMOD_MAIN_MODIFIER, + .operation = OC_UI_EDIT_PASTE, + .move = OC_UI_EDIT_MOVE_NONE } }; -const u32 UI_EDIT_COMMAND_COUNT = sizeof(UI_EDIT_COMMANDS)/sizeof(ui_edit_command); +const u32 OC_UI_EDIT_COMMAND_COUNT = sizeof(OC_UI_EDIT_COMMANDS)/sizeof(oc_ui_edit_command); -void ui_edit_perform_move(ui_context* ui, ui_edit_move move, int direction, u32 textLen) +void oc_ui_edit_perform_move(oc_ui_context* ui, oc_ui_edit_move move, int direction, u32 textLen) { switch(move) { - case UI_EDIT_MOVE_NONE: + case OC_UI_EDIT_MOVE_NONE: break; - case UI_EDIT_MOVE_ONE: + case OC_UI_EDIT_MOVE_ONE: { if(direction < 0 && ui->editCursor > 0) { @@ -2457,7 +2457,7 @@ void ui_edit_perform_move(ui_context* ui, ui_edit_move move, int direction, u32 } } break; - case UI_EDIT_MOVE_LINE: + case OC_UI_EDIT_MOVE_LINE: { if(direction < 0) { @@ -2469,40 +2469,40 @@ void ui_edit_perform_move(ui_context* ui, ui_edit_move move, int direction, u32 } } break; - case UI_EDIT_MOVE_WORD: - DEBUG_ASSERT(0, "not implemented yet"); + case OC_UI_EDIT_MOVE_WORD: + OC_DEBUG_ASSERT(0, "not implemented yet"); break; } } -str32 ui_edit_perform_operation(ui_context* ui, ui_edit_op operation, ui_edit_move move, int direction, str32 codepoints) +oc_str32 oc_ui_edit_perform_operation(oc_ui_context* ui, oc_ui_edit_op operation, oc_ui_edit_move move, int direction, oc_str32 codepoints) { switch(operation) { - case UI_EDIT_MOVE: + case OC_UI_EDIT_MOVE: { //NOTE(martin): we place the cursor on the direction-most side of the selection // before performing the move u32 cursor = direction < 0 ? - minimum(ui->editCursor, ui->editMark) : - maximum(ui->editCursor, ui->editMark); + oc_min(ui->editCursor, ui->editMark) : + oc_max(ui->editCursor, ui->editMark); ui->editCursor = cursor; - if(ui->editCursor == ui->editMark || move != UI_EDIT_MOVE_ONE) + if(ui->editCursor == ui->editMark || move != OC_UI_EDIT_MOVE_ONE) { //NOTE: we special case move-one when there is a selection // (just place the cursor at begining/end of selection) - ui_edit_perform_move(ui, move, direction, codepoints.len); + oc_ui_edit_perform_move(ui, move, direction, codepoints.len); } ui->editMark = ui->editCursor; } break; - case UI_EDIT_SELECT: + case OC_UI_EDIT_SELECT: { - ui_edit_perform_move(ui, move, direction, codepoints.len); + oc_ui_edit_perform_move(ui, move, direction, codepoints.len); } break; - case UI_EDIT_SELECT_EXTEND: + case OC_UI_EDIT_SELECT_EXTEND: { if((direction > 0) != (ui->editCursor > ui->editMark)) { @@ -2510,36 +2510,36 @@ str32 ui_edit_perform_operation(ui_context* ui, ui_edit_op operation, ui_edit_mo ui->editCursor = ui->editMark; ui->editMark = tmp; } - ui_edit_perform_move(ui, move, direction, codepoints.len); + oc_ui_edit_perform_move(ui, move, direction, codepoints.len); } break; - case UI_EDIT_DELETE: + case OC_UI_EDIT_DELETE: { if(ui->editCursor == ui->editMark) { - ui_edit_perform_move(ui, move, direction, codepoints.len); + oc_ui_edit_perform_move(ui, move, direction, codepoints.len); } - codepoints = ui_edit_delete_selection(ui, codepoints); + codepoints = oc_ui_edit_delete_selection(ui, codepoints); ui->editMark = ui->editCursor; } break; - case UI_EDIT_CUT: + case OC_UI_EDIT_CUT: { - ui_edit_copy_selection_to_clipboard(ui, codepoints); - codepoints = ui_edit_delete_selection(ui, codepoints); + oc_ui_edit_copy_selection_to_clipboard(ui, codepoints); + codepoints = oc_ui_edit_delete_selection(ui, codepoints); } break; - case UI_EDIT_COPY: + case OC_UI_EDIT_COPY: { - ui_edit_copy_selection_to_clipboard(ui, codepoints); + oc_ui_edit_copy_selection_to_clipboard(ui, codepoints); } break; - case UI_EDIT_PASTE: + case OC_UI_EDIT_PASTE: { - codepoints = ui_edit_replace_selection_with_clipboard(ui, codepoints); + codepoints = oc_ui_edit_replace_selection_with_clipboard(ui, codepoints); } break; - case UI_EDIT_SELECT_ALL: + case OC_UI_EDIT_SELECT_ALL: { ui->editCursor = 0; ui->editMark = codepoints.len; @@ -2550,23 +2550,23 @@ str32 ui_edit_perform_operation(ui_context* ui, ui_edit_op operation, ui_edit_mo return(codepoints); } -void ui_text_box_render(ui_box* box, void* data) +void oc_ui_text_box_render(oc_ui_box* box, void* data) { - str32 codepoints = *(str32*)data; - ui_context* ui = ui_get_context(); + oc_str32 codepoints = *(oc_str32*)data; + oc_ui_context* ui = oc_ui_get_context(); u32 firstDisplayedChar = 0; - if(ui_box_active(box)) + if(oc_ui_box_active(box)) { firstDisplayedChar = ui->editFirstDisplayedChar; } - ui_style* style = &box->style; - mg_font_extents extents = mg_font_get_scaled_extents(style->font, style->fontSize); + oc_ui_style* style = &box->style; + oc_font_extents extents = oc_font_get_scaled_extents(style->font, style->fontSize); f32 lineHeight = extents.ascent + extents.descent; - str32 before = str32_slice(codepoints, 0, firstDisplayedChar); - mp_rect beforeBox = mg_text_bounding_box_utf32(style->font, style->fontSize, before); + oc_str32 before = oc_str32_slice(codepoints, 0, firstDisplayedChar); + oc_rect beforeBox = oc_text_bounding_box_utf32(style->font, style->fontSize, before); f32 textMargin = 5; //TODO: make that configurable @@ -2576,42 +2576,42 @@ void ui_text_box_render(ui_box* box, void* data) if(box->active) { - u32 selectStart = minimum(ui->editCursor, ui->editMark); - u32 selectEnd = maximum(ui->editCursor, ui->editMark); + u32 selectStart = oc_min(ui->editCursor, ui->editMark); + u32 selectEnd = oc_max(ui->editCursor, ui->editMark); - str32 beforeSelect = str32_slice(codepoints, 0, selectStart); - mp_rect beforeSelectBox = mg_text_bounding_box_utf32(style->font, style->fontSize, beforeSelect); + oc_str32 beforeSelect = oc_str32_slice(codepoints, 0, selectStart); + oc_rect beforeSelectBox = oc_text_bounding_box_utf32(style->font, style->fontSize, beforeSelect); beforeSelectBox.x += textX; beforeSelectBox.y += textY; if(selectStart != selectEnd) { - str32 select = str32_slice(codepoints, selectStart, selectEnd); - str32 afterSelect = str32_slice(codepoints, selectEnd, codepoints.len); - mp_rect selectBox = mg_text_bounding_box_utf32(style->font, style->fontSize, select); - mp_rect afterSelectBox = mg_text_bounding_box_utf32(style->font, style->fontSize, afterSelect); + oc_str32 select = oc_str32_slice(codepoints, selectStart, selectEnd); + oc_str32 afterSelect = oc_str32_slice(codepoints, selectEnd, codepoints.len); + oc_rect selectBox = oc_text_bounding_box_utf32(style->font, style->fontSize, select); + oc_rect afterSelectBox = oc_text_bounding_box_utf32(style->font, style->fontSize, afterSelect); selectBox.x += beforeSelectBox.x + beforeSelectBox.w; selectBox.y += textY; - mg_set_color_rgba(0, 0, 1, 1); - mg_rectangle_fill(selectBox.x, selectBox.y, selectBox.w, lineHeight); + oc_set_color_rgba(0, 0, 1, 1); + oc_rectangle_fill(selectBox.x, selectBox.y, selectBox.w, lineHeight); - mg_set_font(style->font); - mg_set_font_size(style->fontSize); - mg_set_color(style->color); + oc_set_font(style->font); + oc_set_font_size(style->fontSize); + oc_set_color(style->color); - mg_move_to(textX, textY); - mg_codepoints_outlines(beforeSelect); - mg_fill(); + oc_move_to(textX, textY); + oc_codepoints_outlines(beforeSelect); + oc_fill(); - mg_set_color_rgba(1, 1, 1, 1); - mg_codepoints_outlines(select); - mg_fill(); + oc_set_color_rgba(1, 1, 1, 1); + oc_codepoints_outlines(select); + oc_fill(); - mg_set_color(style->color); - mg_codepoints_outlines(afterSelect); - mg_fill(); + oc_set_color(style->color); + oc_codepoints_outlines(afterSelect); + oc_fill(); } else { @@ -2619,59 +2619,59 @@ void ui_text_box_render(ui_box* box, void* data) { f32 caretX = box->rect.x + textMargin - beforeBox.w + beforeSelectBox.w; f32 caretY = textTop; - mg_set_color(style->color); - mg_rectangle_fill(caretX, caretY, 1, lineHeight); + oc_set_color(style->color); + oc_rectangle_fill(caretX, caretY, 1, lineHeight); } - mg_set_font(style->font); - mg_set_font_size(style->fontSize); - mg_set_color(style->color); + oc_set_font(style->font); + oc_set_font_size(style->fontSize); + oc_set_color(style->color); - mg_move_to(textX, textY); - mg_codepoints_outlines(codepoints); - mg_fill(); + oc_move_to(textX, textY); + oc_codepoints_outlines(codepoints); + oc_fill(); } } else { - mg_set_font(style->font); - mg_set_font_size(style->fontSize); - mg_set_color(style->color); + oc_set_font(style->font); + oc_set_font_size(style->fontSize); + oc_set_color(style->color); - mg_move_to(textX, textY); - mg_codepoints_outlines(codepoints); - mg_fill(); + oc_move_to(textX, textY); + oc_codepoints_outlines(codepoints); + oc_fill(); } } -ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) +oc_ui_text_box_result oc_ui_text_box(const char* name, oc_arena* arena, oc_str8 text) { - ui_context* ui = ui_get_context(); + oc_ui_context* ui = oc_ui_get_context(); - ui_text_box_result result = {.text = text}; + oc_ui_text_box_result result = {.text = text}; - ui_flags frameFlags = UI_FLAG_CLICKABLE - | UI_FLAG_DRAW_BACKGROUND - | UI_FLAG_DRAW_BORDER - | UI_FLAG_CLIP - | UI_FLAG_DRAW_PROC; + oc_ui_flags frameFlags = OC_UI_FLAG_CLICKABLE + | OC_UI_FLAG_DRAW_BACKGROUND + | OC_UI_FLAG_DRAW_BORDER + | OC_UI_FLAG_CLIP + | OC_UI_FLAG_DRAW_PROC; - ui_box* frame = ui_box_make(name, frameFlags); - ui_style* style = &frame->style; - f32 textMargin = 5; //TODO parameterize this margin! must be the same as in ui_text_box_render + oc_ui_box* frame = oc_ui_box_make(name, frameFlags); + oc_ui_style* style = &frame->style; + f32 textMargin = 5; //TODO parameterize this margin! must be the same as in oc_ui_text_box_render - mg_font_extents extents = mg_font_get_scaled_extents(style->font, style->fontSize); + oc_font_extents extents = oc_font_get_scaled_extents(style->font, style->fontSize); - ui_sig sig = ui_box_sig(frame); + oc_ui_sig sig = oc_ui_box_sig(frame); if(sig.hovering) { - ui_box_set_hot(frame, true); + oc_ui_box_set_hot(frame, true); if(sig.pressed) { - if(!ui_box_active(frame)) + if(!oc_ui_box_active(frame)) { - ui_box_activate(frame); + oc_ui_box_activate(frame); //NOTE: focus ui->focus = frame; @@ -2685,15 +2685,15 @@ ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) if(sig.pressed || sig.dragging) { //NOTE: set cursor/extend selection on mouse press or drag - vec2 pos = ui_mouse_position(); + oc_vec2 pos = oc_ui_mouse_position(); f32 cursorX = pos.x - frame->rect.x - textMargin; - str32 codepoints = utf8_push_to_codepoints(&ui->frameArena, text); + oc_str32 codepoints = oc_utf8_push_to_codepoints(&ui->frameArena, text); i32 newCursor = codepoints.len; f32 x = 0; for(int i = ui->editFirstDisplayedChar; ifont, style->fontSize, str32_slice(codepoints, i, i+1)); + oc_rect bbox = oc_text_bounding_box_utf32(style->font, style->fontSize, oc_str32_slice(codepoints, i, i+1)); if(x + 0.5*bbox.w > cursorX) { newCursor = i; @@ -2711,7 +2711,7 @@ ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) } //NOTE: set the new cursor, and set or leave the mark depending on mode ui->editCursor = newCursor; - if(sig.pressed && !(mp_key_mods(&ui->input) & MP_KEYMOD_SHIFT)) + if(sig.pressed && !(oc_key_mods(&ui->input) & OC_KEYMOD_SHIFT)) { ui->editMark = ui->editCursor; } @@ -2719,13 +2719,13 @@ ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) } else { - ui_box_set_hot(frame, false); + oc_ui_box_set_hot(frame, false); if(sig.pressed) { - if(ui_box_active(frame)) + if(oc_ui_box_active(frame)) { - ui_box_deactivate(frame); + oc_ui_box_deactivate(frame); //NOTE loose focus ui->focus = 0; @@ -2733,32 +2733,32 @@ ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) } } - if(ui_box_active(frame)) + if(oc_ui_box_active(frame)) { - str32 oldCodepoints = utf8_push_to_codepoints(&ui->frameArena, text); - str32 codepoints = oldCodepoints; - ui->editCursor = Clamp(ui->editCursor, 0, codepoints.len); - ui->editMark = Clamp(ui->editMark, 0, codepoints.len); + oc_str32 oldCodepoints = oc_utf8_push_to_codepoints(&ui->frameArena, text); + oc_str32 codepoints = oldCodepoints; + ui->editCursor = oc_clamp(ui->editCursor, 0, codepoints.len); + ui->editMark = oc_clamp(ui->editMark, 0, codepoints.len); //NOTE replace selection with input codepoints - str32 input = mp_input_text_utf32(&ui->input, &ui->frameArena); + oc_str32 input = oc_input_text_utf32(&ui->input, &ui->frameArena); if(input.len) { - codepoints = ui_edit_replace_selection_with_codepoints(ui, codepoints, input); + codepoints = oc_ui_edit_replace_selection_with_codepoints(ui, codepoints, input); ui->editCursorBlinkStart = ui->frameTime; } //NOTE handle shortcuts - mp_keymod_flags mods = mp_key_mods(&ui->input); + oc_keymod_flags mods = oc_key_mods(&ui->input); - for(int i=0; iinput, command->key) || mp_key_repeated(&ui->input, command->key)) + if( (oc_key_pressed(&ui->input, command->key) || oc_key_repeated(&ui->input, command->key)) && mods == command->mods) { - codepoints = ui_edit_perform_operation(ui, command->operation, command->move, command->direction, codepoints); + codepoints = oc_ui_edit_perform_operation(ui, command->operation, command->move, command->direction, codepoints); break; } } @@ -2767,14 +2767,14 @@ ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) if(oldCodepoints.ptr != codepoints.ptr) { result.changed = true; - result.text = utf8_push_from_codepoints(arena, codepoints); + result.text = oc_utf8_push_from_codepoints(arena, codepoints); } - if(mp_key_pressed(&ui->input, MP_KEY_ENTER)) + if(oc_key_pressed(&ui->input, OC_KEY_ENTER)) { //TODO(martin): extract in gui_edit_complete() (and use below) result.accepted = true; - ui_box_deactivate(frame); + oc_ui_box_deactivate(frame); ui->focus = 0; } @@ -2787,14 +2787,14 @@ ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) else { i32 firstDisplayedChar = ui->editFirstDisplayedChar; - str32 firstToCursor = str32_slice(codepoints, firstDisplayedChar, ui->editCursor); - mp_rect firstToCursorBox = mg_text_bounding_box_utf32(style->font, style->fontSize, firstToCursor); + oc_str32 firstToCursor = oc_str32_slice(codepoints, firstDisplayedChar, ui->editCursor); + oc_rect firstToCursorBox = oc_text_bounding_box_utf32(style->font, style->fontSize, firstToCursor); while(firstToCursorBox.w > (frame->rect.w - 2*textMargin)) { firstDisplayedChar++; - firstToCursor = str32_slice(codepoints, firstDisplayedChar, ui->editCursor); - firstToCursorBox = mg_text_bounding_box_utf32(style->font, style->fontSize, firstToCursor); + firstToCursor = oc_str32_slice(codepoints, firstDisplayedChar, ui->editCursor); + firstToCursorBox = oc_text_bounding_box_utf32(style->font, style->fontSize, firstToCursor); } ui->editFirstDisplayedChar = firstDisplayedChar; @@ -2802,16 +2802,16 @@ ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text) } //NOTE: set renderer - str32* renderCodepoints = mem_arena_alloc_type(&ui->frameArena, str32); - *renderCodepoints = str32_push_copy(&ui->frameArena, codepoints); - ui_box_set_draw_proc(frame, ui_text_box_render, renderCodepoints); + oc_str32* renderCodepoints = oc_arena_push_type(&ui->frameArena, oc_str32); + *renderCodepoints = oc_str32_push_copy(&ui->frameArena, codepoints); + oc_ui_box_set_draw_proc(frame, oc_ui_text_box_render, renderCodepoints); } else { //NOTE: set renderer - str32* renderCodepoints = mem_arena_alloc_type(&ui->frameArena, str32); - *renderCodepoints = utf8_push_to_codepoints(&ui->frameArena, text); - ui_box_set_draw_proc(frame, ui_text_box_render, renderCodepoints); + oc_str32* renderCodepoints = oc_arena_push_type(&ui->frameArena, oc_str32); + *renderCodepoints = oc_utf8_push_to_codepoints(&ui->frameArena, text); + oc_ui_box_set_draw_proc(frame, oc_ui_text_box_render, renderCodepoints); } return(result); diff --git a/src/ui/ui.h b/src/ui/ui.h index 369a767..4a24fa6 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -18,38 +18,38 @@ extern "C" { #endif -typedef struct ui_key +typedef struct oc_ui_key { u64 hash; -} ui_key; +} oc_ui_key; typedef enum { - UI_AXIS_X, - UI_AXIS_Y, - UI_AXIS_COUNT -} ui_axis; + OC_UI_AXIS_X, + OC_UI_AXIS_Y, + OC_UI_AXIS_COUNT +} oc_ui_axis; typedef enum { - UI_ALIGN_START, - UI_ALIGN_END, - UI_ALIGN_CENTER, -} ui_align; + OC_UI_ALIGN_START, + OC_UI_ALIGN_END, + OC_UI_ALIGN_CENTER, +} oc_ui_align; -typedef union ui_layout_align +typedef union oc_ui_layout_align { struct { - ui_align x; - ui_align y; + oc_ui_align x; + oc_ui_align y; }; - ui_align c[UI_AXIS_COUNT]; -} ui_layout_align; + oc_ui_align c[OC_UI_AXIS_COUNT]; +} oc_ui_layout_align; -typedef struct ui_layout +typedef struct oc_ui_layout { - ui_axis axis; + oc_ui_axis axis; f32 spacing; union { @@ -58,183 +58,183 @@ typedef struct ui_layout f32 x; f32 y; }; - f32 c[UI_AXIS_COUNT]; + f32 c[OC_UI_AXIS_COUNT]; } margin; - ui_layout_align align; + oc_ui_layout_align align; -} ui_layout; +} oc_ui_layout; -typedef enum ui_size_kind +typedef enum oc_ui_size_kind { - UI_SIZE_TEXT, - UI_SIZE_PIXELS, - UI_SIZE_CHILDREN, - UI_SIZE_PARENT, - UI_SIZE_PARENT_MINUS_PIXELS, + OC_UI_SIZE_TEXT, + OC_UI_SIZE_PIXELS, + OC_UI_SIZE_CHILDREN, + OC_UI_SIZE_PARENT, + OC_UI_SIZE_PARENT_MINUS_PIXELS, -} ui_size_kind; +} oc_ui_size_kind; -typedef struct ui_size +typedef struct oc_ui_size { - ui_size_kind kind; + oc_ui_size_kind kind; f32 value; f32 relax; -} ui_size; +} oc_ui_size; -typedef union ui_box_size +typedef union oc_ui_box_size { struct { - ui_size width; - ui_size height; + oc_ui_size width; + oc_ui_size height; }; - ui_size c[UI_AXIS_COUNT]; -} ui_box_size; + oc_ui_size c[OC_UI_AXIS_COUNT]; +} oc_ui_box_size; -typedef union ui_box_floating +typedef union oc_ui_box_floating { struct { bool x; bool y; }; - bool c[UI_AXIS_COUNT]; -} ui_box_floating; + bool c[OC_UI_AXIS_COUNT]; +} oc_ui_box_floating; -//NOTE: flags for axis-dependent properties (e.g. UI_STYLE_FLOAT_X/Y) need to be consecutive bits +//NOTE: flags for axis-dependent properties (e.g. OC_UI_STYLE_FLOAT_X/Y) need to be consecutive bits // in order to play well with axis agnostic functions -typedef u64 ui_style_mask; +typedef u64 oc_ui_style_mask; enum { - UI_STYLE_NONE = 0, - UI_STYLE_SIZE_WIDTH = 1<<1, - UI_STYLE_SIZE_HEIGHT = 1<<2, - UI_STYLE_LAYOUT_AXIS = 1<<3, - UI_STYLE_LAYOUT_ALIGN_X = 1<<4, - UI_STYLE_LAYOUT_ALIGN_Y = 1<<5, - UI_STYLE_LAYOUT_SPACING = 1<<6, - UI_STYLE_LAYOUT_MARGIN_X = 1<<7, - UI_STYLE_LAYOUT_MARGIN_Y = 1<<8, - UI_STYLE_FLOAT_X = 1<<9, - UI_STYLE_FLOAT_Y = 1<<10, - UI_STYLE_COLOR = 1<<11, - UI_STYLE_BG_COLOR = 1<<12, - UI_STYLE_BORDER_COLOR = 1<<13, - UI_STYLE_BORDER_SIZE = 1<<14, - UI_STYLE_ROUNDNESS = 1<<15, - UI_STYLE_FONT = 1<<16, - UI_STYLE_FONT_SIZE = 1<<17, - UI_STYLE_ANIMATION_TIME = 1<<18, - UI_STYLE_ANIMATION_MASK = 1<<19, + OC_UI_STYLE_NONE = 0, + OC_UI_STYLE_SIZE_WIDTH = 1<<1, + OC_UI_STYLE_SIZE_HEIGHT = 1<<2, + OC_UI_STYLE_LAYOUT_AXIS = 1<<3, + OC_UI_STYLE_LAYOUT_ALIGN_X = 1<<4, + OC_UI_STYLE_LAYOUT_ALIGN_Y = 1<<5, + OC_UI_STYLE_LAYOUT_SPACING = 1<<6, + OC_UI_STYLE_LAYOUT_MARGIN_X = 1<<7, + OC_UI_STYLE_LAYOUT_MARGIN_Y = 1<<8, + OC_UI_STYLE_FLOAT_X = 1<<9, + OC_UI_STYLE_FLOAT_Y = 1<<10, + OC_UI_STYLE_COLOR = 1<<11, + OC_UI_STYLE_BG_COLOR = 1<<12, + OC_UI_STYLE_BORDER_COLOR = 1<<13, + OC_UI_STYLE_BORDER_SIZE = 1<<14, + OC_UI_STYLE_ROUNDNESS = 1<<15, + OC_UI_STYLE_FONT = 1<<16, + OC_UI_STYLE_FONT_SIZE = 1<<17, + OC_UI_STYLE_ANIMATION_TIME = 1<<18, + OC_UI_STYLE_ANIMATION_MASK = 1<<19, //masks - UI_STYLE_SIZE = UI_STYLE_SIZE_WIDTH - | UI_STYLE_SIZE_HEIGHT, + OC_UI_STYLE_SIZE = OC_UI_STYLE_SIZE_WIDTH + | OC_UI_STYLE_SIZE_HEIGHT, - UI_STYLE_LAYOUT_MARGINS = UI_STYLE_LAYOUT_MARGIN_X - | UI_STYLE_LAYOUT_MARGIN_Y, + OC_UI_STYLE_LAYOUT_MARGINS = OC_UI_STYLE_LAYOUT_MARGIN_X + | OC_UI_STYLE_LAYOUT_MARGIN_Y, - UI_STYLE_LAYOUT = UI_STYLE_LAYOUT_AXIS - | UI_STYLE_LAYOUT_ALIGN_X - | UI_STYLE_LAYOUT_ALIGN_Y - | UI_STYLE_LAYOUT_SPACING - | UI_STYLE_LAYOUT_MARGIN_X - | UI_STYLE_LAYOUT_MARGIN_Y, + OC_UI_STYLE_LAYOUT = OC_UI_STYLE_LAYOUT_AXIS + | OC_UI_STYLE_LAYOUT_ALIGN_X + | OC_UI_STYLE_LAYOUT_ALIGN_Y + | OC_UI_STYLE_LAYOUT_SPACING + | OC_UI_STYLE_LAYOUT_MARGIN_X + | OC_UI_STYLE_LAYOUT_MARGIN_Y, - UI_STYLE_FLOAT = UI_STYLE_FLOAT_X - | UI_STYLE_FLOAT_Y, + OC_UI_STYLE_FLOAT = OC_UI_STYLE_FLOAT_X + | OC_UI_STYLE_FLOAT_Y, - UI_STYLE_MASK_INHERITED = UI_STYLE_COLOR - | UI_STYLE_FONT - | UI_STYLE_FONT_SIZE - | UI_STYLE_ANIMATION_TIME - | UI_STYLE_ANIMATION_MASK, + OC_UI_STYLE_MASK_INHERITED = OC_UI_STYLE_COLOR + | OC_UI_STYLE_FONT + | OC_UI_STYLE_FONT_SIZE + | OC_UI_STYLE_ANIMATION_TIME + | OC_UI_STYLE_ANIMATION_MASK, }; -typedef struct ui_style +typedef struct oc_ui_style { - ui_box_size size; - ui_layout layout; - ui_box_floating floating; - vec2 floatTarget; - mg_color color; - mg_color bgColor; - mg_color borderColor; - mg_font font; + oc_ui_box_size size; + oc_ui_layout layout; + oc_ui_box_floating floating; + oc_vec2 floatTarget; + oc_color color; + oc_color bgColor; + oc_color borderColor; + oc_font font; f32 fontSize; f32 borderSize; f32 roundness; f32 animationTime; - ui_style_mask animationMask; -} ui_style; + oc_ui_style_mask animationMask; +} oc_ui_style; -typedef struct ui_tag { u64 hash; } ui_tag; +typedef struct oc_ui_tag { u64 hash; } oc_ui_tag; typedef enum { - UI_SEL_ANY, - UI_SEL_OWNER, - UI_SEL_TEXT, - UI_SEL_TAG, - UI_SEL_STATUS, - UI_SEL_KEY, + OC_UI_SEL_ANY, + OC_UI_SEL_OWNER, + OC_UI_SEL_TEXT, + OC_UI_SEL_TAG, + OC_UI_SEL_STATUS, + OC_UI_SEL_KEY, //... -} ui_selector_kind; +} oc_ui_selector_kind; -typedef u8 ui_status; +typedef u8 oc_ui_status; enum { - UI_NONE = 0, - UI_HOVER = 1<<1, - UI_ACTIVE = 1<<2, - UI_DRAGGING = 1<<3, + OC_UI_NONE = 0, + OC_UI_HOVER = 1<<1, + OC_UI_ACTIVE = 1<<2, + OC_UI_DRAGGING = 1<<3, }; typedef enum { - UI_SEL_DESCENDANT = 0, - UI_SEL_AND = 1, + OC_UI_SEL_DESCENDANT = 0, + OC_UI_SEL_AND = 1, //... -} ui_selector_op; +} oc_ui_selector_op; -typedef struct ui_selector +typedef struct oc_ui_selector { - list_elt listElt; - ui_selector_kind kind; - ui_selector_op op; + oc_list_elt listElt; + oc_ui_selector_kind kind; + oc_ui_selector_op op; union { - str8 text; - ui_key key; - ui_tag tag; - ui_status status; + oc_str8 text; + oc_ui_key key; + oc_ui_tag tag; + oc_ui_status status; //... }; -} ui_selector; +} oc_ui_selector; -typedef struct ui_pattern { list_info l; } ui_pattern; +typedef struct oc_ui_pattern { oc_list l; } oc_ui_pattern; -typedef struct ui_box ui_box; +typedef struct oc_ui_box oc_ui_box; -typedef struct ui_style_rule +typedef struct oc_ui_style_rule { - list_elt boxElt; - list_elt buildElt; - list_elt tmpElt; + oc_list_elt boxElt; + oc_list_elt buildElt; + oc_list_elt tmpElt; - ui_box* owner; - ui_pattern pattern; - ui_style_mask mask; - ui_style* style; -} ui_style_rule; + oc_ui_box* owner; + oc_ui_pattern pattern; + oc_ui_style_mask mask; + oc_ui_style* style; +} oc_ui_style_rule; -typedef struct ui_sig +typedef struct oc_ui_sig { - ui_box* box; + oc_ui_box* box; - vec2 mouse; - vec2 delta; - vec2 wheel; + oc_vec2 mouse; + oc_vec2 delta; + oc_vec2 wheel; bool pressed; bool released; @@ -245,70 +245,70 @@ typedef struct ui_sig bool dragging; bool hovering; -} ui_sig; +} oc_ui_sig; -typedef void(*ui_box_draw_proc)(ui_box* box, void* data); +typedef void(*oc_ui_box_draw_proc)(oc_ui_box* box, void* data); typedef enum { - UI_FLAG_CLICKABLE = (1<<0), - UI_FLAG_SCROLL_WHEEL_X = (1<<1), - UI_FLAG_SCROLL_WHEEL_Y = (1<<2), - UI_FLAG_BLOCK_MOUSE = (1<<3), - UI_FLAG_HOT_ANIMATION = (1<<4), - UI_FLAG_ACTIVE_ANIMATION = (1<<5), + OC_UI_FLAG_CLICKABLE = (1<<0), + OC_UI_FLAG_SCROLL_WHEEL_X = (1<<1), + OC_UI_FLAG_SCROLL_WHEEL_Y = (1<<2), + OC_UI_FLAG_BLOCK_MOUSE = (1<<3), + OC_UI_FLAG_HOT_ANIMATION = (1<<4), + OC_UI_FLAG_ACTIVE_ANIMATION = (1<<5), //WARN: these two following flags need to be kept as consecutive bits to // play well with axis-agnostic functions - UI_FLAG_ALLOW_OVERFLOW_X = (1<<6), - UI_FLAG_ALLOW_OVERFLOW_Y = (1<<7), - UI_FLAG_CLIP = (1<<8), - UI_FLAG_DRAW_BACKGROUND = (1<<9), - UI_FLAG_DRAW_FOREGROUND = (1<<10), - UI_FLAG_DRAW_BORDER = (1<<11), - UI_FLAG_DRAW_TEXT = (1<<12), - UI_FLAG_DRAW_PROC = (1<<13), + OC_UI_FLAG_ALLOW_OVERFLOW_X = (1<<6), + OC_UI_FLAG_ALLOW_OVERFLOW_Y = (1<<7), + OC_UI_FLAG_CLIP = (1<<8), + OC_UI_FLAG_DRAW_BACKGROUND = (1<<9), + OC_UI_FLAG_DRAW_FOREGROUND = (1<<10), + OC_UI_FLAG_DRAW_BORDER = (1<<11), + OC_UI_FLAG_DRAW_TEXT = (1<<12), + OC_UI_FLAG_DRAW_PROC = (1<<13), - UI_FLAG_OVERLAY = (1<<14), -} ui_flags; + OC_UI_FLAG_OVERLAY = (1<<14), +} oc_ui_flags; -struct ui_box +struct oc_ui_box { // hierarchy - list_elt listElt; - list_info children; - ui_box* parent; + oc_list_elt listElt; + oc_list children; + oc_ui_box* parent; - list_elt overlayElt; + oc_list_elt overlayElt; // keying and caching - list_elt bucketElt; - ui_key key; + oc_list_elt bucketElt; + oc_ui_key key; u64 frameCounter; // builder-provided info - ui_flags flags; - str8 string; - list_info tags; + oc_ui_flags flags; + oc_str8 string; + oc_list tags; - ui_box_draw_proc drawProc; + oc_ui_box_draw_proc drawProc; void* drawData; // styling - list_info beforeRules; - list_info afterRules; + oc_list beforeRules; + oc_list afterRules; - //ui_style_tag tag; - ui_style* targetStyle; - ui_style style; + //oc_ui_style_tag tag; + oc_ui_style* targetStyle; + oc_ui_style style; u32 z; - vec2 floatPos; + oc_vec2 floatPos; f32 childrenSum[2]; f32 spacing[2]; - mp_rect rect; + oc_rect rect; // signals - ui_sig* sig; + oc_ui_sig* sig; // stateful behaviour bool fresh; @@ -317,8 +317,8 @@ struct ui_box bool dragging; bool hot; bool active; - vec2 scroll; - vec2 pressedMouse; + oc_vec2 scroll; + oc_vec2 pressedMouse; // animation data f32 hotTransition; @@ -329,144 +329,144 @@ struct ui_box // context //----------------------------------------------------------------------------- -enum { UI_MAX_INPUT_CHAR_PER_FRAME = 64 }; +enum { OC_UI_MAX_INPUT_CHAR_PER_FRAME = 64 }; -typedef struct ui_input_text +typedef struct oc_ui_input_text { u8 count; - utf32 codePoints[UI_MAX_INPUT_CHAR_PER_FRAME]; + oc_utf32 codePoints[OC_UI_MAX_INPUT_CHAR_PER_FRAME]; -} ui_input_text; +} oc_ui_input_text; -typedef struct ui_stack_elt ui_stack_elt; -struct ui_stack_elt +typedef struct oc_ui_stack_elt oc_ui_stack_elt; +struct oc_ui_stack_elt { - ui_stack_elt* parent; + oc_ui_stack_elt* parent; union { - ui_box* box; - ui_size size; - mp_rect clip; + oc_ui_box* box; + oc_ui_size size; + oc_rect clip; }; }; -typedef struct ui_tag_elt +typedef struct oc_ui_tag_elt { - list_elt listElt; - ui_tag tag; -} ui_tag_elt; + oc_list_elt listElt; + oc_ui_tag tag; +} oc_ui_tag_elt; -enum { UI_BOX_MAP_BUCKET_COUNT = 1024 }; +enum { OC_UI_BOX_MAP_BUCKET_COUNT = 1024 }; -typedef struct ui_context +typedef struct oc_ui_context { bool init; - mp_input_state input; + oc_input_state input; u64 frameCounter; f64 frameTime; f64 lastFrameDuration; - mem_arena frameArena; - mem_pool boxPool; - list_info boxMap[UI_BOX_MAP_BUCKET_COUNT]; + oc_arena frameArena; + oc_pool boxPool; + oc_list boxMap[OC_UI_BOX_MAP_BUCKET_COUNT]; - ui_box* root; - ui_box* overlay; - list_info overlayList; - ui_stack_elt* boxStack; - ui_stack_elt* clipStack; + oc_ui_box* root; + oc_ui_box* overlay; + oc_list overlayList; + oc_ui_stack_elt* boxStack; + oc_ui_stack_elt* clipStack; - list_info nextBoxBeforeRules; - list_info nextBoxAfterRules; - list_info nextBoxTags; + oc_list nextBoxBeforeRules; + oc_list nextBoxAfterRules; + oc_list nextBoxTags; u32 z; - ui_box* hovered; + oc_ui_box* hovered; - ui_box* focus; + oc_ui_box* focus; i32 editCursor; i32 editMark; i32 editFirstDisplayedChar; f64 editCursorBlinkStart; -} ui_context; +} oc_ui_context; //------------------------------------------------------------------------------------- // UI context initialization and frame cycle //------------------------------------------------------------------------------------- -MP_API void ui_init(ui_context* context); -MP_API ui_context* ui_get_context(void); -MP_API void ui_set_context(ui_context* context); +ORCA_API void oc_ui_init(oc_ui_context* context); +ORCA_API oc_ui_context* oc_ui_get_context(void); +ORCA_API void oc_ui_set_context(oc_ui_context* context); -MP_API void ui_process_event(mp_event* event); -MP_API void ui_begin_frame(vec2 size, ui_style* defaultStyle, ui_style_mask mask); -MP_API void ui_end_frame(void); -MP_API void ui_draw(void); +ORCA_API void oc_ui_process_event(oc_event* event); +ORCA_API void oc_ui_begin_frame(oc_vec2 size, oc_ui_style* defaultStyle, oc_ui_style_mask mask); +ORCA_API void oc_ui_end_frame(void); +ORCA_API void oc_ui_draw(void); -#define ui_frame(size, style, mask) defer_loop(ui_begin_frame((size), (style), (mask)), ui_end_frame()) +#define oc_ui_frame(size, style, mask) oc_defer_loop(oc_ui_begin_frame((size), (style), (mask)), oc_ui_end_frame()) //------------------------------------------------------------------------------------- // Box keys //------------------------------------------------------------------------------------- -MP_API ui_key ui_key_make_str8(str8 string); -MP_API ui_key ui_key_make_path(str8_list path); +ORCA_API oc_ui_key oc_ui_key_make_str8(oc_str8 string); +ORCA_API oc_ui_key oc_ui_key_make_path(oc_str8_list path); -MP_API ui_box* ui_box_lookup_key(ui_key key); -MP_API ui_box* ui_box_lookup_str8(str8 string); +ORCA_API oc_ui_box* oc_ui_box_lookup_key(oc_ui_key key); +ORCA_API oc_ui_box* oc_ui_box_lookup_str8(oc_str8 string); // C-string helper -#define ui_key_make(s) ui_key_make_str8(STR8(s)) -#define ui_box_lookup(s) ui_box_lookup_str8(STR8(s)) +#define oc_ui_key_make(s) oc_ui_key_make_str8(OC_STR8(s)) +#define oc_ui_box_lookup(s) oc_ui_box_lookup_str8(OC_STR8(s)) //------------------------------------------------------------------------------------- // Box hierarchy building //------------------------------------------------------------------------------------- -MP_API ui_box* ui_box_make_str8(str8 string, ui_flags flags); -MP_API ui_box* ui_box_begin_str8(str8 string, ui_flags flags); +ORCA_API oc_ui_box* oc_ui_box_make_str8(oc_str8 string, oc_ui_flags flags); +ORCA_API oc_ui_box* oc_ui_box_begin_str8(oc_str8 string, oc_ui_flags flags); -MP_API ui_box* ui_box_end(void); -#define ui_container(name, flags) defer_loop(ui_box_begin(name, flags), ui_box_end()) -#define ui_container_str8(name, flags) defer_loop(ui_box_begin_str8(name, flags), ui_box_end()) +ORCA_API oc_ui_box* oc_ui_box_end(void); +#define oc_ui_container(name, flags) oc_defer_loop(oc_ui_box_begin(name, flags), oc_ui_box_end()) +#define oc_ui_container_str8(name, flags) oc_defer_loop(oc_ui_box_begin_str8(name, flags), oc_ui_box_end()) -MP_API void ui_box_push(ui_box* box); -MP_API void ui_box_pop(void); -MP_API ui_box* ui_box_top(void); +ORCA_API void oc_ui_box_push(oc_ui_box* box); +ORCA_API void oc_ui_box_pop(void); +ORCA_API oc_ui_box* oc_ui_box_top(void); -MP_API void ui_box_set_draw_proc(ui_box* box, ui_box_draw_proc proc, void* data); +ORCA_API void oc_ui_box_set_draw_proc(oc_ui_box* box, oc_ui_box_draw_proc proc, void* data); // C-string helpers -#define ui_box_lookup(s) ui_box_lookup_str8(STR8(s)) -#define ui_box_make(s, flags) ui_box_make_str8(STR8(s), flags) -#define ui_box_begin(s, flags) ui_box_begin_str8(STR8(s), flags) +#define oc_ui_box_lookup(s) oc_ui_box_lookup_str8(OC_STR8(s)) +#define oc_ui_box_make(s, flags) oc_ui_box_make_str8(OC_STR8(s), flags) +#define oc_ui_box_begin(s, flags) oc_ui_box_begin_str8(OC_STR8(s), flags) //------------------------------------------------------------------------------------- // Box status and signals //------------------------------------------------------------------------------------- -MP_API bool ui_box_closed(ui_box* box); -MP_API void ui_box_set_closed(ui_box* box, bool closed); +ORCA_API bool oc_ui_box_closed(oc_ui_box* box); +ORCA_API void oc_ui_box_set_closed(oc_ui_box* box, bool closed); -MP_API bool ui_box_active(ui_box* box); -MP_API void ui_box_activate(ui_box* box); -MP_API void ui_box_deactivate(ui_box* box); +ORCA_API bool oc_ui_box_active(oc_ui_box* box); +ORCA_API void oc_ui_box_activate(oc_ui_box* box); +ORCA_API void oc_ui_box_deactivate(oc_ui_box* box); -MP_API bool ui_box_hot(ui_box* box); -MP_API void ui_box_set_hot(ui_box* box, bool hot); +ORCA_API bool oc_ui_box_hot(oc_ui_box* box); +ORCA_API void oc_ui_box_set_hot(oc_ui_box* box, bool hot); -MP_API ui_sig ui_box_sig(ui_box* box); +ORCA_API oc_ui_sig oc_ui_box_sig(oc_ui_box* box); //------------------------------------------------------------------------------------- // Tagging //------------------------------------------------------------------------------------- -MP_API ui_tag ui_tag_make_str8(str8 string); -MP_API void ui_tag_box_str8(ui_box* box, str8 string); -MP_API void ui_tag_next_str8(str8 string); +ORCA_API oc_ui_tag oc_ui_tag_make_str8(oc_str8 string); +ORCA_API void oc_ui_tag_box_str8(oc_ui_box* box, oc_str8 string); +ORCA_API void oc_ui_tag_next_str8(oc_str8 string); // C-string helpers -#define ui_tag_make(s) ui_tag_make_str8(STR8(s)) -#define ui_tag_box(b, s) ui_tag_box_str8(b, STR8(s)) -#define ui_tag_next(s) ui_tag_next_str8(STR8(s)) +#define oc_ui_tag_make(s) oc_ui_tag_make_str8(OC_STR8(s)) +#define oc_ui_tag_box(b, s) oc_ui_tag_box_str8(b, OC_STR8(s)) +#define oc_ui_tag_next(s) oc_ui_tag_next_str8(OC_STR8(s)) //------------------------------------------------------------------------------------- // Styling @@ -474,74 +474,74 @@ MP_API void ui_tag_next_str8(str8 string); //NOTE: styling API //WARN: You can use a pattern in multiple rules, but be aware that a pattern is references an underlying list of selectors, // hence pushing to a pattern also modifies rules in which the pattern was previously used! -MP_API void ui_apply_style_with_mask(ui_style* dst, ui_style* src, ui_style_mask mask); +ORCA_API void oc_ui_apply_style_with_mask(oc_ui_style* dst, oc_ui_style* src, oc_ui_style_mask mask); -MP_API void ui_pattern_push(mem_arena* arena, ui_pattern* pattern, ui_selector selector); -MP_API ui_pattern ui_pattern_all(void); -MP_API ui_pattern ui_pattern_owner(void); +ORCA_API void oc_ui_pattern_push(oc_arena* arena, oc_ui_pattern* pattern, oc_ui_selector selector); +ORCA_API oc_ui_pattern oc_ui_pattern_all(void); +ORCA_API oc_ui_pattern oc_ui_pattern_owner(void); -MP_API void ui_style_next(ui_style* style, ui_style_mask mask); -MP_API void ui_style_match_before(ui_pattern pattern, ui_style* style, ui_style_mask mask); -MP_API void ui_style_match_after(ui_pattern pattern, ui_style* style, ui_style_mask mask); +ORCA_API void oc_ui_style_next(oc_ui_style* style, oc_ui_style_mask mask); +ORCA_API void oc_ui_style_match_before(oc_ui_pattern pattern, oc_ui_style* style, oc_ui_style_mask mask); +ORCA_API void oc_ui_style_match_after(oc_ui_pattern pattern, oc_ui_style* style, oc_ui_style_mask mask); //------------------------------------------------------------------------- // Basic widget helpers //------------------------------------------------------------------------- enum { - UI_STYLE_TAG_USER_MAX = 1<<16, - UI_STYLE_TAG_LABEL, - UI_STYLE_TAG_BUTTON, - UI_STYLE_TAG_SCROLLBAR, - UI_STYLE_TAG_PANEL, - UI_STYLE_TAG_TOOLTIP, - UI_STYLE_TAG_MENU + OC_UI_STYLE_TAG_USER_MAX = 1<<16, + OC_UI_STYLE_TAG_LABEL, + OC_UI_STYLE_TAG_BUTTON, + OC_UI_STYLE_TAG_SCROLLBAR, + OC_UI_STYLE_TAG_PANEL, + OC_UI_STYLE_TAG_TOOLTIP, + OC_UI_STYLE_TAG_MENU }; -MP_API ui_sig ui_label(const char* label); -MP_API ui_sig ui_label_str8(str8 label); +ORCA_API oc_ui_sig oc_ui_label(const char* label); +ORCA_API oc_ui_sig oc_ui_label_str8(oc_str8 label); -MP_API ui_sig ui_button(const char* label); -MP_API ui_sig ui_checkbox(const char* name, bool* checked); -MP_API ui_box* ui_slider(const char* label, f32 thumbRatio, f32* scrollValue); +ORCA_API oc_ui_sig oc_ui_button(const char* label); +ORCA_API oc_ui_sig oc_ui_checkbox(const char* name, bool* checked); +ORCA_API oc_ui_box* oc_ui_slider(const char* label, f32 thumbRatio, f32* scrollValue); -MP_API void ui_panel_begin(const char* name, ui_flags flags); -MP_API void ui_panel_end(void); -#define ui_panel(s, f) defer_loop(ui_panel_begin(s, f), ui_panel_end()) +ORCA_API void oc_ui_panel_begin(const char* name, oc_ui_flags flags); +ORCA_API void oc_ui_panel_end(void); +#define oc_ui_panel(s, f) oc_defer_loop(oc_ui_panel_begin(s, f), oc_ui_panel_end()) -MP_API ui_sig ui_tooltip_begin(const char* name); -MP_API void ui_tooltip_end(void); -#define ui_tooltip(name) defer_loop(ui_tooltip_begin(name), ui_tooltip_end()) +ORCA_API oc_ui_sig oc_ui_tooltip_begin(const char* name); +ORCA_API void oc_ui_tooltip_end(void); +#define oc_ui_tooltip(name) oc_defer_loop(oc_ui_tooltip_begin(name), oc_ui_tooltip_end()) -MP_API void ui_menu_bar_begin(const char* label); -MP_API void ui_menu_bar_end(void); -#define ui_menu_bar(name) defer_loop(ui_menu_bar_begin(name), ui_menu_bar_end()) +ORCA_API void oc_ui_menu_bar_begin(const char* label); +ORCA_API void oc_ui_menu_bar_end(void); +#define oc_ui_menu_bar(name) oc_defer_loop(oc_ui_menu_bar_begin(name), oc_ui_menu_bar_end()) -MP_API void ui_menu_begin(const char* label); -MP_API void ui_menu_end(void); -#define ui_menu(name) defer_loop(ui_menu_begin(name), ui_menu_end()) +ORCA_API void oc_ui_menu_begin(const char* label); +ORCA_API void oc_ui_menu_end(void); +#define oc_ui_menu(name) oc_defer_loop(oc_ui_menu_begin(name), oc_ui_menu_end()) -MP_API ui_sig ui_menu_button(const char* name); +ORCA_API oc_ui_sig oc_ui_menu_button(const char* name); -typedef struct ui_text_box_result +typedef struct oc_ui_text_box_result { bool changed; bool accepted; - str8 text; + oc_str8 text; -}ui_text_box_result; +}oc_ui_text_box_result; -MP_API ui_text_box_result ui_text_box(const char* name, mem_arena* arena, str8 text); +ORCA_API oc_ui_text_box_result oc_ui_text_box(const char* name, oc_arena* arena, oc_str8 text); -typedef struct ui_select_popup_info +typedef struct oc_ui_select_popup_info { bool changed; int selectedIndex; int optionCount; - str8* options; -} ui_select_popup_info; + oc_str8* options; +} oc_ui_select_popup_info; -MP_API ui_select_popup_info ui_select_popup(const char* name, ui_select_popup_info* info); +ORCA_API oc_ui_select_popup_info oc_ui_select_popup(const char* name, oc_ui_select_popup_info* info); #ifdef __cplusplus } // extern "C" diff --git a/src/util/algebra.c b/src/util/algebra.c new file mode 100644 index 0000000..2afe1e4 --- /dev/null +++ b/src/util/algebra.c @@ -0,0 +1,55 @@ +/************************************************************//** +* +* @file: algebra.c +* @author: Martin Fouilleul +* @date: 15/08/2023 +* +*****************************************************************/ +#include"algebra.h" + +bool oc_vec2_equal(oc_vec2 v0, oc_vec2 v1) +{ + return(v0.x == v1.x && v0.y == v1.y); +} + +oc_vec2 oc_vec2_mul(f32 f, oc_vec2 v) +{ + return((oc_vec2){f*v.x, f*v.y}); +} + +oc_vec2 oc_vec2_add(oc_vec2 v0, oc_vec2 v1) +{ + return((oc_vec2){v0.x + v1.x, v0.y + v1.y}); +} + +oc_mat2x3 oc_mat2x3_mul_m(oc_mat2x3 lhs, oc_mat2x3 rhs) +{ + oc_mat2x3 res; + res.m[0] = lhs.m[0]*rhs.m[0] + lhs.m[1]*rhs.m[3]; + res.m[1] = lhs.m[0]*rhs.m[1] + lhs.m[1]*rhs.m[4]; + res.m[2] = lhs.m[0]*rhs.m[2] + lhs.m[1]*rhs.m[5] + lhs.m[2]; + res.m[3] = lhs.m[3]*rhs.m[0] + lhs.m[4]*rhs.m[3]; + res.m[4] = lhs.m[3]*rhs.m[1] + lhs.m[4]*rhs.m[4]; + res.m[5] = lhs.m[3]*rhs.m[2] + lhs.m[4]*rhs.m[5] + lhs.m[5]; + + return(res); +} + +oc_mat2x3 oc_mat2x3_inv(oc_mat2x3 x) +{ + oc_mat2x3 res; + res.m[0] = x.m[4]/(x.m[0]*x.m[4] - x.m[1]*x.m[3]); + res.m[1] = x.m[1]/(x.m[1]*x.m[3] - x.m[0]*x.m[4]); + res.m[3] = x.m[3]/(x.m[1]*x.m[3] - x.m[0]*x.m[4]); + res.m[4] = x.m[0]/(x.m[0]*x.m[4] - x.m[1]*x.m[3]); + res.m[2] = -(x.m[2]*res.m[0] + x.m[5]*res.m[1]); + res.m[5] = -(x.m[2]*res.m[3] + x.m[5]*res.m[4]); + return(res); +} + +oc_vec2 oc_mat2x3_mul(oc_mat2x3 m, oc_vec2 p) +{ + f32 x = p.x*m.m[0] + p.y*m.m[1] + m.m[2]; + f32 y = p.x*m.m[3] + p.y*m.m[4] + m.m[5]; + return((oc_vec2){x, y}); +} diff --git a/src/util/algebra.h b/src/util/algebra.h new file mode 100644 index 0000000..9edc283 --- /dev/null +++ b/src/util/algebra.h @@ -0,0 +1,23 @@ +/************************************************************//** +* +* @file: algebra.h +* @author: Martin Fouilleul +* @date: 15/08/2023 +* +*****************************************************************/ +#ifndef __ALGEBRA_H_ +#define __ALGEBRA_H_ + +#include"typedefs.h" + +bool oc_vec2_equal(oc_vec2 v0, oc_vec2 v1); +oc_vec2 oc_vec2_mul(f32 f, oc_vec2 v); +oc_vec2 oc_vec2_add(oc_vec2 v0, oc_vec2 v1); + +oc_vec2 oc_mat2x3_mul(oc_mat2x3 m, oc_vec2 p); +oc_mat2x3 oc_mat2x3_mul_m(oc_mat2x3 lhs, oc_mat2x3 rhs); +oc_mat2x3 oc_mat2x3_inv(oc_mat2x3 x); + +//TODO: complete + +#endif //__ALGEBRA_H_ diff --git a/src/util/atomic.h b/src/util/atomic.h deleted file mode 100644 index e2bd9f9..0000000 --- a/src/util/atomic.h +++ /dev/null @@ -1,22 +0,0 @@ -//***************************************************************** -// -// $file: atomic.h $ -// $author: Martin Fouilleul $ -// $date: 22/12/2022 $ -// $revision: $ -// $note: (C) 2022 by Martin Fouilleul - all rights reserved $ -// -//***************************************************************** -#ifndef __ATOMIC_H_ -#define __ATOMIC_H_ - -#include"platform/platform.h" - -#if (defined(COMPILER_CL) || defined(COMPILER_CLANG_CL)) && defined(__STDC_NO_ATOMICS__) - #define _Atomic(t) volatile t - //TODO -#else - #include -#endif - -#endif //__ATOMIC_H_ diff --git a/src/util/debug.h b/src/util/debug.h index 847fe2b..5bca2ed 100644 --- a/src/util/debug.h +++ b/src/util/debug.h @@ -9,58 +9,54 @@ #define __DEBUG_H_ #include"platform/platform_debug.h" -#include"util/macro_helpers.h" +#include"util/macros.h" //---------------------------------------------------------------- // Logging //---------------------------------------------------------------- -#define log_generic(level, msg, ...) log_push(level, __FUNCTION__, __FILE__, __LINE__, msg, ##__VA_ARGS__) +#define oc_log_generic(level, msg, ...) oc_log_ext(level, __FUNCTION__, __FILE__, __LINE__, msg, ##__VA_ARGS__) -#define log_error(msg, ...) log_generic(LOG_LEVEL_ERROR, msg, ##__VA_ARGS__) +#define oc_log_error(msg, ...) oc_log_generic(OC_LOG_LEVEL_ERROR, msg, ##__VA_ARGS__) -#ifndef LOG_COMPILE_WARNING - #define LOG_COMPILE_WARNING 1 +#ifndef OC_LOG_COMPILE_WARNING + #define OC_LOG_COMPILE_WARNING 1 #endif -#ifndef LOG_COMPILE_INFO - #define LOG_COMPILE_INFO 1 +#ifndef OC_LOG_COMPILE_INFO + #define OC_LOG_COMPILE_INFO 1 #endif -#if LOG_COMPILE_WARNING || LOG_COMPILE_INFO - #define log_warning(msg, ...) log_generic(LOG_LEVEL_WARNING, msg, ##__VA_ARGS__) +#if OC_LOG_COMPILE_WARNING || OC_LOG_COMPILE_INFO + #define oc_log_warning(msg, ...) oc_log_generic(OC_LOG_LEVEL_WARNING, msg, ##__VA_ARGS__) - #if LOG_COMPILE_INFO - #define log_info(msg, ...) log_generic(LOG_LEVEL_INFO, msg, ##__VA_ARGS__ ) + #if OC_LOG_COMPILE_INFO + #define oc_log_info(msg, ...) oc_log_generic(OC_LOG_LEVEL_INFO, msg, ##__VA_ARGS__ ) #else - #define log_info(msg, ...) + #define oc_log_info(msg, ...) #endif #else - #define log_warning(msg, ...) - #define log_info(msg, ...) + #define oc_log_warning(msg, ...) + #define oc_log_info(msg, ...) #endif //---------------------------------------------------------------- // Abort/Assert //---------------------------------------------------------------- -#define ORCA_ABORT(fmt, ...) orca_abort(__FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) +#define OC_ABORT(fmt, ...) oc_abort_ext(__FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__) -#define _ORCA_ASSERT_(test, fmt, ...) ((test) || (orca_assert_fail(__FILE__, __FUNCTION__, __LINE__, #test, fmt, ##__VA_ARGS__), 0)) -#define ORCA_ASSERT(test, ...) _ORCA_ASSERT_(test, ORCA_VA_NOPT("", ##__VA_ARGS__) ORCA_ARG1(__VA_ARGS__) ORCA_VA_COMMA_TAIL(__VA_ARGS__)) - - -#ifndef NO_ASSERT - - #define ASSERT(x, ...) ORCA_ASSERT(x, #__VA_ARGS__) - - #ifdef DEBUG - #define DEBUG_ASSERT(x, ...) ASSERT(x, ##__VA_ARGS__ ) - #else - #define DEBUG_ASSERT(x, ...) - #endif +#ifdef OC_NO_ASSERT + #define OC_ASSERT(x, ...) + #define OC_DEBUG_ASSERT(x, ...) #else - #define ASSERT(x, ...) - #define DEBUG_ASSERT(x, ...) + #define _OC_ASSERT_(test, fmt, ...) ((test) || (oc_assert_fail(__FILE__, __FUNCTION__, __LINE__, #test, fmt, ##__VA_ARGS__), 0)) + #define OC_ASSERT(test, ...) _OC_ASSERT_(test, OC_VA_NOPT("", ##__VA_ARGS__) OC_ARG1(__VA_ARGS__) OC_VA_COMMA_TAIL(__VA_ARGS__)) + + #ifdef OC_DEBUG + #define OC_DEBUG_ASSERT(x, ...) OC_ASSERT(x, ##__VA_ARGS__ ) + #else + #define OC_DEBUG_ASSERT(x, ...) + #endif #endif diff --git a/src/util/hash.c b/src/util/hash.c index d60493d..d2d526f 100644 --- a/src/util/hash.c +++ b/src/util/hash.c @@ -9,10 +9,10 @@ #include"hash.h" #include"platform/platform.h" -#if ARCH_X64 +#if OC_ARCH_X64 #include -u64 mp_hash_aes_u64(u64 x) +u64 oc_hash_aes_u64(u64 x) { u8 seed[16] = { 0xaa, 0x9b, 0xbd, 0xb8, @@ -29,7 +29,7 @@ u64 mp_hash_aes_u64(u64 x) return(result); } -u64 mp_hash_aes_u64_x2(u64 x, u64 y) +u64 oc_hash_aes_u64_x2(u64 x, u64 y) { u8 seed[16] = { 0xaa, 0x9b, 0xbd, 0xb8, @@ -46,7 +46,7 @@ u64 mp_hash_aes_u64_x2(u64 x, u64 y) return(result); } -u64 mp_hash_aes_string(str8 string) +u64 oc_hash_aes_string(oc_str8 string) { u8 seed[16] = { 0xaa, 0x9b, 0xbd, 0xb8, @@ -87,7 +87,7 @@ u64 mp_hash_aes_string(str8 string) return(result); } -u64 mp_hash_aes_string_seed(str8 string, u64 seed) +u64 oc_hash_aes_string_seed(oc_str8 string, u64 seed) { u8 seed16[16]; memcpy(seed16, &seed, 8); @@ -125,10 +125,10 @@ u64 mp_hash_aes_string_seed(str8 string, u64 seed) u64 result = _mm_extract_epi64(hash, 0); return(result); } -#endif // ARCH_X64 +#endif // OC_ARCH_X64 //xxhash64, copy-pasted from https://github.com/demetri/scribbles/blob/master/hashing/hash_functions.c -// Thanks Demetri +// Thanks to Demetri Spanos uint64_t xxh_64 (const void *key, int len, uint64_t h) { // primes used in mul-rot updates @@ -184,12 +184,12 @@ uint64_t xxh_64 (const void *key, int len, uint64_t h) { return (s64 ^ (s64 >> 32)); } -u64 mp_hash_xx64_string_seed(str8 string, u64 seed) +u64 oc_hash_xx64_string_seed(oc_str8 string, u64 seed) { return(xxh_64(string.ptr, string.len, seed)); } -u64 mp_hash_xx64_string(str8 string) +u64 oc_hash_xx64_string(oc_str8 string) { return(xxh_64(string.ptr, string.len, 0)); } diff --git a/src/util/hash.h b/src/util/hash.h index ee90906..c11800e 100644 --- a/src/util/hash.h +++ b/src/util/hash.h @@ -16,13 +16,13 @@ extern "C" { #endif -MP_API u64 mp_hash_aes_u64(u64 x); -MP_API u64 mp_hash_aes_u64_x2(u64 x, u64 y); -MP_API u64 mp_hash_aes_string(str8 string); -MP_API u64 mp_hash_aes_string_seed(str8 string, u64 seed); +ORCA_API u64 oc_hash_aes_u64(u64 x); +ORCA_API u64 oc_hash_aes_u64_x2(u64 x, u64 y); +ORCA_API u64 oc_hash_aes_string(oc_str8 string); +ORCA_API u64 oc_hash_aes_string_seed(oc_str8 string, u64 seed); -MP_API u64 mp_hash_xx64_string_seed(str8 string, u64 seed); -MP_API u64 mp_hash_xx64_string(str8 string); +ORCA_API u64 oc_hash_xx64_string_seed(oc_str8 string, u64 seed); +ORCA_API u64 oc_hash_xx64_string(oc_str8 string); #ifdef __cplusplus diff --git a/src/util/lists.h b/src/util/lists.h index be5e47a..f02c26c 100644 --- a/src/util/lists.h +++ b/src/util/lists.h @@ -9,100 +9,90 @@ #ifndef __CONTAINERS_H_ #define __CONTAINERS_H_ -#include"util/macro_helpers.h" +#include"util/macros.h" #include"platform/platform_debug.h" #ifdef __cplusplus extern "C" { #endif -#define OFFSET_OF_CONTAINER(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) - -#ifdef __cplusplus - #define CONTAINER_OF(ptr, type, member) ({ \ - const decltype( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - OFFSET_OF_CONTAINER(type,member) );}) -#else - #define CONTAINER_OF(ptr, type, member) (type *)((char*)(ptr) - OFFSET_OF_CONTAINER(type,member)) -#endif - //------------------------------------------------------------------------- // Intrusive linked lists //------------------------------------------------------------------------- -#define list_entry(ptr, type, member) \ - CONTAINER_OF(ptr, type, member) +#define oc_list_entry(ptr, type, member) \ + oc_container_of(ptr, type, member) -#define list_next(elt) (elt)->next -#define list_prev(elt) (elt)->prev +#define oc_list_next(elt) (elt)->next +#define oc_list_prev(elt) (elt)->prev -#define list_next_entry(list, elt, type, member) \ - ((elt->member.next != list_end(list)) ? list_entry(elt->member.next, type, member) : 0) +#define oc_list_next_entry(list, elt, type, member) \ + ((elt->member.next != oc_list_end(list)) ? oc_list_entry(elt->member.next, type, member) : 0) -#define list_prev_entry(list, elt, type, member) \ - ((elt->member.prev != list_end(list)) ? list_entry(elt->member.prev, type, member) : 0) +#define oc_list_prev_entry(list, elt, type, member) \ + ((elt->member.prev != oc_list_end(list)) ? oc_list_entry(elt->member.prev, type, member) : 0) -#define list_checked_entry(list, type, member) \ - (((list) != 0) ? list_entry(list, type, member) : 0) +#define oc_list_checked_entry(list, type, member) \ + (((list) != 0) ? oc_list_entry(list, type, member) : 0) -#define list_first_entry(list, type, member) \ - (list_checked_entry(list_begin(list), type, member)) +#define oc_list_first_entry(list, type, member) \ + (oc_list_checked_entry(oc_list_begin(list), type, member)) -#define list_last_entry(list, type, member) \ - (list_checked_entry(list_last(list), type, member)) +#define oc_list_last_entry(list, type, member) \ + (oc_list_checked_entry(oc_list_last(list), type, member)) -#define for_list(list, elt, type, member) \ - for(type* elt = list_checked_entry(list_begin(list), type, member); \ +#define oc_list_for(list, elt, type, member) \ + for(type* elt = oc_list_checked_entry(oc_list_begin(list), type, member); \ elt != 0; \ - elt = list_checked_entry(elt->member.next, type, member)) \ + elt = oc_list_checked_entry(elt->member.next, type, member)) \ -#define for_list_reverse(list, elt, type, member) \ - for(type* elt = list_checked_entry(list_last(list), type, member); \ +#define oc_list_for_reverse(list, elt, type, member) \ + for(type* elt = oc_list_checked_entry(oc_list_last(list), type, member); \ elt != 0; \ - elt = list_checked_entry(elt->member.prev, type, member)) \ + elt = oc_list_checked_entry(elt->member.prev, type, member)) \ -#define for_list_safe(list, elt, type, member) \ - for(type* elt = list_checked_entry(list_begin(list), type, member), \ - *__tmp = elt ? list_checked_entry(elt->member.next, type, member) : 0 ; \ +#define oc_list_for_safe(list, elt, type, member) \ + for(type* elt = oc_list_checked_entry(oc_list_begin(list), type, member), \ + *__tmp = elt ? oc_list_checked_entry(elt->member.next, type, member) : 0 ; \ elt != 0; \ elt = __tmp, \ - __tmp = elt ? list_checked_entry(elt->member.next, type, member) : 0) \ + __tmp = elt ? oc_list_checked_entry(elt->member.next, type, member) : 0) \ -#define list_pop_entry(list, type, member) (list_empty(list) ? 0 : list_entry(list_pop(list), type, member)) +#define oc_list_pop_entry(list, type, member) (oc_list_empty(list) ? 0 : oc_list_entry(oc_list_pop(list), type, member)) -typedef struct list_elt list_elt; -struct list_elt +typedef struct oc_list_elt oc_list_elt; +struct oc_list_elt { - list_elt* next; - list_elt* prev; + oc_list_elt* next; + oc_list_elt* prev; }; -typedef struct list_info +typedef struct oc_list { - list_elt* first; - list_elt* last; -} list_info; + oc_list_elt* first; + oc_list_elt* last; +} oc_list; -static inline void list_init(list_info* list) +static inline void oc_list_init(oc_list* list) { list->first = list->last = 0; } -static inline list_elt* list_begin(list_info* list) +static inline oc_list_elt* oc_list_begin(oc_list* list) { return(list->first); } -static inline list_elt* list_end(list_info* list) +static inline oc_list_elt* oc_list_end(oc_list* list) { return(0); } -static inline list_elt* list_last(list_info* list) +static inline oc_list_elt* oc_list_last(oc_list* list) { return(list->last); } -static inline void list_insert(list_info* list, list_elt* afterElt, list_elt* elt) +static inline void oc_list_insert(oc_list* list, oc_list_elt* afterElt, oc_list_elt* elt) { elt->prev = afterElt; elt->next = afterElt->next; @@ -116,10 +106,10 @@ static inline void list_insert(list_info* list, list_elt* afterElt, list_elt* el } afterElt->next = elt; - DEBUG_ASSERT(elt->next != elt, "list_insert(): can't insert an element into itself"); + OC_DEBUG_ASSERT(elt->next != elt, "oc_list_insert(): can't insert an element into itself"); } -static inline void list_insert_before(list_info* list, list_elt* beforeElt, list_elt* elt) +static inline void oc_list_insert_before(oc_list* list, oc_list_elt* beforeElt, oc_list_elt* elt) { elt->next = beforeElt; elt->prev = beforeElt->prev; @@ -134,10 +124,10 @@ static inline void list_insert_before(list_info* list, list_elt* beforeElt, list } beforeElt->prev = elt; - DEBUG_ASSERT(elt->next != elt, "list_insert_before(): can't insert an element into itself"); + OC_DEBUG_ASSERT(elt->next != elt, "oc_list_insert_before(): can't insert an element into itself"); } -static inline void list_remove(list_info* list, list_elt* elt) +static inline void oc_list_remove(oc_list* list, oc_list_elt* elt) { if(elt->prev) { @@ -145,7 +135,7 @@ static inline void list_remove(list_info* list, list_elt* elt) } else { - DEBUG_ASSERT(list->first == elt); + OC_DEBUG_ASSERT(list->first == elt); list->first = elt->next; } if(elt->next) @@ -154,13 +144,13 @@ static inline void list_remove(list_info* list, list_elt* elt) } else { - DEBUG_ASSERT(list->last == elt); + OC_DEBUG_ASSERT(list->last == elt); list->last = elt->prev; } elt->prev = elt->next = 0; } -static inline void list_push(list_info* list, list_elt* elt) +static inline void oc_list_push(oc_list* list, oc_list_elt* elt) { elt->next = list->first; elt->prev = 0; @@ -175,12 +165,12 @@ static inline void list_push(list_info* list, list_elt* elt) list->first = elt; } -static inline list_elt* list_pop(list_info* list) +static inline oc_list_elt* oc_list_pop(oc_list* list) { - list_elt* elt = list_begin(list); - if(elt != list_end(list)) + oc_list_elt* elt = oc_list_begin(list); + if(elt != oc_list_end(list)) { - list_remove(list, elt); + oc_list_remove(list, elt); return(elt); } else @@ -189,7 +179,7 @@ static inline list_elt* list_pop(list_info* list) } } -static inline void list_push_back(list_info* list, list_elt* elt) +static inline void oc_list_push_back(oc_list* list, oc_list_elt* elt) { elt->prev = list->last; elt->next = 0; @@ -203,15 +193,15 @@ static inline void list_push_back(list_info* list, list_elt* elt) } list->last = elt; } -#define list_append(a, b) list_push_back(a, b) +#define oc_list_append(a, b) oc_list_push_back(a, b) -static inline list_elt* list_pop_back(list_info* list) +static inline oc_list_elt* oc_list_pop_back(oc_list* list) { - list_elt* elt = list_last(list); - if(elt != list_end(list)) + oc_list_elt* elt = oc_list_last(list); + if(elt != oc_list_end(list)) { - list_remove(list, elt); + oc_list_remove(list, elt); return(elt); } else @@ -220,167 +210,11 @@ static inline list_elt* list_pop_back(list_info* list) } } -static inline bool list_empty(list_info* list) +static inline bool oc_list_empty(oc_list* list) { return(list->first == 0 || list->last == 0); } - -//------------------------------------------------------------------------- -// Circular Intrusive linked lists -//------------------------------------------------------------------------- - -#define clist_entry(ptr, type, member) list_entry(ptr, type, member) -#define clist_next(elt) list_next(elt) -#define clist_prev(elt) list_prev(elt) - -#define clist_next_entry(head, elt, type, member) \ - ((elt->member.next != clist_end(head)) ? clist_entry(elt->member.next, type, member) : 0) - -#define clist_prev_entry(head, elt, type, member) \ - ((elt->member.prev != clist_end(head)) ? clist_entry(elt->member.prev, type, member) : 0) - -#define clist_checked_entry(head, info, type, member) \ - ((info != clist_end(head)) ? clist_entry(info, type, member) : 0) - -#define clist_first_entry(head, type, member) \ - (clist_checked_entry(head, clist_begin(head), type, member)) - -#define clist_last_entry(head, type, member) \ - (clist_checked_entry(head, clist_last(head), type, member)) - -#define for_clist(list, elt, type, member) \ - for(type* elt = clist_entry(clist_begin(list), type, member); \ - &elt->member != clist_end(list); \ - elt = clist_entry(elt->member.next, type, member)) \ - - -#define for_clist_reverse(list, elt, type, member) \ - for(type* elt = clist_entry(clist_last(list), type, member); \ - &elt->member != clist_end(list); \ - elt = clist_entry(elt->member.prev, type, member)) \ - - -#define for_clist_safe(list, elt, type, member) \ - for(type* elt = clist_entry(clist_begin(list), type, member), \ - *__tmp = clist_entry(elt->member.next, type, member); \ - &elt->member != clist_end(list); \ - elt = clist_entry(&__tmp->member, type, member), \ - __tmp = clist_entry(elt->member.next, type, member)) \ - - -#define clist_push(a, b) clist_insert(a, b) -#define clist_insert_before(a, b) clist_append(a, b) - -#define clist_pop_entry(list, type, member) (clist_empty(list) ? 0 : clist_entry(clist_pop(list), type, member)) - -static inline void clist_init(list_elt* info) -{ - info->next = info->prev = info; -} - -static inline list_elt* clist_begin(list_elt* head) -{ - return(head->next ? head->next : head ); -} -static inline list_elt* clist_end(list_elt* head) -{ - return(head); -} - -static inline list_elt* clist_last(list_elt* head) -{ - return(head->prev ? head->prev : head); -} - -static inline void clist_insert(list_elt* head, list_elt* elt) -{ - elt->prev = head; - elt->next = head->next; - if(head->next) - { - head->next->prev = elt; - } - else - { - head->prev = elt; - } - head->next = elt; - - ASSERT(elt->next != elt, "clist_insert(): can't insert an element into itself"); -} - -static inline void clist_append(list_elt* head, list_elt* elt) -{ - clist_insert(head->prev, elt); -} - -static inline void clist_cat(list_elt* head, list_elt* list) -{ - if(head->prev) - { - head->prev->next = list->next; - } - if(head->prev && head->prev->next) - { - head->prev->next->prev = head->prev; - } - head->prev = list->prev; - if(head->prev) - { - head->prev->next = head; - } - clist_init(list); -} - -static inline void clist_remove(list_elt* elt) -{ - if(elt->prev) - { - elt->prev->next = elt->next; - } - if(elt->next) - { - elt->next->prev = elt->prev; - } - elt->prev = elt->next = 0; -} - -static inline list_elt* clist_pop(list_elt* head) -{ - list_elt* it = clist_begin(head); - if(it != clist_end(head)) - { - clist_remove(it); - return(it); - } - else - { - return(0); - } - -} - -static inline list_elt* clist_pop_back(list_elt* head) -{ - list_elt* it = clist_last(head); - if(it != clist_end(head)) - { - clist_remove(it); - return(it); - } - else - { - return(0); - } -} - -static inline bool clist_empty(list_elt* head) -{ - return(head->next == 0 || head->next == head); -} - - #ifdef __cplusplus } // extern "C" #endif diff --git a/src/util/macro_helpers.h b/src/util/macro_helpers.h deleted file mode 100644 index 1184f87..0000000 --- a/src/util/macro_helpers.h +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************//** -* -* @file: macro_helpers.h -* @author: Martin Fouilleul -* @date: 27/03/2020 -* @revision: -* -*****************************************************************/ -#ifndef __MACRO_HELPERS_H_ -#define __MACRO_HELPERS_H_ - -#include"util/typedefs.h" -#include"platform/platform.h" - -//NOTE(martin): macro concatenation -#define _cat2_(a, b) a##b -#define _cat3_(a, b, c) a##b##c - -//NOTE(martin): inline, but still generate code -// (eg. use the inline version inside a library, but still exports the function for client code) -//TODO(martin): this is a compiler-specific attribute, recognized by clang and gcc. See if there's a more portable approach -//#define INLINE_GEN __attribute__((used)) static inline - -//NOTE(martin): 'hygienic' templates, to replace macros and avoid multiple evaluation problems. -#ifdef __cplusplus - //NOTE(martin): in C++ we use templates and decltype/declval - // (overloaded functions would be ambiguous because of the - // overload resolution and conversion/promotion rules) - - #include - - template - inline decltype(std::declval()+std::declval()) minimum_safe(Ta a, Tb b) - { - return(a < b ? a : b); - } - - template - inline decltype(std::declval()+std::declval()) maximum_safe(Ta a, Tb b) - { - return(a > b ? a : b); - } - - template - inline T square_safe(T a) {return(a*a);} - - template - inline T cube_safe(T a) {return(a*a*a);} - -#else // (__cplusplus not defined) - - //NOTE(martin): Type generic arithmetic functions helpers - // this macros helps generate variants of a generic 'template' for all arithmetic types. - // the def parameter must be a macro that take a type, and optional arguments - #define tga_generate_variants(def, ...) \ - def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__ ) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \ - def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \ - def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__) - - // This macro generates one _Generic association between a type and its variant - #define tga_variant_association(type, name) , type: _cat3_(name, _, type) - - // This macros selects the appropriate variant for a 2 parameters functions - #define tga_select_binary(name, a, b) \ - _Generic((a+b) tga_generate_variants(tga_variant_association, name))(a, b) - - // This macros selects the appropriate variant for a 1 parameters functions - #define tga_select_unary(name, a) \ - _Generic((a) tga_generate_variants(tga_variant_association, name))(a) - - //NOTE(martin): type generic templates - #define minimum_def(type) static inline type _cat3_(minimum_safe, _, type)(type a, type b) {return(a < b ? a : b);} - #define maximum_def(type) static inline type _cat3_(maximum_safe, _, type)(type a, type b) {return(a > b ? a : b);} - #define square_def(type) static inline type _cat3_(square_safe, _, type)(type a) {return(a*a);} - #define cube_def(type) static inline type _cat3_(cube_safe, _, type)(type a) {return(a*a*a);} - - //NOTE(martin): instantiante our templates for all arithmetic types - tga_generate_variants(minimum_def) - tga_generate_variants(maximum_def) - tga_generate_variants(square_def) - tga_generate_variants(cube_def) - - //NOTE(martin): generate the _Generic associations between each type and its associated variant - #define minimum_safe(a, b) tga_select_binary(minimum_safe, a, b) - #define maximum_safe(a, b) tga_select_binary(maximum_safe, a, b) - #define square_safe(a) tga_select_unary(square_safe, a) - #define cube_safe(a) tga_select_unary(cube_safe, a) - -#endif // __cplusplus else branch - - -//NOTE(martin): these macros are calling the safe functions defined above, so they don't evaluate their -// arguments twice - -#define minimum(a, b) minimum_safe(a, b) -#define maximum(a, b) maximum_safe(a, b) - -#define ClampLowBound(a, low) (maximum((a), (low))) -#define ClampHighBound(a, high) (minimum((a), (high))) -#define Clamp(a, low, high) (ClampLowBound(ClampHighBound((a), (high)), (low))) - -#define Square(a) square_safe(a) -#define Cube(a) cube_safe(a) - -#define AlignUpOnPow2(x, a) (((x) + (a) - 1) & ~((a)-1)) -#define AlignDownOnPow2(x, a) ((x) & ~((a)-1)) - -static inline u64 next_pow2_u64(u64 x) -{ - x--; - x |= x>>1; - x |= x>>2; - x |= x>>4; - x |= x>>8; - x |= x>>16; - x |= x>>32; - x++; - return(x); -} - -#define defer_loop(begin, end) begin; for(int __i__=0; __i__<1; __i__++, end) - - -#define ORCA_COMMA , -#define ORCA_PASS(A, ...) A(__VA_ARGS__) -#define ORCA_EXPAND(...) __VA_ARGS__ -#define ORCA_EXPAND_NIL(...) -#define ORCA_PASTE(a , b) a##b -#define ORCA_ARG1_UTIL(a, ...) a -#define ORCA_ARG1(...) ORCA_ARG1_UTIL(__VA_ARGS__) -#define ORCA_VA_COMMA_TAIL(a, ...) , ##__VA_ARGS__ - -//NOTE: this expands to opt if __VA_ARGS__ is empty, and to , va1, va2, ... opt otherwise -#define ORCA_VA_NOPT_UTIL(opt, ...) ,##__VA_ARGS__ opt - -//NOTE: this expands to opt if __VA_ARGS__ is empty, and to nothing otherwise -#define ORCA_VA_NOPT(opt, ...) ORCA_PASS(ORCA_ARG1, ORCA_VA_NOPT_UTIL(opt, ##__VA_ARGS__)) - -//NOTE: this expands to opt if __VA_ARGS__ is non empty, and to nothing otherwise -#define ORCA_VA_OPT(opt, ...) ORCA_PASS(ORCA_PASTE, ORCA_EXPAND , ORCA_VA_NOPT(_NIL, ##__VA_ARGS__))(opt) - - -#endif //__MACRO_HELPERS_H_ diff --git a/src/util/macros.h b/src/util/macros.h new file mode 100644 index 0000000..7a951a7 --- /dev/null +++ b/src/util/macros.h @@ -0,0 +1,146 @@ +/************************************************************//** +* +* @file: macros.h +* @author: Martin Fouilleul +* @date: 27/03/2020 +* @revision: +* +*****************************************************************/ +#ifndef __MACROS_H_ +#define __MACROS_H_ + +#include"util/typedefs.h" +#include"platform/platform.h" + +//---------------------------------------------------------------------------------------- +// utility macros +//---------------------------------------------------------------------------------------- +#define OC_COMMA , +#define OC_CAT2(a, b) a##b +#define OC_CAT3(a, b, c) a##b##c +#define OC_PASS(A, ...) A(__VA_ARGS__) +#define OC_EXPAND(...) __VA_ARGS__ +#define OC_EXPAND_NIL(...) + +//---------------------------------------------------------------------------------------- +// Variadic macros helpers and replacement for __VA_OPT__ extension +//---------------------------------------------------------------------------------------- +#define OC_ARG1_UTIL(a, ...) a +#define OC_ARG1(...) OC_ARG1_UTIL(__VA_ARGS__) +#define OC_VA_COMMA_TAIL(a, ...) , ##__VA_ARGS__ + +//NOTE: this expands to opt if __VA_ARGS__ is empty, and to , va1, va2, ... opt otherwise +#define OC_VA_NOPT_UTIL(opt, ...) ,##__VA_ARGS__ opt + +//NOTE: this expands to opt if __VA_ARGS__ is empty, and to nothing otherwise +#define OC_VA_NOPT(opt, ...) OC_PASS(OC_ARG1, OC_VA_NOPT_UTIL(opt, ##__VA_ARGS__)) + +//NOTE: this expands to opt if __VA_ARGS__ is non empty, and to nothing otherwise +#define OC_VA_OPT(opt, ...) OC_PASS(OC_CAT2, OC_EXPAND , OC_VA_NOPT(_NIL, ##__VA_ARGS__))(opt) + +//---------------------------------------------------------------------------------------- +// misc +//---------------------------------------------------------------------------------------- + +//NOTE: this computes the address of a struct given an address to one of its members +#ifdef __cplusplus + #define oc_container_of(ptr, type, member) ({ \ + const decltype( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) +#else + #define oc_container_of(ptr, type, member) (type *)((char*)(ptr) - offsetof(type,member)) +#endif + + +#define oc_defer_loop(begin, end) begin; for(int __i__=0; __i__<1; __i__++, end) + +//---------------------------------------------------------------------------------------- +//NOTE(martin): bit-twiddling & arithmetic helpers +//---------------------------------------------------------------------------------------- +#define oc_align_up_pow2(x, a) (((x) + (a) - 1) & ~((a)-1)) +#define oc_align_down_pow2(x, a) ((x) & ~((a)-1)) + +static inline u64 oc_next_pow2(u64 x) +{ + x--; + x |= x>>1; + x |= x>>2; + x |= x>>4; + x |= x>>8; + x |= x>>16; + x |= x>>32; + x++; + return(x); +} + +//NOTE(martin): 'hygienic' max/min/square/cube macros. +#ifdef __cplusplus + //NOTE(martin): in C++ we use templates and decltype/declval + // (overloaded functions would be ambiguous because of the + // overload resolution and conversion/promotion rules) + #include + + template + inline decltype(std::declval()+std::declval()) oc_min(Ta a, Tb b) + { + return(a < b ? a : b); + } + template + inline decltype(std::declval()+std::declval()) oc_max(Ta a, Tb b) + { + return(a > b ? a : b); + } + template + inline T oc_square(T a) + { + return(a*a); + } + template + inline T oc_cube(T a) + { + return(a*a*a); + } +#else + //NOTE(martin): this macros helps generate variants of a generic 'template' for all arithmetic types. + // the def parameter must be a macro that takes a type, and optional arguments + #define oc_tga_variants(def, ...) \ + def(u8, ##__VA_ARGS__) def(i8, ##__VA_ARGS__ ) def(u16, ##__VA_ARGS__) def(i16, ##__VA_ARGS__) \ + def(u32, ##__VA_ARGS__) def(i32, ##__VA_ARGS__) def(u64, ##__VA_ARGS__) def(i64, ##__VA_ARGS__) \ + def(f32, ##__VA_ARGS__) def(f64, ##__VA_ARGS__) + + // This macro generates one _Generic association between a type and its variant + #define oc_tga_association(type, name) , type: OC_CAT3(name, _, type) + + // This macros selects the appropriate variant for a 2 parameters functions + #define oc_tga_select_binary(name, a, b) \ + _Generic((a+b) oc_tga_variants(oc_tga_association, name))(a, b) + + // This macros selects the appropriate variant for a 1 parameters functions + #define oc_tga_select_unary(name, a) \ + _Generic((a) oc_tga_variants(oc_tga_association, name))(a) + + //NOTE(martin): type generic templates + #define oc_min_def(type) static inline type OC_CAT3(oc_min, _, type)(type a, type b) {return(a < b ? a : b);} + #define oc_max_def(type) static inline type OC_CAT3(oc_max, _, type)(type a, type b) {return(a > b ? a : b);} + #define oc_square_def(type) static inline type OC_CAT3(oc_square, _, type)(type a) {return(a*a);} + #define oc_cube_def(type) static inline type OC_CAT3(oc_cube, _, type)(type a) {return(a*a*a);} + + //NOTE(martin): instantiante our templates for all arithmetic types + oc_tga_variants(oc_min_def) + oc_tga_variants(oc_max_def) + oc_tga_variants(oc_square_def) + oc_tga_variants(oc_cube_def) + + //NOTE(martin): generate the _Generic associations between each type and its associated variant + #define oc_min(a, b) oc_tga_select_binary(oc_min, a, b) + #define oc_max(a, b) oc_tga_select_binary(oc_max, a, b) + #define oc_square(a) oc_tga_select_unary(oc_square, a) + #define oc_cube(a) oc_tga_select_unary(oc_cube, a) + +#endif // __cplusplus else branch + +#define oc_clamp_low(a, low) (oc_max((a), (low))) +#define oc_clamp_high(a, high) (oc_min((a), (high))) +#define oc_clamp(a, low, high) (oc_clamp_low(oc_clamp_high((a), (high)), (low))) + +#endif //__MACROS_H_ diff --git a/src/util/memory.c b/src/util/memory.c index b4d9558..a7118ab 100644 --- a/src/util/memory.c +++ b/src/util/memory.c @@ -9,75 +9,81 @@ #include"platform/platform.h" #include"memory.h" #include"platform/platform_memory.h" -#include"macro_helpers.h" +#include"macros.h" -#if PLATFORM_ORCA - static const u32 MEM_ARENA_DEFAULT_RESERVE_SIZE = 1<<20; +#if OC_PLATFORM_ORCA + enum { + OC_ARENA_DEFAULT_RESERVE_SIZE = 1<<20 + }; #else - static const u32 MEM_ARENA_DEFAULT_RESERVE_SIZE = 1<<30; + enum { + OC_ARENA_DEFAULT_RESERVE_SIZE = 1<<30 + }; #endif -static const u32 MEM_ARENA_COMMIT_ALIGNMENT = 4<<10; +enum { + OC_ARENA_COMMIT_ALIGNMENT = 4<<10 +}; //-------------------------------------------------------------------------------- //NOTE(martin): memory arena //-------------------------------------------------------------------------------- -mem_arena_chunk* mem_arena_chunk_alloc(mem_arena* arena, u64 reserveSize) +oc_arena_chunk* oc_arena_chunk_alloc(oc_arena* arena, u64 reserveSize) { - reserveSize = AlignUpOnPow2(reserveSize, MEM_ARENA_COMMIT_ALIGNMENT); - u64 commitSize = AlignUpOnPow2(sizeof(mem_arena_chunk), MEM_ARENA_COMMIT_ALIGNMENT); + reserveSize = oc_align_up_pow2(reserveSize, OC_ARENA_COMMIT_ALIGNMENT); + u64 commitSize = oc_align_up_pow2(sizeof(oc_arena_chunk), OC_ARENA_COMMIT_ALIGNMENT); - char* mem = mem_base_reserve(arena->base, reserveSize); - mem_base_commit(arena->base, mem, commitSize); + char* mem = oc_base_reserve(arena->base, reserveSize); + oc_base_commit(arena->base, mem, commitSize); - mem_arena_chunk* chunk = (mem_arena_chunk*)mem; + oc_arena_chunk* chunk = (oc_arena_chunk*)mem; chunk->ptr = mem; chunk->cap = reserveSize; - chunk->offset = sizeof(mem_arena_chunk); + chunk->offset = sizeof(oc_arena_chunk); chunk->committed = commitSize; - list_push_back(&arena->chunks, &chunk->listElt); + oc_list_push_back(&arena->chunks, &chunk->listElt); return(chunk); } -void mem_arena_init(mem_arena* arena) +void oc_arena_init(oc_arena* arena) { - mem_arena_init_with_options(arena, &(mem_arena_options){0}); + oc_arena_init_with_options(arena, &(oc_arena_options){0}); } -void mem_arena_init_with_options(mem_arena* arena, mem_arena_options* options) +void oc_arena_init_with_options(oc_arena* arena, oc_arena_options* options) { - memset(arena, 0, sizeof(mem_arena)); + memset(arena, 0, sizeof(oc_arena)); - arena->base = options->base ? options->base : mem_base_allocator_default(); + arena->base = options->base ? options->base : oc_base_allocator_default(); - u64 reserveSize = options->reserve ? (options->reserve + sizeof(mem_arena_chunk)) : MEM_ARENA_DEFAULT_RESERVE_SIZE; + u64 reserveSize = options->reserve ? (options->reserve + sizeof(oc_arena_chunk)) : OC_ARENA_DEFAULT_RESERVE_SIZE; - arena->currentChunk = mem_arena_chunk_alloc(arena, reserveSize); + arena->currentChunk = oc_arena_chunk_alloc(arena, reserveSize); } -void mem_arena_release(mem_arena* arena) +void oc_arena_cleanup(oc_arena* arena) { - for_list_safe(&arena->chunks, chunk, mem_arena_chunk, listElt) + oc_list_for_safe(&arena->chunks, chunk, oc_arena_chunk, listElt) { - mem_base_release(arena->base, chunk, chunk->cap); + oc_base_release(arena->base, chunk, chunk->cap); } - memset(arena, 0, sizeof(mem_arena)); + memset(arena, 0, sizeof(oc_arena)); } -void* mem_arena_alloc(mem_arena* arena, u64 size) +void* oc_arena_push(oc_arena* arena, u64 size) { - mem_arena_chunk* chunk = arena->currentChunk; - ASSERT(chunk); + oc_arena_chunk* chunk = arena->currentChunk; + OC_ASSERT(chunk); u64 nextOffset = chunk->offset + size; u64 lastCap = chunk->cap; while(nextOffset > chunk->cap) { - chunk = list_next_entry(&arena->chunks, chunk, mem_arena_chunk, listElt); + chunk = oc_list_next_entry(&arena->chunks, chunk, oc_arena_chunk, listElt); if(chunk) { nextOffset = chunk->offset + size; @@ -90,21 +96,21 @@ void* mem_arena_alloc(mem_arena* arena, u64 size) } if(!chunk) { - u64 reserveSize = maximum(lastCap * 1.5, size); + u64 reserveSize = oc_max(lastCap * 1.5, size); - chunk = mem_arena_chunk_alloc(arena, reserveSize); + chunk = oc_arena_chunk_alloc(arena, reserveSize); nextOffset = chunk->offset + size; } - ASSERT(nextOffset <= chunk->cap); + OC_ASSERT(nextOffset <= chunk->cap); arena->currentChunk = chunk; if(nextOffset > chunk->committed) { - u64 nextCommitted = AlignUpOnPow2(nextOffset, MEM_ARENA_COMMIT_ALIGNMENT); - nextCommitted = ClampHighBound(nextCommitted, chunk->cap); + u64 nextCommitted = oc_align_up_pow2(nextOffset, OC_ARENA_COMMIT_ALIGNMENT); + nextCommitted = oc_clamp_high(nextCommitted, chunk->cap); u64 commitSize = nextCommitted - chunk->committed; - mem_base_commit(arena->base, chunk->ptr + chunk->committed, commitSize); + oc_base_commit(arena->base, chunk->ptr + chunk->committed, commitSize); chunk->committed = nextCommitted; } char* p = chunk->ptr + chunk->offset; @@ -113,24 +119,24 @@ void* mem_arena_alloc(mem_arena* arena, u64 size) return(p); } -void mem_arena_clear(mem_arena* arena) +void oc_arena_clear(oc_arena* arena) { - for_list(&arena->chunks, chunk, mem_arena_chunk, listElt) + oc_list_for(&arena->chunks, chunk, oc_arena_chunk, listElt) { - chunk->offset = sizeof(mem_arena_chunk); + chunk->offset = sizeof(oc_arena_chunk); } - arena->currentChunk = list_first_entry(&arena->chunks, mem_arena_chunk, listElt); + arena->currentChunk = oc_list_first_entry(&arena->chunks, oc_arena_chunk, listElt); } -mem_arena_scope mem_arena_scope_begin(mem_arena* arena) +oc_arena_scope oc_arena_scope_begin(oc_arena* arena) { - mem_arena_scope scope = {.arena = arena, + oc_arena_scope scope = {.arena = arena, .chunk = arena->currentChunk, .offset = arena->currentChunk->offset}; return(scope); } -void mem_arena_scope_end(mem_arena_scope scope) +void oc_arena_scope_end(oc_arena_scope scope) { scope.arena->currentChunk = scope.chunk; scope.arena->currentChunk->offset = scope.offset; @@ -139,44 +145,44 @@ void mem_arena_scope_end(mem_arena_scope scope) //-------------------------------------------------------------------------------- //NOTE(martin): memory pool //-------------------------------------------------------------------------------- -void mem_pool_init(mem_pool* pool, u64 blockSize) +void oc_pool_init(oc_pool* pool, u64 blockSize) { - mem_pool_init_with_options(pool, blockSize, &(mem_pool_options){0}); + oc_pool_init_with_options(pool, blockSize, &(oc_pool_options){0}); } -void mem_pool_init_with_options(mem_pool* pool, u64 blockSize, mem_pool_options* options) +void oc_pool_init_with_options(oc_pool* pool, u64 blockSize, oc_pool_options* options) { - mem_arena_init_with_options(&pool->arena, &(mem_arena_options){.base = options->base, .reserve = options->reserve}); - pool->blockSize = ClampLowBound(blockSize, sizeof(list_info)); - list_init(&pool->freeList); + oc_arena_init_with_options(&pool->arena, &(oc_arena_options){.base = options->base, .reserve = options->reserve}); + pool->blockSize = oc_clamp_low(blockSize, sizeof(oc_list)); + oc_list_init(&pool->freeList); } -void mem_pool_release(mem_pool* pool) +void oc_pool_cleanup(oc_pool* pool) { - mem_arena_release(&pool->arena); - memset(pool, 0, sizeof(mem_pool)); + oc_arena_cleanup(&pool->arena); + memset(pool, 0, sizeof(oc_pool)); } -void* mem_pool_alloc(mem_pool* pool) +void* oc_pool_alloc(oc_pool* pool) { - if(list_empty(&pool->freeList)) + if(oc_list_empty(&pool->freeList)) { - return(mem_arena_alloc(&pool->arena, pool->blockSize)); + return(oc_arena_push(&pool->arena, pool->blockSize)); } else { - return(list_pop(&pool->freeList)); + return(oc_list_pop(&pool->freeList)); } } -void mem_pool_recycle(mem_pool* pool, void* ptr) +void oc_pool_recycle(oc_pool* pool, void* ptr) { - list_push(&pool->freeList, (list_elt*)ptr); + oc_list_push(&pool->freeList, (oc_list_elt*)ptr); } -void mem_pool_clear(mem_pool* pool) +void oc_pool_clear(oc_pool* pool) { - mem_arena_clear(&pool->arena); - list_init(&pool->freeList); + oc_arena_clear(&pool->arena); + oc_list_init(&pool->freeList); } @@ -186,63 +192,63 @@ void mem_pool_clear(mem_pool* pool) enum { - MEM_SCRATCH_POOL_SIZE = 8, - MEM_SCRATCH_DEFAULT_SIZE = 4096, + OC_SCRATCH_POOL_SIZE = 8, + OC_SCRATCH_DEFAULT_SIZE = 4096, }; -mp_thread_local mem_arena __scratchPool[MEM_SCRATCH_POOL_SIZE] = {0}; +oc_thread_local oc_arena __scratchPool[OC_SCRATCH_POOL_SIZE] = {0}; -static mem_arena* mem_scratch_at_index(int index) +static oc_arena* oc_scratch_at_index(int index) { - mem_arena* scratch = 0; + oc_arena* scratch = 0; - if(index >= 0 && index < MEM_SCRATCH_POOL_SIZE) + if(index >= 0 && index < OC_SCRATCH_POOL_SIZE) { if(__scratchPool[index].base == 0) { - mem_arena_options options = {.reserve = MEM_SCRATCH_DEFAULT_SIZE}; - mem_arena_init_with_options(&__scratchPool[index], &options); + oc_arena_options options = {.reserve = OC_SCRATCH_DEFAULT_SIZE}; + oc_arena_init_with_options(&__scratchPool[index], &options); } scratch = &__scratchPool[index]; } return(scratch); } -mem_arena* mem_scratch() +oc_arena* oc_scratch() { - return(mem_scratch_at_index(0)); + return(oc_scratch_at_index(0)); } -MP_API mem_arena* mem_scratch_next(mem_arena* used) +ORCA_API oc_arena* oc_scratch_next(oc_arena* used) { - mem_arena* res = 0; + oc_arena* res = 0; if( (used >= __scratchPool) - &&(used - __scratchPool < MEM_SCRATCH_POOL_SIZE)) + &&(used - __scratchPool < OC_SCRATCH_POOL_SIZE)) { u64 index = used - __scratchPool; - if(index + 1 < MEM_SCRATCH_POOL_SIZE) + if(index + 1 < OC_SCRATCH_POOL_SIZE) { - res = mem_scratch_at_index(index+1); + res = oc_scratch_at_index(index+1); } } else { - res = mem_scratch_at_index(0); + res = oc_scratch_at_index(0); } return(res); } -MP_API mem_arena_scope mem_scratch_begin() +ORCA_API oc_arena_scope oc_scratch_begin() { - mem_arena* scratch = mem_scratch(); - mem_arena_scope scope = mem_arena_scope_begin(scratch); + oc_arena* scratch = oc_scratch(); + oc_arena_scope scope = oc_arena_scope_begin(scratch); return(scope); } -MP_API mem_arena_scope mem_scratch_begin_next(mem_arena* used) +ORCA_API oc_arena_scope oc_scratch_begin_next(oc_arena* used) { - mem_arena* scratch = mem_scratch_next(used); - mem_arena_scope scope = mem_arena_scope_begin(scratch); + oc_arena* scratch = oc_scratch_next(used); + oc_arena_scope scope = oc_arena_scope_begin(scratch); return(scope); } diff --git a/src/util/memory.h b/src/util/memory.h index f5da56f..ebc3d02 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -21,48 +21,48 @@ extern "C" { //NOTE(martin): memory arena //-------------------------------------------------------------------------------- -typedef struct mem_arena_chunk +typedef struct oc_arena_chunk { - list_elt listElt; + oc_list_elt listElt; char* ptr; u64 offset; u64 committed; u64 cap; -} mem_arena_chunk; +} oc_arena_chunk; -typedef struct mem_arena +typedef struct oc_arena { - mem_base_allocator* base; - list_info chunks; - mem_arena_chunk* currentChunk; + oc_base_allocator* base; + oc_list chunks; + oc_arena_chunk* currentChunk; -} mem_arena; +} oc_arena; -typedef struct mem_arena_scope +typedef struct oc_arena_scope { - mem_arena* arena; - mem_arena_chunk* chunk; + oc_arena* arena; + oc_arena_chunk* chunk; u64 offset; -} mem_arena_scope; +} oc_arena_scope; -typedef struct mem_arena_options +typedef struct oc_arena_options { - mem_base_allocator* base; + oc_base_allocator* base; u64 reserve; -} mem_arena_options; +} oc_arena_options; -MP_API void mem_arena_init(mem_arena* arena); -MP_API void mem_arena_init_with_options(mem_arena* arena, mem_arena_options* options); -MP_API void mem_arena_release(mem_arena* arena); +ORCA_API void oc_arena_init(oc_arena* arena); +ORCA_API void oc_arena_init_with_options(oc_arena* arena, oc_arena_options* options); +ORCA_API void oc_arena_cleanup(oc_arena* arena); -MP_API void* mem_arena_alloc(mem_arena* arena, u64 size); -MP_API void mem_arena_clear(mem_arena* arena); +ORCA_API void* oc_arena_push(oc_arena* arena, u64 size); +ORCA_API void oc_arena_clear(oc_arena* arena); -MP_API mem_arena_scope mem_arena_scope_begin(mem_arena* arena); -MP_API void mem_arena_scope_end(mem_arena_scope scope); +ORCA_API oc_arena_scope oc_arena_scope_begin(oc_arena* arena); +ORCA_API void oc_arena_scope_end(oc_arena_scope scope); -#define mem_arena_alloc_type(arena, type) ((type*)mem_arena_alloc(arena, sizeof(type))) -#define mem_arena_alloc_array(arena, type, count) ((type*)mem_arena_alloc(arena, sizeof(type)*(count))) +#define oc_arena_push_type(arena, type) ((type*)oc_arena_push(arena, sizeof(type))) +#define oc_arena_push_array(arena, type, count) ((type*)oc_arena_push(arena, sizeof(type)*(count))) //-------------------------------------------------------------------------------- //NOTE(martin): memory pool @@ -71,41 +71,38 @@ MP_API void mem_arena_scope_end(mem_arena_scope scope); //TODO: we could probably remove pool. Most of the time we construct pool on top of // arenas "manually" with different free lists per object types... -typedef struct mem_pool +typedef struct oc_pool { - mem_arena arena; - list_info freeList; + oc_arena arena; + oc_list freeList; u64 blockSize; -} mem_pool; +} oc_pool; -typedef struct mem_pool_options +typedef struct oc_pool_options { - mem_base_allocator* base; + oc_base_allocator* base; u64 reserve; -} mem_pool_options; +} oc_pool_options; -MP_API void mem_pool_init(mem_pool* pool, u64 blockSize); -MP_API void mem_pool_init_with_options(mem_pool* pool, u64 blockSize, mem_pool_options* options); -MP_API void mem_pool_release(mem_pool* pool); +ORCA_API void oc_pool_init(oc_pool* pool, u64 blockSize); +ORCA_API void oc_pool_init_with_options(oc_pool* pool, u64 blockSize, oc_pool_options* options); +ORCA_API void oc_pool_cleanup(oc_pool* pool); -MP_API void* mem_pool_alloc(mem_pool* pool); -MP_API void mem_pool_recycle(mem_pool* pool, void* ptr); -MP_API void mem_pool_clear(mem_pool* pool); +ORCA_API void* oc_pool_alloc(oc_pool* pool); +ORCA_API void oc_pool_recycle(oc_pool* pool, void* ptr); +ORCA_API void oc_pool_clear(oc_pool* pool); -#define mem_pool_alloc_type(arena, type) ((type*)mem_pool_alloc(arena)) +#define oc_pool_alloc_type(arena, type) ((type*)oc_pool_alloc(arena)) //-------------------------------------------------------------------------------- //NOTE(martin): per-thread implicit scratch arena //-------------------------------------------------------------------------------- -MP_API mem_arena* mem_scratch(); -MP_API mem_arena* mem_scratch_next(mem_arena* used); -MP_API mem_arena_scope mem_scratch_begin(); -MP_API mem_arena_scope mem_scratch_begin_next(mem_arena* used); - -#define mem_scratch_end(scope) mem_arena_scope_end(scope) - - +ORCA_API oc_arena* oc_scratch(); +ORCA_API oc_arena* oc_scratch_next(oc_arena* used); +ORCA_API oc_arena_scope oc_scratch_begin(); +ORCA_API oc_arena_scope oc_scratch_begin_next(oc_arena* used); +#define oc_scratch_end(scope) oc_arena_scope_end(scope) #ifdef __cplusplus } // extern "C" diff --git a/src/util/ringbuffer.c b/src/util/ringbuffer.c index 4f8f27f..ba8bc9d 100644 --- a/src/util/ringbuffer.c +++ b/src/util/ringbuffer.c @@ -9,7 +9,7 @@ #include // malloc, free #include"ringbuffer.h" -void ringbuffer_init(ringbuffer* ring, u8 capExp) +void oc_ringbuffer_init(oc_ringbuffer* ring, u8 capExp) { u64 cap = 1<mask = cap - 1; @@ -19,29 +19,29 @@ void ringbuffer_init(ringbuffer* ring, u8 capExp) ring->buffer = (u8*)malloc(cap); } -void ringbuffer_cleanup(ringbuffer* ring) +void oc_ringbuffer_cleanup(oc_ringbuffer* ring) { free(ring->buffer); } -u64 ringbuffer_read_available(ringbuffer* ring) +u64 oc_ringbuffer_read_available(oc_ringbuffer* ring) { return((ring->writeIndex - ring->readIndex) & ring->mask); } -u64 ringbuffer_write_available(ringbuffer* ring) +u64 oc_ringbuffer_write_available(oc_ringbuffer* ring) { //NOTE(martin): we keep one sentinel byte between write index and read index, // when the buffer is full, to avoid overrunning read index. return(((ring->readIndex - ring->reserveIndex) & ring->mask) - 1); } -u64 ringbuffer_read(ringbuffer* ring, u64 size, u8* data) +u64 oc_ringbuffer_read(oc_ringbuffer* ring, u64 size, u8* data) { u64 read = ring->readIndex; u64 write = ring->writeIndex; - u64 readAvailable = ringbuffer_read_available(ring); + u64 readAvailable = oc_ringbuffer_read_available(ring); if(size > readAvailable) { size = readAvailable; @@ -53,7 +53,7 @@ u64 ringbuffer_read(ringbuffer* ring, u64 size, u8* data) } else { - u64 copyCount = minimum(size, ring->mask + 1 - read); + u64 copyCount = oc_min(size, ring->mask + 1 - read); memcpy(data, ring->buffer + read, copyCount); data += copyCount; @@ -64,21 +64,21 @@ u64 ringbuffer_read(ringbuffer* ring, u64 size, u8* data) return(size); } -u64 ringbuffer_reserve(ringbuffer* ring, u64 size, u8* data) +u64 oc_ringbuffer_reserve(oc_ringbuffer* ring, u64 size, u8* data) { u64 read = ring->readIndex; u64 reserve = ring->reserveIndex; - u64 writeAvailable = ringbuffer_write_available(ring); + u64 writeAvailable = oc_ringbuffer_write_available(ring); if(size > writeAvailable) { - DEBUG_ASSERT("not enough space available"); + OC_DEBUG_ASSERT("not enough space available"); size = writeAvailable; } if(read <= reserve) { - u64 copyCount = minimum(size, ring->mask + 1 - reserve); + u64 copyCount = oc_min(size, ring->mask + 1 - reserve); memcpy(ring->buffer + reserve, data, copyCount); data += copyCount; @@ -93,20 +93,20 @@ u64 ringbuffer_reserve(ringbuffer* ring, u64 size, u8* data) return(size); } -u64 ringbuffer_write(ringbuffer* ring, u64 size, u8* data) +u64 oc_ringbuffer_write(oc_ringbuffer* ring, u64 size, u8* data) { - ringbuffer_commit(ring); - u64 res = ringbuffer_reserve(ring, size, data); - ringbuffer_commit(ring); + oc_ringbuffer_commit(ring); + u64 res = oc_ringbuffer_reserve(ring, size, data); + oc_ringbuffer_commit(ring); return(res); } -void ringbuffer_commit(ringbuffer* ring) +void oc_ringbuffer_commit(oc_ringbuffer* ring) { ring->writeIndex = ring->reserveIndex; } -void ringbuffer_rewind(ringbuffer* ring) +void oc_ringbuffer_rewind(oc_ringbuffer* ring) { ring->reserveIndex = ring->writeIndex; } diff --git a/src/util/ringbuffer.h b/src/util/ringbuffer.h index 6c512bd..c2ef438 100644 --- a/src/util/ringbuffer.h +++ b/src/util/ringbuffer.h @@ -9,8 +9,9 @@ #ifndef __RINGBUFFER_H_ #define __RINGBUFFER_H_ +#include + #include"typedefs.h" -#include"atomic.h" #ifdef __cplusplus extern "C" { @@ -25,17 +26,17 @@ typedef struct ringbuffer u8* buffer; -} ringbuffer; +} oc_ringbuffer; -void ringbuffer_init(ringbuffer* ring, u8 capExp); -void ringbuffer_cleanup(ringbuffer* ring); -u64 ringbuffer_read_available(ringbuffer* ring); -u64 ringbuffer_write_available(ringbuffer* ring); -u64 ringbuffer_read(ringbuffer* ring, u64 size, u8* data); -u64 ringbuffer_write(ringbuffer* ring, u64 size, u8* data); -u64 ringbuffer_reserve(ringbuffer* ring, u64 size, u8* data); -void ringbuffer_commit(ringbuffer* ring); -void ringbuffer_rewind(ringbuffer* ring); +void oc_ringbuffer_init(oc_ringbuffer* ring, u8 capExp); +void oc_ringbuffer_cleanup(oc_ringbuffer* ring); +u64 oc_ringbuffer_read_available(oc_ringbuffer* ring); +u64 oc_ringbuffer_write_available(oc_ringbuffer* ring); +u64 oc_ringbuffer_read(oc_ringbuffer* ring, u64 size, u8* data); +u64 oc_ringbuffer_write(oc_ringbuffer* ring, u64 size, u8* data); +u64 oc_ringbuffer_reserve(oc_ringbuffer* ring, u64 size, u8* data); +void oc_ringbuffer_commit(oc_ringbuffer* ring); +void oc_ringbuffer_rewind(oc_ringbuffer* ring); #ifdef __cplusplus } // extern "C" diff --git a/src/util/strings.c b/src/util/strings.c index 9f2a623..468eefa 100644 --- a/src/util/strings.c +++ b/src/util/strings.c @@ -13,85 +13,85 @@ // string slices as values //---------------------------------------------------------------------------------- -str8 str8_from_buffer(u64 len, char* buffer) +oc_str8 oc_str8_from_buffer(u64 len, char* buffer) { - return((str8){.len = len, .ptr = buffer}); + return((oc_str8){.len = len, .ptr = buffer}); } -str8 str8_slice(str8 s, u64 start, u64 end) +oc_str8 oc_str8_slice(oc_str8 s, u64 start, u64 end) { - ASSERT(start <= end && start <= s.len && end <= s.len); - return((str8){.len = end - start, .ptr = s.ptr + start}); + OC_ASSERT(start <= end && start <= s.len && end <= s.len); + return((oc_str8){.len = end - start, .ptr = s.ptr + start}); } -str8 str8_push_buffer(mem_arena* arena, u64 len, char* buffer) +oc_str8 oc_str8_push_buffer(oc_arena* arena, u64 len, char* buffer) { - str8 str = {0}; + oc_str8 str = {0}; str.len = len; - str.ptr = mem_arena_alloc_array(arena, char, len+1); + str.ptr = oc_arena_push_array(arena, char, len+1); memcpy(str.ptr, buffer, len); str.ptr[str.len] = '\0'; return(str); } -str8 str8_push_cstring(mem_arena* arena, const char* str) +oc_str8 oc_str8_push_cstring(oc_arena* arena, const char* str) { int len = 0; if(str) { len = strlen(str); } - return(str8_push_buffer(arena, strlen(str), (char*)str)); + return(oc_str8_push_buffer(arena, strlen(str), (char*)str)); } -str8 str8_push_copy(mem_arena* arena, str8 s) +oc_str8 oc_str8_push_copy(oc_arena* arena, oc_str8 s) { - return(str8_push_buffer(arena, str8_lp(s))); + return(oc_str8_push_buffer(arena, oc_str8_lp(s))); } -char* str8_to_cstring(mem_arena* arena, str8 string) +char* oc_str8_to_cstring(oc_arena* arena, oc_str8 string) { //NOTE: forward to push_copy, which null-terminates the copy - string = str8_push_copy(arena, string); + string = oc_str8_push_copy(arena, string); return(string.ptr); } -str8 str8_push_slice(mem_arena* arena, str8 s, u64 start, u64 end) +oc_str8 oc_str8_push_slice(oc_arena* arena, oc_str8 s, u64 start, u64 end) { - str8 slice = str8_slice(s, start, end); - return(str8_push_copy(arena, slice)); + oc_str8 slice = oc_str8_slice(s, start, end); + return(oc_str8_push_copy(arena, slice)); } -str8 str8_pushfv(mem_arena* arena, const char* format, va_list args) +oc_str8 oc_str8_pushfv(oc_arena* arena, const char* format, va_list args) { //NOTE(martin): // We first compute the number of characters to write passing a size of 0. // then we allocate len+1 (since vsnprint always terminates with a '\0'). char dummy; - str8 str = {0}; + oc_str8 str = {0}; va_list argCopy; va_copy(argCopy, args); str.len = vsnprintf(&dummy, 0, format, argCopy); va_end(argCopy); - str.ptr = mem_arena_alloc_array(arena, char, str.len + 1); + str.ptr = oc_arena_push_array(arena, char, str.len + 1); vsnprintf((char*)str.ptr, str.len + 1, format, args); return(str); } -str8 str8_pushf(mem_arena* arena, const char* format, ...) +oc_str8 oc_str8_pushf(oc_arena* arena, const char* format, ...) { va_list args; va_start(args, format); - str8 str = str8_pushfv(arena, format, args); + oc_str8 str = oc_str8_pushfv(arena, format, args); va_end(args); return(str); } -int str8_cmp(str8 s1, str8 s2) +int oc_str8_cmp(oc_str8 s1, oc_str8 s2) { - int res = strncmp(s1.ptr, s2.ptr, minimum(s1.len, s2.len)); + int res = strncmp(s1.ptr, s2.ptr, oc_min(s1.len, s2.len)); if(!res) { res = (s1.len < s2.len)? -1 : ((s1.len == s2.len)? 0 : 1); @@ -103,49 +103,49 @@ int str8_cmp(str8 s1, str8 s2) // string lists //---------------------------------------------------------------------------------- -void str8_list_init(str8_list* list) +void oc_str8_list_init(oc_str8_list* list) { - list_init(&list->list); + oc_list_init(&list->list); list->eltCount = 0; list->len = 0; } -void str8_list_push(mem_arena* arena, str8_list* list, str8 str) +void oc_str8_list_push(oc_arena* arena, oc_str8_list* list, oc_str8 str) { - str8_elt* elt = mem_arena_alloc_type(arena, str8_elt); + oc_str8_elt* elt = oc_arena_push_type(arena, oc_str8_elt); elt->string = str; - list_append(&list->list, &elt->listElt); + oc_list_append(&list->list, &elt->listElt); list->eltCount++; list->len += str.len; } -void str8_list_pushf(mem_arena* arena, str8_list* list, const char* format, ...) +void oc_str8_list_pushf(oc_arena* arena, oc_str8_list* list, const char* format, ...) { va_list args; va_start(args, format); - str8 str = str8_pushfv(arena, format, args); + oc_str8 str = oc_str8_pushfv(arena, format, args); va_end(args); - str8_list_push(arena, list, str); + oc_str8_list_push(arena, list, str); } -str8 str8_list_collate(mem_arena* arena, str8_list list, str8 prefix, str8 separator, str8 postfix) +oc_str8 oc_str8_list_collate(oc_arena* arena, oc_str8_list list, oc_str8 prefix, oc_str8 separator, oc_str8 postfix) { - str8 str = {0}; + oc_str8 str = {0}; str.len = prefix.len + list.len + list.eltCount*separator.len + postfix.len; - str.ptr = mem_arena_alloc_array(arena, char, str.len + 1); + str.ptr = oc_arena_push_array(arena, char, str.len + 1); char* dst = str.ptr; memcpy(dst, prefix.ptr, prefix.len); dst += prefix.len; - str8_elt* elt = list_first_entry(&list.list, str8_elt, listElt); + oc_str8_elt* elt = oc_list_first_entry(&list.list, oc_str8_elt, listElt); if(elt) { memcpy(dst, elt->string.ptr, elt->string.len); dst += elt->string.len; - elt = list_next_entry(&list.list, elt, str8_elt, listElt); + elt = oc_list_next_entry(&list.list, elt, oc_str8_elt, listElt); } - for( ; elt != 0; elt = list_next_entry(&list.list, elt, str8_elt, listElt)) + for( ; elt != 0; elt = oc_list_next_entry(&list.list, elt, oc_str8_elt, listElt)) { memcpy(dst, separator.ptr, separator.len); dst += separator.len; @@ -157,16 +157,16 @@ str8 str8_list_collate(mem_arena* arena, str8_list list, str8 prefix, str8 separ return(str); } -str8 str8_list_join(mem_arena* arena, str8_list list) +oc_str8 oc_str8_list_join(oc_arena* arena, oc_str8_list list) { - str8 empty = {.len = 0, .ptr = 0}; - return(str8_list_collate(arena, list, empty, empty, empty)); + oc_str8 empty = {.len = 0, .ptr = 0}; + return(oc_str8_list_collate(arena, list, empty, empty, empty)); } -str8_list str8_split(mem_arena* arena, str8 str, str8_list separators) +oc_str8_list oc_str8_split(oc_arena* arena, oc_str8 str, oc_str8_list separators) { - str8_list list = {0}; - list_init(&list.list); + oc_str8_list list = {0}; + oc_list_init(&list.list); char* ptr = str.ptr; char* end = str.ptr + str.len; @@ -174,10 +174,10 @@ str8_list str8_split(mem_arena* arena, str8 str, str8_list separators) for(; ptr < end; ptr++) { //NOTE(martin): search all separators and try to match them to the current ptr - str8* foundSep = 0; - for_list(&separators.list, elt, str8_elt, listElt) + oc_str8* foundSep = 0; + oc_list_for(&separators.list, elt, oc_str8_elt, listElt) { - str8* separator = &elt->string; + oc_str8* separator = &elt->string; bool equal = true; for(u64 offset = 0; (offset < separator->len) && (ptr+offset < end); @@ -201,8 +201,8 @@ str8_list str8_split(mem_arena* arena, str8 str, str8_list separators) // the current substring is not empty and we emit the substring if(ptr != subStart) { - str8 sub = str8_from_buffer(ptr-subStart, subStart); - str8_list_push(arena, &list, sub); + oc_str8 sub = oc_str8_from_buffer(ptr-subStart, subStart); + oc_str8_list_push(arena, &list, sub); } ptr += foundSep->len - 1; //NOTE(martin): ptr is incremented at the end of the loop subStart = ptr+1; @@ -211,8 +211,8 @@ str8_list str8_split(mem_arena* arena, str8 str, str8_list separators) //NOTE(martin): emit the last substring if(ptr != subStart) { - str8 sub = str8_from_buffer(ptr-subStart, subStart); - str8_list_push(arena, &list, sub); + oc_str8 sub = oc_str8_from_buffer(ptr-subStart, subStart); + oc_str8_list_push(arena, &list, sub); } return(list); } @@ -220,72 +220,72 @@ str8_list str8_split(mem_arena* arena, str8 str, str8_list separators) //---------------------------------------------------------------------------------- // u16 strings //---------------------------------------------------------------------------------- -str16 str16_from_buffer(u64 len, u16* buffer) +oc_str16 oc_str16_from_buffer(u64 len, u16* buffer) { - return((str16){.len = len, .ptr = buffer}); + return((oc_str16){.len = len, .ptr = buffer}); } -str16 str16_slice(str16 s, u64 start, u64 end) +oc_str16 oc_str16_slice(oc_str16 s, u64 start, u64 end) { - ASSERT(start <= end && start <= s.len && end <= s.len); - return((str16){.len = end - start, .ptr = s.ptr + start}); + OC_ASSERT(start <= end && start <= s.len && end <= s.len); + return((oc_str16){.len = end - start, .ptr = s.ptr + start}); } -str16 str16_push_buffer(mem_arena* arena, u64 len, u16* buffer) +oc_str16 oc_str16_push_buffer(oc_arena* arena, u64 len, u16* buffer) { - str16 str = {0}; + oc_str16 str = {0}; str.len = len; - str.ptr = mem_arena_alloc_array(arena, u16, len+1); + str.ptr = oc_arena_push_array(arena, u16, len+1); memcpy(str.ptr, buffer, len*sizeof(u16)); str.ptr[str.len] = (u16)0; return(str); } -str16 str16_push_copy(mem_arena* arena, str16 s) +oc_str16 oc_str16_push_copy(oc_arena* arena, oc_str16 s) { - return(str16_push_buffer(arena, s.len, s.ptr)); + return(oc_str16_push_buffer(arena, s.len, s.ptr)); } -str16 str16_push_slice(mem_arena* arena, str16 s, u64 start, u64 end) +oc_str16 oc_str16_push_slice(oc_arena* arena, oc_str16 s, u64 start, u64 end) { - str16 slice = str16_slice(s, start, end); - return(str16_push_copy(arena, slice)); + oc_str16 slice = oc_str16_slice(s, start, end); + return(oc_str16_push_copy(arena, slice)); } -void str16_list_init(str16_list* list) +void oc_str16_list_init(oc_str16_list* list) { - list_init(&list->list); + oc_list_init(&list->list); list->eltCount = 0; list->len = 0; } -void str16_list_push(mem_arena* arena, str16_list* list, str16 str) +void oc_str16_list_push(oc_arena* arena, oc_str16_list* list, oc_str16 str) { - str16_elt* elt = mem_arena_alloc_type(arena, str16_elt); + oc_str16_elt* elt = oc_arena_push_type(arena, oc_str16_elt); elt->string = str; - list_append(&list->list, &elt->listElt); + oc_list_append(&list->list, &elt->listElt); list->eltCount++; list->len += str.len; } -str16 str16_list_collate(mem_arena* arena, str16_list list, str16 prefix, str16 separator, str16 postfix) +oc_str16 oc_str16_list_collate(oc_arena* arena, oc_str16_list list, oc_str16 prefix, oc_str16 separator, oc_str16 postfix) { - str16 str = {0}; + oc_str16 str = {0}; str.len = prefix.len + list.len + list.eltCount*separator.len + postfix.len; - str.ptr = mem_arena_alloc_array(arena, u16, str.len + 1); + str.ptr = oc_arena_push_array(arena, u16, str.len + 1); char* dst = (char*)str.ptr; memcpy(dst, prefix.ptr, prefix.len*sizeof(u16)); dst += prefix.len*sizeof(u16); - str16_elt* elt = list_first_entry(&list.list, str16_elt, listElt); + oc_str16_elt* elt = oc_list_first_entry(&list.list, oc_str16_elt, listElt); if(elt) { memcpy(dst, elt->string.ptr, elt->string.len*sizeof(u16)); dst += elt->string.len*sizeof(u16); - elt = list_next_entry(&list.list, elt, str16_elt, listElt); + elt = oc_list_next_entry(&list.list, elt, oc_str16_elt, listElt); } - for( ; elt != 0; elt = list_next_entry(&list.list, elt, str16_elt, listElt)) + for( ; elt != 0; elt = oc_list_next_entry(&list.list, elt, oc_str16_elt, listElt)) { memcpy(dst, separator.ptr, separator.len*sizeof(u16)); dst += separator.len*sizeof(u16); @@ -297,81 +297,81 @@ str16 str16_list_collate(mem_arena* arena, str16_list list, str16 prefix, str16 return(str); } -str16 str16_list_join(mem_arena* arena, str16_list list) +oc_str16 oc_str16_list_join(oc_arena* arena, oc_str16_list list) { - str16 empty = {.len = 0, .ptr = 0}; - return(str16_list_collate(arena, list, empty, empty, empty)); + oc_str16 empty = {.len = 0, .ptr = 0}; + return(oc_str16_list_collate(arena, list, empty, empty, empty)); } //---------------------------------------------------------------------------------- // u32 strings //---------------------------------------------------------------------------------- -str32 str32_from_buffer(u64 len, u32* buffer) +oc_str32 oc_str32_from_buffer(u64 len, u32* buffer) { - return((str32){.len = len, .ptr = buffer}); + return((oc_str32){.len = len, .ptr = buffer}); } -str32 str32_slice(str32 s, u64 start, u64 end) +oc_str32 oc_str32_slice(oc_str32 s, u64 start, u64 end) { - ASSERT(start <= end && start <= s.len && end <= s.len); - return((str32){.len = end - start, .ptr = s.ptr + start}); + OC_ASSERT(start <= end && start <= s.len && end <= s.len); + return((oc_str32){.len = end - start, .ptr = s.ptr + start}); } -str32 str32_push_buffer(mem_arena* arena, u64 len, u32* buffer) +oc_str32 oc_str32_push_buffer(oc_arena* arena, u64 len, u32* buffer) { - str32 str = {0}; + oc_str32 str = {0}; str.len = len; - str.ptr = mem_arena_alloc_array(arena, u32, len+1); + str.ptr = oc_arena_push_array(arena, u32, len+1); memcpy(str.ptr, buffer, len*sizeof(u32)); str.ptr[str.len] = 0; return(str); } -str32 str32_push_copy(mem_arena* arena, str32 s) +oc_str32 oc_str32_push_copy(oc_arena* arena, oc_str32 s) { - return(str32_push_buffer(arena, s.len, s.ptr)); + return(oc_str32_push_buffer(arena, s.len, s.ptr)); } -str32 str32_push_slice(mem_arena* arena, str32 s, u64 start, u64 end) +oc_str32 oc_str32_push_slice(oc_arena* arena, oc_str32 s, u64 start, u64 end) { - str32 slice = str32_slice(s, start, end); - return(str32_push_copy(arena, slice)); + oc_str32 slice = oc_str32_slice(s, start, end); + return(oc_str32_push_copy(arena, slice)); } -void str32_list_init(str32_list* list) +void oc_str32_list_init(oc_str32_list* list) { - list_init(&list->list); + oc_list_init(&list->list); list->eltCount = 0; list->len = 0; } -void str32_list_push(mem_arena* arena, str32_list* list, str32 str) +void oc_str32_list_push(oc_arena* arena, oc_str32_list* list, oc_str32 str) { - str32_elt* elt = mem_arena_alloc_type(arena, str32_elt); + oc_str32_elt* elt = oc_arena_push_type(arena, oc_str32_elt); elt->string = str; - list_append(&list->list, &elt->listElt); + oc_list_append(&list->list, &elt->listElt); list->eltCount++; list->len += str.len; } -str32 str32_list_collate(mem_arena* arena, str32_list list, str32 prefix, str32 separator, str32 postfix) +oc_str32 oc_str32_list_collate(oc_arena* arena, oc_str32_list list, oc_str32 prefix, oc_str32 separator, oc_str32 postfix) { - str32 str = {0}; + oc_str32 str = {0}; str.len = prefix.len + list.len + list.eltCount*separator.len + postfix.len; - str.ptr = mem_arena_alloc_array(arena, u32, str.len+1); + str.ptr = oc_arena_push_array(arena, u32, str.len+1); char* dst = (char*)str.ptr; memcpy(dst, prefix.ptr, prefix.len*sizeof(u32)); dst += prefix.len*sizeof(u32); - str32_elt* elt = list_first_entry(&list.list, str32_elt, listElt); + oc_str32_elt* elt = oc_list_first_entry(&list.list, oc_str32_elt, listElt); if(elt) { memcpy(dst, elt->string.ptr, elt->string.len*sizeof(u32)); dst += elt->string.len*sizeof(u32); - elt = list_next_entry(&list.list, elt, str32_elt, listElt); + elt = oc_list_next_entry(&list.list, elt, oc_str32_elt, listElt); } - for( ; elt != 0; elt = list_next_entry(&list.list, elt, str32_elt, listElt)) + for( ; elt != 0; elt = oc_list_next_entry(&list.list, elt, oc_str32_elt, listElt)) { memcpy(dst, separator.ptr, separator.len*sizeof(u32)); dst += separator.len*sizeof(u32); @@ -383,8 +383,8 @@ str32 str32_list_collate(mem_arena* arena, str32_list list, str32 prefix, str32 return(str); } -str32 str32_list_join(mem_arena* arena, str32_list list) +oc_str32 oc_str32_list_join(oc_arena* arena, oc_str32_list list) { - str32 empty = {.len = 0, .ptr = 0}; - return(str32_list_collate(arena, list, empty, empty, empty)); + oc_str32 empty = {.len = 0, .ptr = 0}; + return(oc_str32_list_collate(arena, list, empty, empty, empty)); } diff --git a/src/util/strings.h b/src/util/strings.h index ec33e51..f3a45e7 100644 --- a/src/util/strings.h +++ b/src/util/strings.h @@ -24,128 +24,131 @@ extern "C" { By convention, functions that take an arena and return a string slice allocated on this arena, always allocate one more element and null-terminate the string. This is done so we can pass those strings directly to C APIs that requires C strings without - having to do a copy with str8_to_cstring(). + having to do a copy with oc_str8_to_cstring(). - This does _not_ applies to the string returned by str8_split(). Those are slices + This does _not_ applies to the string returned by oc_str8_split(). Those are slices into the original string. Only the _list nodes_ are allocated on the arena. */ //---------------------------------------------------------------------------------- // u8 strings //---------------------------------------------------------------------------------- -typedef struct str8 +typedef struct oc_str8 { u64 len; char* ptr; -} str8; +} oc_str8; -#define STR8(s) ((str8){.len = (s) ? strlen(s) : 0, .ptr = (char*)s}) +#define OC_STR8(s) ((oc_str8){.len = (s) ? strlen(s) : 0, .ptr = (char*)s}) -#define str8_lp(s) ((s).len), ((s).ptr) -#define str8_ip(s) (int)str8_lp(s) +//NOTE: this only works with string literals, but is sometimes necessary to generate compile-time constants +#define OC_STR8_LIT(s) {sizeof(s)-1, s} -MP_API str8 str8_from_buffer(u64 len, char* buffer); -MP_API str8 str8_slice(str8 s, u64 start, u64 end); +#define oc_str8_lp(s) ((s).len), ((s).ptr) +#define oc_str8_ip(s) (int)oc_str8_lp(s) -MP_API str8 str8_push_buffer(mem_arena* arena, u64 len, char* buffer); -MP_API str8 str8_push_cstring(mem_arena* arena, const char* str); -MP_API str8 str8_push_copy(mem_arena* arena, str8 s); -MP_API str8 str8_push_slice(mem_arena* arena, str8 s, u64 start, u64 end); +ORCA_API oc_str8 oc_str8_from_buffer(u64 len, char* buffer); +ORCA_API oc_str8 oc_str8_slice(oc_str8 s, u64 start, u64 end); -MP_API str8 str8_pushfv(mem_arena* arena, const char* format, va_list args); -MP_API str8 str8_pushf(mem_arena* arena, const char* format, ...); +ORCA_API oc_str8 oc_str8_push_buffer(oc_arena* arena, u64 len, char* buffer); +ORCA_API oc_str8 oc_str8_push_cstring(oc_arena* arena, const char* str); +ORCA_API oc_str8 oc_str8_push_copy(oc_arena* arena, oc_str8 s); +ORCA_API oc_str8 oc_str8_push_slice(oc_arena* arena, oc_str8 s, u64 start, u64 end); -MP_API int str8_cmp(str8 s1, str8 s2); +ORCA_API oc_str8 oc_str8_pushfv(oc_arena* arena, const char* format, va_list args); +ORCA_API oc_str8 oc_str8_pushf(oc_arena* arena, const char* format, ...); -MP_API char* str8_to_cstring(mem_arena* arena, str8 string); +ORCA_API int oc_str8_cmp(oc_str8 s1, oc_str8 s2); + +ORCA_API char* oc_str8_to_cstring(oc_arena* arena, oc_str8 string); //---------------------------------------------------------------------------------- // string lists //---------------------------------------------------------------------------------- -typedef struct str8_elt +typedef struct oc_str8_elt { - list_elt listElt; - str8 string; -} str8_elt; + oc_list_elt listElt; + oc_str8 string; +} oc_str8_elt; -typedef struct str8_list +typedef struct oc_str8_list { - list_info list; + oc_list list; u64 eltCount; u64 len; -} str8_list; +} oc_str8_list; -MP_API void str8_list_push(mem_arena* arena, str8_list* list, str8 str); -MP_API void str8_list_pushf(mem_arena* arena, str8_list* list, const char* format, ...); +ORCA_API void oc_str8_list_push(oc_arena* arena, oc_str8_list* list, oc_str8 str); +ORCA_API void oc_str8_list_pushf(oc_arena* arena, oc_str8_list* list, const char* format, ...); -MP_API str8 str8_list_collate(mem_arena* arena, str8_list list, str8 prefix, str8 separator, str8 postfix); -MP_API str8 str8_list_join(mem_arena* arena, str8_list list); -MP_API str8_list str8_split(mem_arena* arena, str8 str, str8_list separators); +ORCA_API oc_str8 oc_str8_list_collate(oc_arena* arena, oc_str8_list list, oc_str8 prefix, oc_str8 separator, oc_str8 postfix); +ORCA_API oc_str8 oc_str8_list_join(oc_arena* arena, oc_str8_list list); +ORCA_API oc_str8_list oc_str8_split(oc_arena* arena, oc_str8 str, oc_str8_list separators); //---------------------------------------------------------------------------------- // u16 strings //---------------------------------------------------------------------------------- -typedef struct str16 +typedef struct oc_str16 { u64 len; u16* ptr; -} str16; +} oc_str16; -MP_API str16 str16_from_buffer(u64 len, u16* buffer); -MP_API str16 str16_slice(str16 s, u64 start, u64 end); +ORCA_API oc_str16 oc_str16_from_buffer(u64 len, u16* buffer); +ORCA_API oc_str16 oc_str16_slice(oc_str16 s, u64 start, u64 end); -MP_API str16 str16_push_buffer(mem_arena* arena, u64 len, u16* buffer); -MP_API str16 str16_push_copy(mem_arena* arena, str16 s); -MP_API str16 str16_push_slice(mem_arena* arena, str16 s, u64 start, u64 end); +ORCA_API oc_str16 oc_str16_push_buffer(oc_arena* arena, u64 len, u16* buffer); +ORCA_API oc_str16 oc_str16_push_copy(oc_arena* arena, oc_str16 s); +ORCA_API oc_str16 oc_str16_push_slice(oc_arena* arena, oc_str16 s, u64 start, u64 end); -typedef struct str16_elt +typedef struct oc_str16_elt { - list_elt listElt; - str16 string; -} str16_elt; + oc_list_elt listElt; + oc_str16 string; +} oc_str16_elt; -typedef struct str16_list +typedef struct oc_str16_list { - list_info list; + oc_list list; u64 eltCount; u64 len; -} str16_list; +} oc_str16_list; -MP_API void str16_list_push(mem_arena* arena, str16_list* list, str16 str); -MP_API str16 str16_list_join(mem_arena* arena, str16_list list); -MP_API str16_list str16_split(mem_arena* arena, str16 str, str16_list separators); +ORCA_API void oc_str16_list_push(oc_arena* arena, oc_str16_list* list, oc_str16 str); +ORCA_API oc_str16 oc_str16_list_join(oc_arena* arena, oc_str16_list list); +ORCA_API oc_str16_list oc_str16_split(oc_arena* arena, oc_str16 str, oc_str16_list separators); //---------------------------------------------------------------------------------- // u32 strings //---------------------------------------------------------------------------------- -typedef struct str32 +typedef struct oc_str32 { u64 len; u32* ptr; -} str32; +} oc_str32; -MP_API str32 str32_from_buffer(u64 len, u32* buffer); -MP_API str32 str32_slice(str32 s, u64 start, u64 end); +ORCA_API oc_str32 oc_str32_from_buffer(u64 len, u32* buffer); +ORCA_API oc_str32 oc_str32_slice(oc_str32 s, u64 start, u64 end); -MP_API str32 str32_push_buffer(mem_arena* arena, u64 len, u32* buffer); -MP_API str32 str32_push_copy(mem_arena* arena, str32 s); -MP_API str32 str32_push_slice(mem_arena* arena, str32 s, u64 start, u64 end); +ORCA_API oc_str32 oc_str32_push_buffer(oc_arena* arena, u64 len, u32* buffer); +ORCA_API oc_str32 oc_str32_push_copy(oc_arena* arena, oc_str32 s); +ORCA_API oc_str32 oc_str32_push_slice(oc_arena* arena, oc_str32 s, u64 start, u64 end); -typedef struct str32_elt +typedef struct oc_str32_elt { - list_elt listElt; - str32 string; -} str32_elt; + oc_list_elt listElt; + oc_str32 string; +} oc_str32_elt; -typedef struct str32_list +typedef struct oc_str32_list { - list_info list; + oc_list list; u64 eltCount; u64 len; -} str32_list; +} oc_str32_list; -MP_API void str32_list_push(mem_arena* arena, str32_list* list, str32 str); -MP_API str32 str32_list_join(mem_arena* arena, str32_list list); -MP_API str32_list str32_split(mem_arena* arena, str32 str, str32_list separators); +ORCA_API void oc_str32_list_push(oc_arena* arena, oc_str32_list* list, oc_str32 str); +ORCA_API oc_str32 oc_str32_list_join(oc_arena* arena, oc_str32_list list); +ORCA_API oc_str32_list oc_str32_split(oc_arena* arena, oc_str32 str, oc_str32_list separators); #ifdef __cplusplus } // extern "C" diff --git a/src/util/typedefs.h b/src/util/typedefs.h index b4a07ad..1522bae 100644 --- a/src/util/typedefs.h +++ b/src/util/typedefs.h @@ -40,7 +40,18 @@ typedef union f32 y; }; f32 c[2]; -} vec2; +} oc_vec2; + +typedef union +{ + struct + { + f32 x; + f32 y; + f32 z; + }; + f32 c[3]; +} oc_vec3; typedef union { @@ -50,7 +61,7 @@ typedef union i32 y; }; i32 c[2]; -} ivec2; +} oc_vec2i; typedef union { @@ -62,9 +73,12 @@ typedef union f32 w; }; f32 c[4]; -} vec4; +} oc_vec4; -#define vec4_expand_xyz(v) (v).x, (v).y, (v).z +typedef struct oc_mat2x3 +{ + f32 m[6]; +} oc_mat2x3; typedef union { @@ -77,10 +91,10 @@ typedef union }; struct { - vec2 xy; - vec2 wh; + oc_vec2 xy; + oc_vec2 wh; }; f32 c[4]; -} mp_rect; +} oc_rect; #endif //__TYPEDEFS_H_ diff --git a/src/util/utf8.c b/src/util/utf8.c index b1156ce..e49b319 100644 --- a/src/util/utf8.c +++ b/src/util/utf8.c @@ -12,11 +12,11 @@ //----------------------------------------------------------------- // utf-8 gore //----------------------------------------------------------------- -const u32 offsetsFromUTF8[6] = { +static const u32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; -const char trailingBytesForUTF8[256] = { +static const char trailingBytesForUTF8[256] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -27,18 +27,18 @@ const char trailingBytesForUTF8[256] = { 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 }; -#define utf8_is_start_byte(c) (((c)&0xc0)!=0x80) +#define oc_utf8_is_start_byte(c) (((c)&0xc0)!=0x80) //----------------------------------------------------------------- //NOTE: getting sizes / offsets / indices //----------------------------------------------------------------- -u32 utf8_size_from_leading_char(char leadingChar) +u32 oc_utf8_size_from_leading_char(char leadingChar) { return(trailingBytesForUTF8[(unsigned int)(unsigned char)leadingChar] + 1); } -u32 utf8_codepoint_size(utf32 codePoint) +u32 oc_utf8_codepoint_size(oc_utf32 codePoint) { if(codePoint < 0x80) { @@ -59,7 +59,7 @@ u32 utf8_codepoint_size(utf32 codePoint) return(0); } -u64 utf8_codepoint_count_for_string(str8 string) +u64 oc_utf8_codepoint_count_for_string(oc_str8 string) { u64 byteOffset = 0; u64 codePointIndex = 0; @@ -67,13 +67,13 @@ u64 utf8_codepoint_count_for_string(str8 string) (byteOffset < string.len) && (string.ptr[byteOffset] != 0); codePointIndex++) { - utf8_dec decode = utf8_decode_at(string, byteOffset); + oc_utf8_dec decode = oc_utf8_decode_at(string, byteOffset); byteOffset += decode.size; } return(codePointIndex); } -u64 utf8_byte_count_for_codepoints(str32 codePoints) +u64 oc_utf8_byte_count_for_codepoints(oc_str32 codePoints) { //NOTE(martin): return the exact number of bytes taken by the encoded // version of codePoints. (ie do not attempt to provision @@ -81,12 +81,12 @@ u64 utf8_byte_count_for_codepoints(str32 codePoints) u64 byteCount = 0; for(u64 i=0; i= string.len) @@ -95,13 +95,13 @@ u64 utf8_next_offset(str8 string, u64 byteOffset) } else { - u64 nextOffset = byteOffset + utf8_size_from_leading_char(string.ptr[byteOffset]); - res = minimum(nextOffset, string.len); + u64 nextOffset = byteOffset + oc_utf8_size_from_leading_char(string.ptr[byteOffset]); + res = oc_min(nextOffset, string.len); } return(res); } -u64 utf8_prev_offset(str8 string, u64 byteOffset) +u64 oc_utf8_prev_offset(oc_str8 string, u64 byteOffset) { u64 res = 0; if(byteOffset > string.len) @@ -111,7 +111,7 @@ u64 utf8_prev_offset(str8 string, u64 byteOffset) else if(byteOffset) { byteOffset--; - while(byteOffset > 0 && !utf8_is_start_byte(string.ptr[byteOffset])) + while(byteOffset > 0 && !oc_utf8_is_start_byte(string.ptr[byteOffset])) { byteOffset--; } @@ -124,12 +124,12 @@ u64 utf8_prev_offset(str8 string, u64 byteOffset) //NOTE: encoding / decoding //----------------------------------------------------------------- -utf8_dec utf8_decode_at(str8 string, u64 offset) +oc_utf8_dec oc_utf8_decode_at(oc_str8 string, u64 offset) { //NOTE(martin): get the first codepoint in str, and advance index to the - // next utf8 character + // next oc_utf8 character //TODO(martin): check for utf-16 surrogate pairs - utf32 cp = 0; + oc_utf32 cp = 0; u64 sz = 0; if(offset >= string.len || !string.ptr[offset]) @@ -137,7 +137,7 @@ utf8_dec utf8_decode_at(str8 string, u64 offset) cp = 0; sz = 1; } - else if( !utf8_is_start_byte(string.ptr[offset])) + else if( !oc_utf8_is_start_byte(string.ptr[offset])) { //NOTE(martin): unexpected continuation or invalid character. cp = 0xfffd; @@ -145,13 +145,13 @@ utf8_dec utf8_decode_at(str8 string, u64 offset) } else { - int expectedSize = utf8_size_from_leading_char(string.ptr[offset]); + int expectedSize = oc_utf8_size_from_leading_char(string.ptr[offset]); do { /*NOTE(martin): we shift 6 bits and add the next byte at each round. - at the end we have our utf8 codepoint, added to the shifted versions - of the utf8 leading bits for each encoded byte. These values are + at the end we have our oc_utf8 codepoint, added to the shifted versions + of the oc_utf8 leading bits for each encoded byte. These values are precomputed in offsetsFromUTF8. */ unsigned char b = string.ptr[offset]; @@ -168,7 +168,7 @@ utf8_dec utf8_decode_at(str8 string, u64 offset) } while( offset < string.len && string.ptr[offset] - && !utf8_is_start_byte(string.ptr[offset]) + && !oc_utf8_is_start_byte(string.ptr[offset]) && sz < expectedSize); if(sz != expectedSize) @@ -187,16 +187,16 @@ utf8_dec utf8_decode_at(str8 string, u64 offset) } } } - utf8_dec res = {.codepoint = cp, .size = sz}; + oc_utf8_dec res = {.codepoint = cp, .size = sz}; return(res); } -utf8_dec utf8_decode(str8 string) +oc_utf8_dec oc_utf8_decode(oc_str8 string) { - return(utf8_decode_at(string, 0)); + return(oc_utf8_decode_at(string, 0)); } -str8 utf8_encode(char* dest, utf32 codePoint) +oc_str8 oc_utf8_encode(char* dest, oc_utf32 codePoint) { u64 sz = 0; if (codePoint < 0x80) @@ -225,58 +225,58 @@ str8 utf8_encode(char* dest, utf32 codePoint) dest[3] = (codePoint & 0x3F) | 0x80; sz = 4; } - str8 res = {.len = sz, .ptr = dest}; + oc_str8 res = {.len = sz, .ptr = dest}; return(res); } -str32 utf8_to_codepoints(u64 maxCount, utf32* backing, str8 string) +oc_str32 oc_utf8_to_codepoints(u64 maxCount, oc_utf32* backing, oc_str8 string) { u64 codePointIndex = 0; u64 byteOffset = 0; for(; codePointIndex < maxCount && byteOffset < string.len; codePointIndex++) { - utf8_dec decode = utf8_decode_at(string, byteOffset); + oc_utf8_dec decode = oc_utf8_decode_at(string, byteOffset); backing[codePointIndex] = decode.codepoint; byteOffset += decode.size; } - str32 res = {.len = codePointIndex, .ptr = backing}; + oc_str32 res = {.len = codePointIndex, .ptr = backing}; return(res); } -str8 utf8_from_codepoints(u64 maxBytes, char* backing, str32 codePoints) +oc_str8 oc_utf8_from_codepoints(u64 maxBytes, char* backing, oc_str32 codePoints) { u64 byteOffset = 0; for(u64 codePointIndex = 0; (codePointIndex < codePoints.len); codePointIndex++) { - utf32 codePoint = codePoints.ptr[codePointIndex]; - u32 byteCount = utf8_codepoint_size(codePoint); + oc_utf32 codePoint = codePoints.ptr[codePointIndex]; + u32 byteCount = oc_utf8_codepoint_size(codePoint); if(byteOffset + byteCount > maxBytes) { break; } - utf8_encode(backing+byteOffset, codePoint); + oc_utf8_encode(backing+byteOffset, codePoint); byteOffset += byteCount; } - str8 res = {.len = byteOffset, .ptr = backing}; + oc_str8 res = {.len = byteOffset, .ptr = backing}; return(res); } -str32 utf8_push_to_codepoints(mem_arena* arena, str8 string) +oc_str32 oc_utf8_push_to_codepoints(oc_arena* arena, oc_str8 string) { - u64 count = utf8_codepoint_count_for_string(string); - utf32* backing = mem_arena_alloc_array(arena, utf32, count); - str32 res = utf8_to_codepoints(count, backing, string); + u64 count = oc_utf8_codepoint_count_for_string(string); + oc_utf32* backing = oc_arena_push_array(arena, oc_utf32, count); + oc_str32 res = oc_utf8_to_codepoints(count, backing, string); return(res); } -str8 utf8_push_from_codepoints(mem_arena* arena, str32 codePoints) +oc_str8 oc_utf8_push_from_codepoints(oc_arena* arena, oc_str32 codePoints) { - u64 count = utf8_byte_count_for_codepoints(codePoints); - char* backing = mem_arena_alloc_array(arena, char, count); - str8 res = utf8_from_codepoints(count, backing, codePoints); + u64 count = oc_utf8_byte_count_for_codepoints(codePoints); + char* backing = oc_arena_push_array(arena, char, count); + oc_str8 res = oc_utf8_from_codepoints(count, backing, codePoints); return(res); } -#define UNICODE_RANGE(start, cnt, name) MP_API const unicode_range _cat2_(UNICODE_RANGE_, name) = { .firstCodePoint = start, .count = cnt }; -UNICODE_RANGES -#undef UNICODE_RANGE +#define OC_UNICODE_RANGE(start, cnt, name) ORCA_API const oc_unicode_range OC_CAT2(OC_UNICODE_, name) = { .firstCodePoint = start, .count = cnt }; +OC_UNICODE_RANGES +#undef OC_UNICODE_RANGE diff --git a/src/util/utf8.h b/src/util/utf8.h index 2bdb92e..61065cd 100644 --- a/src/util/utf8.h +++ b/src/util/utf8.h @@ -17,181 +17,181 @@ extern "C" { #endif -typedef u32 utf32; +typedef u32 oc_utf32; //----------------------------------------------------------------- //NOTE: getting sizes / offsets / indices //----------------------------------------------------------------- -MP_API u32 utf8_size_from_leading_char(char leadingChar); -MP_API u32 utf8_codepoint_size(utf32 codePoint); +ORCA_API u32 oc_utf8_size_from_leading_char(char leadingChar); +ORCA_API u32 oc_utf8_codepoint_size(oc_utf32 codePoint); -MP_API u64 utf8_codepoint_count_for_string(str8 string); -MP_API u64 utf8_byte_count_for_codepoints(str32 codePoints); +ORCA_API u64 oc_utf8_codepoint_count_for_string(oc_str8 string); +ORCA_API u64 oc_utf8_byte_count_for_codepoints(oc_str32 codePoints); -MP_API u64 utf8_next_offset(str8 string, u64 byteOffset); -MP_API u64 utf8_prev_offset(str8 string, u64 byteOffset); +ORCA_API u64 oc_utf8_next_offset(oc_str8 string, u64 byteOffset); +ORCA_API u64 oc_utf8_prev_offset(oc_str8 string, u64 byteOffset); //----------------------------------------------------------------- //NOTE: encoding / decoding //----------------------------------------------------------------- -typedef struct utf8_dec +typedef struct oc_utf8_dec { - utf32 codepoint; //NOTE: decoded codepoint - u32 size; //NOTE: size of corresponding utf8 sequence -} utf8_dec; + oc_utf32 codepoint; //NOTE: decoded codepoint + u32 size; //NOTE: size of corresponding oc_utf8 sequence +} oc_utf8_dec; -MP_API utf8_dec utf8_decode(str8 string); //NOTE: decode a single utf8 sequence at start of string -MP_API utf8_dec utf8_decode_at(str8 string, u64 offset); //NOTE: decode a single utf8 sequence starting at byte offset -MP_API str8 utf8_encode(char* dst, utf32 codePoint); //NOTE: encode codepoint into backing buffer dst +ORCA_API oc_utf8_dec oc_utf8_decode(oc_str8 string); //NOTE: decode a single oc_utf8 sequence at start of string +ORCA_API oc_utf8_dec oc_utf8_decode_at(oc_str8 string, u64 offset); //NOTE: decode a single oc_utf8 sequence starting at byte offset +ORCA_API oc_str8 oc_utf8_encode(char* dst, oc_utf32 codePoint); //NOTE: encode codepoint into backing buffer dst -MP_API str32 utf8_to_codepoints(u64 maxCount, utf32* backing, str8 string); -MP_API str8 utf8_from_codepoints(u64 maxBytes, char* backing, str32 codePoints); +ORCA_API oc_str32 oc_utf8_to_codepoints(u64 maxCount, oc_utf32* backing, oc_str8 string); +ORCA_API oc_str8 oc_utf8_from_codepoints(u64 maxBytes, char* backing, oc_str32 codePoints); -MP_API str32 utf8_push_to_codepoints(mem_arena* arena, str8 string); -MP_API str8 utf8_push_from_codepoints(mem_arena* arena, str32 codePoints); +ORCA_API oc_str32 oc_utf8_push_to_codepoints(oc_arena* arena, oc_str8 string); +ORCA_API oc_str8 oc_utf8_push_from_codepoints(oc_arena* arena, oc_str32 codePoints); //----------------------------------------------------------------- -// utf8 range struct and X-macros for defining utf8 ranges +// oc_utf8 range struct and X-macros for defining oc_utf8 ranges //----------------------------------------------------------------- -typedef struct unicode_range +typedef struct oc_unicode_range { - utf32 firstCodePoint; + oc_utf32 firstCodePoint; u32 count; -} unicode_range; +} oc_unicode_range; //NOTE(martin): range declared here are defined in utf8.cpp // they can be used by prefixing them with UTF8_RANGE_, as in 'UTF8_RANGE_BASIC_LATIN' -#define UNICODE_RANGES \ -UNICODE_RANGE(0x0000, 127, BASIC_LATIN) \ -UNICODE_RANGE(0x0080, 127, C1_CONTROLS_AND_LATIN_1_SUPPLEMENT) \ -UNICODE_RANGE(0x0100, 127, LATIN_EXTENDED_A) \ -UNICODE_RANGE(0x0180, 207, LATIN_EXTENDED_B) \ -UNICODE_RANGE(0x0250, 95, IPA_EXTENSIONS) \ -UNICODE_RANGE(0x02b0, 79, SPACING_MODIFIER_LETTERS) \ -UNICODE_RANGE(0x0300, 111, COMBINING_DIACRITICAL_MARKS) \ -UNICODE_RANGE(0x0370, 143, GREEK_COPTIC) \ -UNICODE_RANGE(0x0400, 255, CYRILLIC) \ -UNICODE_RANGE(0x0500, 47, CYRILLIC_SUPPLEMENT) \ -UNICODE_RANGE(0x0530, 95, ARMENIAN) \ -UNICODE_RANGE(0x0590, 111, HEBREW) \ -UNICODE_RANGE(0x0600, 255, ARABIC) \ -UNICODE_RANGE(0x0700, 79, SYRIAC) \ -UNICODE_RANGE(0x0780, 63, THAANA) \ -UNICODE_RANGE(0x0900, 127, DEVANAGARI) \ -UNICODE_RANGE(0x0980, 127, BENGALI_ASSAMESE) \ -UNICODE_RANGE(0x0a00, 127, GURMUKHI) \ -UNICODE_RANGE(0x0a80, 127, GUJARATI) \ -UNICODE_RANGE(0x0b00, 127, ORIYA) \ -UNICODE_RANGE(0x0b80, 127, TAMIL) \ -UNICODE_RANGE(0x0c00, 127, TELUGU) \ -UNICODE_RANGE(0x0c80, 127, KANNADA) \ -UNICODE_RANGE(0x0d00, 255, MALAYALAM) \ -UNICODE_RANGE(0x0d80, 127, SINHALA) \ -UNICODE_RANGE(0x0e00, 127, THAI) \ -UNICODE_RANGE(0x0e80, 127, LAO) \ -UNICODE_RANGE(0x0f00, 255, TIBETAN) \ -UNICODE_RANGE(0x1000, 159, MYANMAR) \ -UNICODE_RANGE(0x10a0, 95, GEORGIAN) \ -UNICODE_RANGE(0x1100, 255, HANGUL_JAMO) \ -UNICODE_RANGE(0x1200, 383, ETHIOPIC) \ -UNICODE_RANGE(0x13a0, 95, CHEROKEE) \ -UNICODE_RANGE(0x1400, 639, UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS) \ -UNICODE_RANGE(0x1680, 31, OGHAM) \ -UNICODE_RANGE(0x16a0, 95, RUNIC) \ -UNICODE_RANGE(0x1700, 31, TAGALOG) \ -UNICODE_RANGE(0x1720, 31, HANUNOO) \ -UNICODE_RANGE(0x1740, 31, BUHID) \ -UNICODE_RANGE(0x1760, 31, TAGBANWA) \ -UNICODE_RANGE(0x1780, 127, KHMER) \ -UNICODE_RANGE(0x1800, 175, MONGOLIAN) \ -UNICODE_RANGE(0x1900, 79, LIMBU) \ -UNICODE_RANGE(0x1950, 47, TAI_LE) \ -UNICODE_RANGE(0x19e0, 31, KHMER_SYMBOLS) \ -UNICODE_RANGE(0x1d00, 127, PHONETIC_EXTENSIONS) \ -UNICODE_RANGE(0x1e00, 255, LATIN_EXTENDED_ADDITIONAL) \ -UNICODE_RANGE(0x1f00, 255, GREEK_EXTENDED) \ -UNICODE_RANGE(0x2000, 111, GENERAL_PUNCTUATION) \ -UNICODE_RANGE(0x2070, 47, SUPERSCRIPTS_AND_SUBSCRIPTS) \ -UNICODE_RANGE(0x20a0, 47, CURRENCY_SYMBOLS) \ -UNICODE_RANGE(0x20d0, 47, COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS) \ -UNICODE_RANGE(0x2100, 79, LETTERLIKE_SYMBOLS) \ -UNICODE_RANGE(0x2150, 63, NUMBER_FORMS) \ -UNICODE_RANGE(0x2190, 111, ARROWS) \ -UNICODE_RANGE(0x2200, 255, MATHEMATICAL_OPERATORS) \ -UNICODE_RANGE(0x2300, 255, MISCELLANEOUS_TECHNICAL) \ -UNICODE_RANGE(0x2400, 63, CONTROL_PICTURES) \ -UNICODE_RANGE(0x2440, 31, OPTICAL_CHARACTER_RECOGNITION) \ -UNICODE_RANGE(0x2460, 159, ENCLOSED_ALPHANUMERICS) \ -UNICODE_RANGE(0x2500, 127, BOX_DRAWING) \ -UNICODE_RANGE(0x2580, 31, BLOCK_ELEMENTS) \ -UNICODE_RANGE(0x25a0, 95, GEOMETRIC_SHAPES) \ -UNICODE_RANGE(0x2600, 255, MISCELLANEOUS_SYMBOLS) \ -UNICODE_RANGE(0x2700, 191, DINGBATS) \ -UNICODE_RANGE(0x27c0, 47, MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A) \ -UNICODE_RANGE(0x27f0, 15, SUPPLEMENTAL_ARROWS_A) \ -UNICODE_RANGE(0x2800, 255, BRAILLE_PATTERNS) \ -UNICODE_RANGE(0x2900, 127, SUPPLEMENTAL_ARROWS_B) \ -UNICODE_RANGE(0x2980, 127, MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B) \ -UNICODE_RANGE(0x2a00, 255, SUPPLEMENTAL_MATHEMATICAL_OPERATORS) \ -UNICODE_RANGE(0x2b00, 255, MISCELLANEOUS_SYMBOLS_AND_ARROWS) \ -UNICODE_RANGE(0x2e80, 127, CJK_RADICALS_SUPPLEMENT) \ -UNICODE_RANGE(0x2f00, 223, KANGXI_RADICALS) \ -UNICODE_RANGE(0x2ff0, 15, IDEOGRAPHIC_DESCRIPTION_CHARACTERS) \ -UNICODE_RANGE(0x3000, 63, CJK_SYMBOLS_AND_PUNCTUATION) \ -UNICODE_RANGE(0x3040, 95, HIRAGANA) \ -UNICODE_RANGE(0x30a0, 95, KATAKANA) \ -UNICODE_RANGE(0x3100, 47, BOPOMOFO) \ -UNICODE_RANGE(0x3130, 95, HANGUL_COMPATIBILITY_JAMO) \ -UNICODE_RANGE(0x3190, 15, KANBUN_KUNTEN) \ -UNICODE_RANGE(0x31a0, 31, BOPOMOFO_EXTENDED) \ -UNICODE_RANGE(0x31f0, 15, KATAKANA_PHONETIC_EXTENSIONS) \ -UNICODE_RANGE(0x3200, 255, ENCLOSED_CJK_LETTERS_AND_MONTHS) \ -UNICODE_RANGE(0x3300, 255, CJK_COMPATIBILITY) \ -UNICODE_RANGE(0x3400, 6591, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A) \ -UNICODE_RANGE(0x4dc0, 63, YIJING_HEXAGRAM_SYMBOLS) \ -UNICODE_RANGE(0x4e00, 20911, CJK_UNIFIED_IDEOGRAPHS) \ -UNICODE_RANGE(0xa000, 1167, YI_SYLLABLES) \ -UNICODE_RANGE(0xa490, 63, YI_RADICALS) \ -UNICODE_RANGE(0xac00, 11183, HANGUL_SYLLABLES) \ -UNICODE_RANGE(0xd800, 1023, HIGH_SURROGATE_AREA) \ -UNICODE_RANGE(0xdc00, 1023, LOW_SURROGATE_AREA) \ -UNICODE_RANGE(0xe000, 6399, PRIVATE_USE_AREA) \ -UNICODE_RANGE(0xf900, 511, CJK_COMPATIBILITY_IDEOGRAPHS) \ -UNICODE_RANGE(0xfb00, 79, ALPHABETIC_PRESENTATION_FORMS) \ -UNICODE_RANGE(0xfb50, 687, ARABIC_PRESENTATION_FORMS_A) \ -UNICODE_RANGE(0xfe00, 15, VARIATION_SELECTORS) \ -UNICODE_RANGE(0xfe20, 15, COMBINING_HALF_MARKS) \ -UNICODE_RANGE(0xfe30, 31, CJK_COMPATIBILITY_FORMS) \ -UNICODE_RANGE(0xfe50, 31, SMALL_FORM_VARIANTS) \ -UNICODE_RANGE(0xfe70, 143, ARABIC_PRESENTATION_FORMS_B) \ -UNICODE_RANGE(0xff00, 239, HALFWIDTH_AND_FULLWIDTH_FORMS) \ -UNICODE_RANGE(0xfff0, 15, SPECIALS) \ -UNICODE_RANGE(0x10000, 127, LINEAR_B_SYLLABARY) \ -UNICODE_RANGE(0x10080, 127, LINEAR_B_IDEOGRAMS) \ -UNICODE_RANGE(0x10100, 63, AEGEAN_NUMBERS) \ -UNICODE_RANGE(0x10300, 47, OLD_ITALIC) \ -UNICODE_RANGE(0x10330, 31, GOTHIC) \ -UNICODE_RANGE(0x10380, 31, UGARITIC) \ -UNICODE_RANGE(0x10400, 79, DESERET) \ -UNICODE_RANGE(0x10450, 47, SHAVIAN) \ -UNICODE_RANGE(0x10480, 47, OSMANYA) \ -UNICODE_RANGE(0x10800, 63, CYPRIOT_SYLLABARY) \ -UNICODE_RANGE(0x1d000, 255, BYZANTINE_MUSICAL_SYMBOLS) \ -UNICODE_RANGE(0x1d100, 255, MUSICAL_SYMBOLS) \ -UNICODE_RANGE(0x1d300, 95, TAI_XUAN_JING_SYMBOLS) \ -UNICODE_RANGE(0x1d400, 1023, MATHEMATICAL_ALPHANUMERIC_SYMBOLS) \ -UNICODE_RANGE(0x20000, 42719, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B) \ -UNICODE_RANGE(0x2f800, 543, CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT) \ -UNICODE_RANGE(0xe0000, 127, TAGS) \ -UNICODE_RANGE(0xe0100, 239, VARIATION_SELECTORS_SUPPLEMENT) \ -UNICODE_RANGE(0xf0000, 65533, SUPPLEMENTARY_PRIVATE_USE_AREA_A) \ -UNICODE_RANGE(0x100000, 65533, SUPPLEMENTARY_PRIVATE_USE_AREA_B) +#define OC_UNICODE_RANGES \ +OC_UNICODE_RANGE(0x0000, 127, BASIC_LATIN) \ +OC_UNICODE_RANGE(0x0080, 127, C1_CONTROLS_AND_LATIN_1_SUPPLEMENT) \ +OC_UNICODE_RANGE(0x0100, 127, LATIN_EXTENDED_A) \ +OC_UNICODE_RANGE(0x0180, 207, LATIN_EXTENDED_B) \ +OC_UNICODE_RANGE(0x0250, 95, IPA_EXTENSIONS) \ +OC_UNICODE_RANGE(0x02b0, 79, SPACING_MODIFIER_LETTERS) \ +OC_UNICODE_RANGE(0x0300, 111, COMBINING_DIACRITICAL_MARKS) \ +OC_UNICODE_RANGE(0x0370, 143, GREEK_COPTIC) \ +OC_UNICODE_RANGE(0x0400, 255, CYRILLIC) \ +OC_UNICODE_RANGE(0x0500, 47, CYRILLIC_SUPPLEMENT) \ +OC_UNICODE_RANGE(0x0530, 95, ARMENIAN) \ +OC_UNICODE_RANGE(0x0590, 111, HEBREW) \ +OC_UNICODE_RANGE(0x0600, 255, ARABIC) \ +OC_UNICODE_RANGE(0x0700, 79, SYRIAC) \ +OC_UNICODE_RANGE(0x0780, 63, THAANA) \ +OC_UNICODE_RANGE(0x0900, 127, DEVANAGARI) \ +OC_UNICODE_RANGE(0x0980, 127, BENGALI_ASSAMESE) \ +OC_UNICODE_RANGE(0x0a00, 127, GURMUKHI) \ +OC_UNICODE_RANGE(0x0a80, 127, GUJARATI) \ +OC_UNICODE_RANGE(0x0b00, 127, ORIYA) \ +OC_UNICODE_RANGE(0x0b80, 127, TAMIL) \ +OC_UNICODE_RANGE(0x0c00, 127, TELUGU) \ +OC_UNICODE_RANGE(0x0c80, 127, KANNADA) \ +OC_UNICODE_RANGE(0x0d00, 255, MALAYALAM) \ +OC_UNICODE_RANGE(0x0d80, 127, SINHALA) \ +OC_UNICODE_RANGE(0x0e00, 127, THAI) \ +OC_UNICODE_RANGE(0x0e80, 127, LAO) \ +OC_UNICODE_RANGE(0x0f00, 255, TIBETAN) \ +OC_UNICODE_RANGE(0x1000, 159, MYANMAR) \ +OC_UNICODE_RANGE(0x10a0, 95, GEORGIAN) \ +OC_UNICODE_RANGE(0x1100, 255, HANGUL_JAMO) \ +OC_UNICODE_RANGE(0x1200, 383, ETHIOPIC) \ +OC_UNICODE_RANGE(0x13a0, 95, CHEROKEE) \ +OC_UNICODE_RANGE(0x1400, 639, UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS) \ +OC_UNICODE_RANGE(0x1680, 31, OGHAM) \ +OC_UNICODE_RANGE(0x16a0, 95, RUNIC) \ +OC_UNICODE_RANGE(0x1700, 31, TAGALOG) \ +OC_UNICODE_RANGE(0x1720, 31, HANUNOO) \ +OC_UNICODE_RANGE(0x1740, 31, BUHID) \ +OC_UNICODE_RANGE(0x1760, 31, TAGBANWA) \ +OC_UNICODE_RANGE(0x1780, 127, KHMER) \ +OC_UNICODE_RANGE(0x1800, 175, MONGOLIAN) \ +OC_UNICODE_RANGE(0x1900, 79, LIMBU) \ +OC_UNICODE_RANGE(0x1950, 47, TAI_LE) \ +OC_UNICODE_RANGE(0x19e0, 31, KHMER_SYMBOLS) \ +OC_UNICODE_RANGE(0x1d00, 127, PHONETIC_EXTENSIONS) \ +OC_UNICODE_RANGE(0x1e00, 255, LATIN_EXTENDED_ADDITIONAL) \ +OC_UNICODE_RANGE(0x1f00, 255, GREEK_EXTENDED) \ +OC_UNICODE_RANGE(0x2000, 111, GENERAL_PUNCTUATION) \ +OC_UNICODE_RANGE(0x2070, 47, SUPERSCRIPTS_AND_SUBSCRIPTS) \ +OC_UNICODE_RANGE(0x20a0, 47, CURRENCY_SYMBOLS) \ +OC_UNICODE_RANGE(0x20d0, 47, COMBINING_DIACRITICAL_MARKS_FOR_SYMBOLS) \ +OC_UNICODE_RANGE(0x2100, 79, LETTERLIKE_SYMBOLS) \ +OC_UNICODE_RANGE(0x2150, 63, NUMBER_FORMS) \ +OC_UNICODE_RANGE(0x2190, 111, ARROWS) \ +OC_UNICODE_RANGE(0x2200, 255, MATHEMATICAL_OPERATORS) \ +OC_UNICODE_RANGE(0x2300, 255, MISCELLANEOUS_TECHNICAL) \ +OC_UNICODE_RANGE(0x2400, 63, CONTROL_PICTURES) \ +OC_UNICODE_RANGE(0x2440, 31, OPTICAL_CHARACTER_RECOGNITION) \ +OC_UNICODE_RANGE(0x2460, 159, ENCLOSED_ALPHANUMERICS) \ +OC_UNICODE_RANGE(0x2500, 127, BOX_DRAWING) \ +OC_UNICODE_RANGE(0x2580, 31, BLOCK_ELEMENTS) \ +OC_UNICODE_RANGE(0x25a0, 95, GEOMETRIC_SHAPES) \ +OC_UNICODE_RANGE(0x2600, 255, MISCELLANEOUS_SYMBOLS) \ +OC_UNICODE_RANGE(0x2700, 191, DINGBATS) \ +OC_UNICODE_RANGE(0x27c0, 47, MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A) \ +OC_UNICODE_RANGE(0x27f0, 15, SUPPLEMENTAL_ARROWS_A) \ +OC_UNICODE_RANGE(0x2800, 255, BRAILLE_PATTERNS) \ +OC_UNICODE_RANGE(0x2900, 127, SUPPLEMENTAL_ARROWS_B) \ +OC_UNICODE_RANGE(0x2980, 127, MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B) \ +OC_UNICODE_RANGE(0x2a00, 255, SUPPLEMENTAL_MATHEMATICAL_OPERATORS) \ +OC_UNICODE_RANGE(0x2b00, 255, MISCELLANEOUS_SYMBOLS_AND_ARROWS) \ +OC_UNICODE_RANGE(0x2e80, 127, CJK_RADICALS_SUPPLEMENT) \ +OC_UNICODE_RANGE(0x2f00, 223, KANGXI_RADICALS) \ +OC_UNICODE_RANGE(0x2ff0, 15, IDEOGRAPHIC_DESCRIPTION_CHARACTERS) \ +OC_UNICODE_RANGE(0x3000, 63, CJK_SYMBOLS_AND_PUNCTUATION) \ +OC_UNICODE_RANGE(0x3040, 95, HIRAGANA) \ +OC_UNICODE_RANGE(0x30a0, 95, KATAKANA) \ +OC_UNICODE_RANGE(0x3100, 47, BOPOMOFO) \ +OC_UNICODE_RANGE(0x3130, 95, HANGUL_COMPATIBILITY_JAMO) \ +OC_UNICODE_RANGE(0x3190, 15, KANBUN_KUNTEN) \ +OC_UNICODE_RANGE(0x31a0, 31, BOPOMOFO_EXTENDED) \ +OC_UNICODE_RANGE(0x31f0, 15, KATAKANA_PHONETIC_EXTENSIONS) \ +OC_UNICODE_RANGE(0x3200, 255, ENCLOSED_CJK_LETTERS_AND_MONTHS) \ +OC_UNICODE_RANGE(0x3300, 255, CJK_COMPATIBILITY) \ +OC_UNICODE_RANGE(0x3400, 6591, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A) \ +OC_UNICODE_RANGE(0x4dc0, 63, YIJING_HEXAGRAM_SYMBOLS) \ +OC_UNICODE_RANGE(0x4e00, 20911, CJK_UNIFIED_IDEOGRAPHS) \ +OC_UNICODE_RANGE(0xa000, 1167, YI_SYLLABLES) \ +OC_UNICODE_RANGE(0xa490, 63, YI_RADICALS) \ +OC_UNICODE_RANGE(0xac00, 11183, HANGUL_SYLLABLES) \ +OC_UNICODE_RANGE(0xd800, 1023, HIGH_SURROGATE_AREA) \ +OC_UNICODE_RANGE(0xdc00, 1023, LOW_SURROGATE_AREA) \ +OC_UNICODE_RANGE(0xe000, 6399, PRIVATE_USE_AREA) \ +OC_UNICODE_RANGE(0xf900, 511, CJK_COMPATIBILITY_IDEOGRAPHS) \ +OC_UNICODE_RANGE(0xfb00, 79, ALPHABETIC_PRESENTATION_FORMS) \ +OC_UNICODE_RANGE(0xfb50, 687, ARABIC_PRESENTATION_FORMS_A) \ +OC_UNICODE_RANGE(0xfe00, 15, VARIATION_SELECTORS) \ +OC_UNICODE_RANGE(0xfe20, 15, COMBINING_HALF_MARKS) \ +OC_UNICODE_RANGE(0xfe30, 31, CJK_COMPATIBILITY_FORMS) \ +OC_UNICODE_RANGE(0xfe50, 31, SMALL_FORM_VARIANTS) \ +OC_UNICODE_RANGE(0xfe70, 143, ARABIC_PRESENTATION_FORMS_B) \ +OC_UNICODE_RANGE(0xff00, 239, HALFWIDTH_AND_FULLWIDTH_FORMS) \ +OC_UNICODE_RANGE(0xfff0, 15, SPECIALS) \ +OC_UNICODE_RANGE(0x10000, 127, LINEAR_B_SYLLABARY) \ +OC_UNICODE_RANGE(0x10080, 127, LINEAR_B_IDEOGRAMS) \ +OC_UNICODE_RANGE(0x10100, 63, AEGEAN_NUMBERS) \ +OC_UNICODE_RANGE(0x10300, 47, OLD_ITALIC) \ +OC_UNICODE_RANGE(0x10330, 31, GOTHIC) \ +OC_UNICODE_RANGE(0x10380, 31, UGARITIC) \ +OC_UNICODE_RANGE(0x10400, 79, DESERET) \ +OC_UNICODE_RANGE(0x10450, 47, SHAVIAN) \ +OC_UNICODE_RANGE(0x10480, 47, OSMANYA) \ +OC_UNICODE_RANGE(0x10800, 63, CYPRIOT_SYLLABARY) \ +OC_UNICODE_RANGE(0x1d000, 255, BYZANTINE_MUSICAL_SYMBOLS) \ +OC_UNICODE_RANGE(0x1d100, 255, MUSICAL_SYMBOLS) \ +OC_UNICODE_RANGE(0x1d300, 95, TAI_XUAN_JING_SYMBOLS) \ +OC_UNICODE_RANGE(0x1d400, 1023, MATHEMATICAL_ALPHANUMERIC_SYMBOLS) \ +OC_UNICODE_RANGE(0x20000, 42719, CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B) \ +OC_UNICODE_RANGE(0x2f800, 543, CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT) \ +OC_UNICODE_RANGE(0xe0000, 127, TAGS) \ +OC_UNICODE_RANGE(0xe0100, 239, VARIATION_SELECTORS_SUPPLEMENT) \ +OC_UNICODE_RANGE(0xf0000, 65533, SUPPLEMENTARY_PRIVATE_USE_AREA_A) \ +OC_UNICODE_RANGE(0x100000, 65533, SUPPLEMENTARY_PRIVATE_USE_AREA_B) -#define UNICODE_RANGE(start, count, name) \ - MP_API extern const unicode_range _cat2_(UNICODE_RANGE_, name); -UNICODE_RANGES -#undef UNICODE_RANGE +#define OC_UNICODE_RANGE(start, count, name) \ + ORCA_API extern const oc_unicode_range OC_CAT2(OC_UNICODE_, name); +OC_UNICODE_RANGES +#undef OC_UNICODE_RANGE #ifdef __cplusplus } // extern "C" diff --git a/src/wasmbind/clock_api.json b/src/wasmbind/clock_api.json index 0456c08..8044839 100644 --- a/src/wasmbind/clock_api.json +++ b/src/wasmbind/clock_api.json @@ -1,9 +1,9 @@ [ { - "name": "mp_get_time", - "cname": "mp_get_time", + "name": "oc_clock_time", + "cname": "oc_clock_time", "ret": {"name": "time", "tag": "F"}, "args": [ {"name": "clock", - "type": {"name": "mp_clock_kind", "tag": "i"}}] + "type": {"name": "oc_clock_kind", "tag": "i"}}] } ] diff --git a/src/wasmbind/core_api.json b/src/wasmbind/core_api.json index 9059ce4..eb715fa 100644 --- a/src/wasmbind/core_api.json +++ b/src/wasmbind/core_api.json @@ -1,10 +1,10 @@ [ { - "name": "orca_log", - "cname": "orca_log", + "name": "oc_runtime_log", + "cname": "oc_runtime_log", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "level", - "type": {"name": "log_level", "tag": "i"}}, + "type": {"name": "oc_log_level", "tag": "i"}}, {"name": "fileLen", "type": {"name": "int", "tag": "i"}}, {"name": "file", @@ -22,15 +22,15 @@ ] }, { - "name": "orca_mem_grow", - "cname": "orca_mem_grow", + "name": "oc_mem_grow", + "cname": "oc_mem_grow", "ret": {"name": "int", "tag": "i"}, "args": [ {"name": "size", "type": {"name": "u64", "tag": "I"}}] }, { - "name": "orca_runtime_assert_fail", - "cname": "orca_assert_fail", + "name": "oc_runtime_assert_fail", + "cname": "oc_assert_fail", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "file", "type": {"name": "const char*", "tag": "p"}}, @@ -45,8 +45,8 @@ ] }, { - "name": "orca_runtime_abort", - "cname": "orca_abort", + "name": "oc_runtime_abort_ext", + "cname": "oc_abort_ext", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "file", "type": {"name": "const char*", "tag": "p"}}, diff --git a/src/wasmbind/gles_api_bind_manual.c b/src/wasmbind/gles_api_bind_manual.c index a9bdfea..8d622ba 100644 --- a/src/wasmbind/gles_api_bind_manual.c +++ b/src/wasmbind/gles_api_bind_manual.c @@ -55,7 +55,7 @@ u64 orca_gl_type_size(GLenum type) break; default: - ORCA_ASSERT(0, "unknown GLenum type %i", type); + OC_ASSERT(0, "unknown GLenum type %i", type); } return(size); @@ -93,7 +93,7 @@ u64 orca_gl_format_count(GLenum format) break; default: - ORCA_ASSERT(0, "unknow GLenum format %i", format); + OC_ASSERT(0, "unknow GLenum format %i", format); } return(count); @@ -412,7 +412,7 @@ u64 orca_glGet_data_length(GLenum pname) break; default: - ORCA_ASSERT(0, "unknown GLenum pname %i", pname); + OC_ASSERT(0, "unknown GLenum pname %i", pname); break; } } @@ -562,7 +562,7 @@ u64 orca_glClearBuffer_value_length_generic(GLenum buffer) break; default: - ORCA_ASSERT(0, "invalid buffer enum for glClearBuffer()"); + OC_ASSERT(0, "invalid buffer enum for glClearBuffer()"); } return(count); } @@ -693,8 +693,8 @@ u64 orca_glGetUniform_params_length_generic(GLuint program, GLint location) int uniformCount = 0; glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &uniformCount); - mem_arena_scope scratch = mem_scratch_begin(); - char* name = mem_arena_alloc(scratch.arena, maxUniformName+1); + oc_arena_scope scratch = oc_scratch_begin(); + char* name = oc_arena_push(scratch.arena, maxUniformName+1); u64 count = 0; bool found = false; @@ -714,9 +714,9 @@ u64 orca_glGetUniform_params_length_generic(GLuint program, GLint location) break; } } - ORCA_ASSERT(found, "uniform location %i not found for program %i", location, program); + OC_ASSERT(found, "uniform location %i not found for program %i", location, program); - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(count); } @@ -817,7 +817,7 @@ const void* glShaderSource_stub(IM3Runtime runtime, IM3ImportContext _ctx, uint6 i32 lengthArrayOffset = *(i32*)&_sp[3]; int* stringOffsetArray = (int*)((char*)_mem + stringArrayOffset); - const char** stringArray = (const char**)mem_arena_alloc_array(mem_scratch(), char*, count); + const char** stringArray = (const char**)oc_arena_push_array(oc_scratch(), char*, count); for(int i=0; i= (char*)_mem) && (((char*)pointer - (char*)_mem) < m3_GetMemorySize(runtime)), + OC_ASSERT(((char*)pointer >= (char*)_mem) && (((char*)pointer - (char*)_mem) < m3_GetMemorySize(runtime)), "parameter 'pointer' is out of bounds"); - ORCA_ASSERT((char*)pointer + sizeof(i32) <= ((char*)_mem + m3_GetMemorySize(runtime)), + OC_ASSERT((char*)pointer + sizeof(i32) <= ((char*)_mem + m3_GetMemorySize(runtime)), "parameter 'pointer' overflows wasm memory"); } void* rawPointer = 0; @@ -875,7 +875,7 @@ const void* glVertexAttribPointer_stub(IM3Runtime runtime, IM3ImportContext _ctx else { //NOTE: we crash here before letting ANGLE crash because vertex attrib pointer is not set - ORCA_ASSERT("Calling glVertexAttribPointer with a GL_ARRAY_BUFFER binding of 0 is unsafe and disabled in Orca."); + OC_ASSERT("Calling glVertexAttribPointer with a GL_ARRAY_BUFFER binding of 0 is unsafe and disabled in Orca."); } return(0); } @@ -903,7 +903,7 @@ const void* glVertexAttribIPointer_stub(IM3Runtime runtime, IM3ImportContext _ct } else { - ORCA_ASSERT(0, "Calling glVertexAttribIPointer with a GL_ARRAY_BUFFER binding of 0 is unsafe and disabled in Orca."); + OC_ASSERT(0, "Calling glVertexAttribIPointer with a GL_ARRAY_BUFFER binding of 0 is unsafe and disabled in Orca."); } return(0); } @@ -918,38 +918,38 @@ const void* glGetUniformIndices_stub(IM3Runtime runtime, IM3ImportContext _ctx, u64 memorySize = m3_GetMemorySize(runtime); //NOTE: check size of uniformNames { - ORCA_ASSERT(((char*)uniformNames >= (char*)_mem) && (((char*)uniformNames - (char*)_mem) < memorySize), + OC_ASSERT(((char*)uniformNames >= (char*)_mem) && (((char*)uniformNames - (char*)_mem) < memorySize), "parameter 'uniformNames' is out of bounds"); - ORCA_ASSERT((char*)uniformNames + uniformCount * sizeof(u32) <= ((char*)_mem + memorySize), + OC_ASSERT((char*)uniformNames + uniformCount * sizeof(u32) <= ((char*)_mem + memorySize), "parameter 'uniformNames' overflows wasm memory"); } //NOTE: check each individual uniformNames - mem_arena_scope scratch = mem_scratch_begin(); + oc_arena_scope scratch = oc_scratch_begin(); - char** uniformNamesRaw = mem_arena_alloc_array(scratch.arena, char*, uniformCount); + char** uniformNamesRaw = oc_arena_push_array(scratch.arena, char*, uniformCount); for(int i=0; i= (char*)_mem && (raw - (char*)_mem) < memorySize, "uniformName[%i] is out of bounds", i); + OC_ASSERT(raw >= (char*)_mem && (raw - (char*)_mem) < memorySize, "uniformName[%i] is out of bounds", i); u64 len = orca_gles_check_cstring(runtime, raw); - ORCA_ASSERT(raw + len <= ((char*)_mem + memorySize), "uniformName[%i] overflows wasm memory", i); + OC_ASSERT(raw + len <= ((char*)_mem + memorySize), "uniformName[%i] overflows wasm memory", i); uniformNamesRaw[i] = raw; } //NOTE: check size of uniformIndices { - ORCA_ASSERT(((char*)uniformIndices >= (char*)_mem) && (((char*)uniformIndices - (char*)_mem) < memorySize), + OC_ASSERT(((char*)uniformIndices >= (char*)_mem) && (((char*)uniformIndices - (char*)_mem) < memorySize), "parameter 'uniformIndices' is out of bounds"); - ORCA_ASSERT((char*)uniformIndices + uniformCount * sizeof(GLuint) <= ((char*)_mem + memorySize), + OC_ASSERT((char*)uniformIndices + uniformCount * sizeof(GLuint) <= ((char*)_mem + memorySize), "parameter 'uniformIndices' overflows wasm memory"); } glGetUniformIndices(program, uniformCount, (const GLchar* const*)uniformNamesRaw, uniformIndices); - mem_scratch_end(scratch); + oc_scratch_end(scratch); return(0); } @@ -1000,11 +1000,11 @@ void orca_gl_getstring_init(orca_gl_getstring_info* info, char* memory) } glGetIntegerv(GL_NUM_EXTENSIONS, (GLint*)&info->indexedEntryCount); - mem_arena_scope scratch = mem_scratch_begin(); - const char** extensions = mem_arena_alloc(scratch.arena, info->indexedEntryCount); + oc_arena_scope scratch = oc_scratch_begin(); + const char** extensions = oc_arena_push(scratch.arena, info->indexedEntryCount); //NOTE: we will hold this until program terminates - info->indexedEntries = malloc_array(orca_gl_getstring_entry, info->indexedEntryCount); + info->indexedEntries = oc_malloc_array(orca_gl_getstring_entry, info->indexedEntryCount); for(int i=0; iindexedEntryCount; i++) { @@ -1016,7 +1016,7 @@ void orca_gl_getstring_init(orca_gl_getstring_info* info, char* memory) } } - u32 wasmIndex = orca_mem_grow(totalSize); + u32 wasmIndex = oc_mem_grow(totalSize); for(int i=0; iinit = true; } @@ -1098,7 +1098,7 @@ int manual_link_gles_api(IM3Module module) #define M3_LINK_ERROR_HANDLING(name) \ if(res != m3Err_none && res != m3Err_functionLookupFailed) \ { \ - log_error("Couldn't link function " #name " (%s)\n", res); \ + oc_log_error("Couldn't link function " #name " (%s)\n", res); \ ret = -1; \ } diff --git a/src/wasmbind/io_api.json b/src/wasmbind/io_api.json index 359a483..ecb5c14 100644 --- a/src/wasmbind/io_api.json +++ b/src/wasmbind/io_api.json @@ -1,9 +1,9 @@ [ { - "name": "io_wait_single_req", - "cname": "orca_io_wait_single_req", - "ret": {"name": "io_cmp", "tag": "S"}, + "name": "oc_io_wait_single_req", + "cname": "oc_runtime_io_wait_single_req", + "ret": {"name": "oc_io_cmp", "tag": "S"}, "args": [ {"name": "req", - "type": {"name": "io_req*", "tag": "p"}}] + "type": {"name": "oc_io_req*", "tag": "p"}}] } ] diff --git a/src/wasmbind/surface_api.json b/src/wasmbind/surface_api.json index 5c329df..942f8bd 100644 --- a/src/wasmbind/surface_api.json +++ b/src/wasmbind/surface_api.json @@ -1,85 +1,85 @@ [ { - "name": "mg_image_size", - "cname": "mg_image_size", - "ret": {"name": "vec2", "tag": "S"}, + "name": "oc_image_size", + "cname": "oc_image_size", + "ret": {"name": "oc_vec2", "tag": "S"}, "args": [ {"name": "image", - "type": {"name": "mg_image", "tag": "S"}}] + "type": {"name": "oc_image", "tag": "S"}}] }, { - "name": "mg_image_create", - "cname": "mg_image_create", - "ret": {"name": "mg_image", "tag": "S"}, + "name": "oc_image_create", + "cname": "oc_image_create", + "ret": {"name": "oc_image", "tag": "S"}, "args": [ {"name": "surface", - "type": {"name": "mg_surface", "tag": "S"}}, + "type": {"name": "oc_surface", "tag": "S"}}, {"name": "width", "type": {"name": "u32", "tag": "i"}}, {"name": "height", "type": {"name": "u32", "tag": "i"}}] }, { - "name": "mg_image_destroy", - "cname": "mg_image_destroy", + "name": "oc_image_destroy", + "cname": "oc_image_destroy", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "image", - "type": {"name": "mg_image", "tag": "S"}}] + "type": {"name": "oc_image", "tag": "S"}}] }, { - "name": "mg_image_upload_region_rgba8", - "cname": "mg_image_upload_region_rgba8", + "name": "oc_image_upload_region_rgba8", + "cname": "oc_image_upload_region_rgba8", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "image", - "type": {"name": "mg_image", "tag": "S"}}, + "type": {"name": "oc_image", "tag": "S"}}, {"name": "region", - "type": {"name": "mp_rect", "tag": "S"}}, + "type": {"name": "oc_rect", "tag": "S"}}, {"name": "pixels", "type": {"name": "u8*", "tag": "p"}}] }, { - "name": "mg_surface_prepare", - "cname": "mg_surface_prepare", + "name": "oc_surface_select", + "cname": "oc_surface_select", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "surface", - "type": {"name": "mg_surface", "tag": "S"}}] + "type": {"name": "oc_surface", "tag": "S"}}] }, { - "name": "mg_surface_present", - "cname": "mg_surface_present", + "name": "oc_surface_present", + "cname": "oc_surface_present", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "surface", - "type": {"name": "mg_surface", "tag": "S"}}] + "type": {"name": "oc_surface", "tag": "S"}}] }, { - "name": "mg_surface_render_commands", + "name": "oc_surface_render_commands", "cname": "orca_surface_render_commands", "ret": {"name": "void", "tag": "v"}, "args": [ {"name": "surface", - "type": {"name": "mg_surface", "tag": "S"}}, + "type": {"name": "oc_surface", "tag": "S"}}, {"name": "clearColor", - "type": {"name": "mg_color", "tag": "S"}}, + "type": {"name": "oc_color", "tag": "S"}}, {"name": "primitiveCount", "type": {"name": "u32", "tag": "i"}}, {"name": "primitives", - "type": {"name": "mg_primitive*", "tag": "p"}}, + "type": {"name": "oc_primitive*", "tag": "p"}}, {"name": "eltCount", "type": {"name": "u32", "tag": "i"}}, {"name": "elements", - "type": {"name": "mg_path_elt*", "tag": "p"}}] + "type": {"name": "oc_path_elt*", "tag": "p"}}] }, { - "name": "mg_surface_canvas", + "name": "oc_surface_canvas", "cname": "orca_surface_canvas", - "ret": {"name": "mg_surface", "tag": "S"}, + "ret": {"name": "oc_surface", "tag": "S"}, "args": [] }, { - "name": "mg_surface_gles", + "name": "oc_surface_gles", "cname": "orca_surface_gles", - "ret": {"name": "mg_surface", "tag": "S"}, + "ret": {"name": "oc_surface", "tag": "S"}, "args": [] } ] diff --git a/tests/files/build.sh b/tests/files/build.sh index 1ea05ff..7441e66 100755 --- a/tests/files/build.sh +++ b/tests/files/build.sh @@ -6,7 +6,7 @@ SRCDIR=../../milepost/src INCLUDES="-I$SRCDIR -I$SRCDIR/util -I$SRCDIR/platform -I$SRCDIR/app" LIBS="-L$LIBDIR -lmilepost" -FLAGS="-mmacos-version-min=10.15.4 -DDEBUG -DLOG_COMPILE_DEBUG" +FLAGS="-mmacos-version-min=10.15.4 -DOC_DEBUG -DLOG_COMPILE_DEBUG" if [ ! \( -e bin \) ] ; then mkdir ./bin