From 6c0e850180c32d5b404e8b7240f6d6de3d891b6a Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Wed, 7 Jun 2023 13:41:09 +0000 Subject: [PATCH] increase draw buffers --- source/engine/debug/debugdraw.c | 2 +- source/engine/font.c | 2 -- source/engine/openglrender.c | 2 +- source/engine/sprite.c | 4 +++- source/scripts/debug.js | 10 ++++++++++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/engine/debug/debugdraw.c b/source/engine/debug/debugdraw.c index 33c7922..1024e29 100644 --- a/source/engine/debug/debugdraw.c +++ b/source/engine/debug/debugdraw.c @@ -19,7 +19,7 @@ #include "font.h" -#define v_amt 1000 +#define v_amt 5000 static sg_shader point_shader; static sg_pipeline point_pipe; diff --git a/source/engine/font.c b/source/engine/font.c index e6082a4..181fda5 100644 --- a/source/engine/font.c +++ b/source/engine/font.c @@ -193,8 +193,6 @@ struct sFont *MakeFont(const char *fontfile, int height) { newfont->emscale = stbtt_ScaleForMappingEmToPixels(&fontinfo, 16); newfont->linegap = (newfont->ascent - newfont->descent)* 2 * newfont->emscale; - YughWarn("Font ascent descent is %g", (newfont->ascent-newfont->descent)*newfont->emscale); - newfont->texID = sg_make_image(&(sg_image_desc){ .type = SG_IMAGETYPE_2D, .width = packsize, diff --git a/source/engine/openglrender.c b/source/engine/openglrender.c index 016e378..0232d3f 100644 --- a/source/engine/openglrender.c +++ b/source/engine/openglrender.c @@ -365,7 +365,7 @@ void openglRender(struct window *window) { sg_shader sg_compile_shader(const char *v, const char *f, sg_shader_desc *d) { - YughWarn("Making shader with %s and %s", v, f); + YughInfo("Making shader with %s and %s", v, f); char *vs = slurp_text(v); char *fs = slurp_text(f); diff --git a/source/engine/sprite.c b/source/engine/sprite.c index 5299535..617de93 100644 --- a/source/engine/sprite.c +++ b/source/engine/sprite.c @@ -29,6 +29,8 @@ struct sprite_vert { struct rgba color; }; +static int num_spriteverts = 5000; + static sg_shader slice9_shader; static sg_pipeline slice9_pipe; static sg_bindings slice9_bind; @@ -171,7 +173,7 @@ void sprite_initialize() { }); bind_sprite.vertex_buffers[0] = sg_make_buffer(&(sg_buffer_desc){ - .size = sizeof(struct sprite_vert) * 500, + .size = sizeof(struct sprite_vert) * num_spriteverts, .type = SG_BUFFERTYPE_VERTEXBUFFER, .usage = SG_USAGE_STREAM, .label = "sprite vertex buffer", diff --git a/source/scripts/debug.js b/source/scripts/debug.js index d69200b..8bce471 100644 --- a/source/scripts/debug.js +++ b/source/scripts/debug.js @@ -85,6 +85,16 @@ var Gizmos = { }, }; +var Profile = { + cpu(fn, times) { + times ??= 1; + var start = Date.now(); + for (var i = 0; i < times; i++) + fn(); + + Log.warn(`Profiled in ${(Date.now()-start)/1000} seconds.`); + }, +}; var Nuke = { newline(cols) { nuke(3, cols ? cols : 1); },