increase draw buffers

This commit is contained in:
John Alanbrook 2023-06-07 13:41:09 +00:00
parent 6a1a06be76
commit 6c0e850180
5 changed files with 15 additions and 5 deletions

View file

@ -19,7 +19,7 @@
#include "font.h" #include "font.h"
#define v_amt 1000 #define v_amt 5000
static sg_shader point_shader; static sg_shader point_shader;
static sg_pipeline point_pipe; static sg_pipeline point_pipe;

View file

@ -193,8 +193,6 @@ struct sFont *MakeFont(const char *fontfile, int height) {
newfont->emscale = stbtt_ScaleForMappingEmToPixels(&fontinfo, 16); newfont->emscale = stbtt_ScaleForMappingEmToPixels(&fontinfo, 16);
newfont->linegap = (newfont->ascent - newfont->descent)* 2 * newfont->emscale; 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){ newfont->texID = sg_make_image(&(sg_image_desc){
.type = SG_IMAGETYPE_2D, .type = SG_IMAGETYPE_2D,
.width = packsize, .width = packsize,

View file

@ -365,7 +365,7 @@ void openglRender(struct window *window) {
sg_shader sg_compile_shader(const char *v, const char *f, sg_shader_desc *d) 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 *vs = slurp_text(v);
char *fs = slurp_text(f); char *fs = slurp_text(f);

View file

@ -29,6 +29,8 @@ struct sprite_vert {
struct rgba color; struct rgba color;
}; };
static int num_spriteverts = 5000;
static sg_shader slice9_shader; static sg_shader slice9_shader;
static sg_pipeline slice9_pipe; static sg_pipeline slice9_pipe;
static sg_bindings slice9_bind; static sg_bindings slice9_bind;
@ -171,7 +173,7 @@ void sprite_initialize() {
}); });
bind_sprite.vertex_buffers[0] = sg_make_buffer(&(sg_buffer_desc){ 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, .type = SG_BUFFERTYPE_VERTEXBUFFER,
.usage = SG_USAGE_STREAM, .usage = SG_USAGE_STREAM,
.label = "sprite vertex buffer", .label = "sprite vertex buffer",

View file

@ -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 = { var Nuke = {
newline(cols) { nuke(3, cols ? cols : 1); }, newline(cols) { nuke(3, cols ? cols : 1); },