Basic tests and trying to fix address sanitizer errors

This commit is contained in:
Krzosa Karol
2026-03-21 10:10:24 +01:00
parent 207fc65fec
commit 94ee03800d
5 changed files with 46 additions and 23 deletions

View File

@@ -18,22 +18,20 @@ struct VertexList2D {
struct Shader {
GLuint program; // linked program (vertex+fragment)
GLint uni_invHalf; // uniform location for inv half-screen size
GLint uni_texture; // sampler location
GLint uni_invHalf; // uniform location for inv half-screen size
GLint uni_texture; // sampler location
};
VertexList2D Vertices;
int64_t TotalVertexCount;
int64_t TotalVertexCount;
unsigned VBO, VAO;
Shader Shader2D;
Shader Shader2D;
BlockArena RenderArena;
Rect2 CurrentScissor;
Rect2 CurrentScissor;
Font PrimaryFont;
Font SecondaryFont;
// ---------- shaders (ES3 / WebGL2) ----------
static const char *glsl_vshader_es3 = R"==(#version 300 es
precision highp float;
@@ -82,7 +80,6 @@ void GLDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLs
}
}
// ---------- helper: compile/link ----------
static GLuint CompileShaderSrc(GLenum kind, const char *src) {
GLuint s = glCreateShader(kind);
glShaderSource(s, 1, &src, NULL);
@@ -137,7 +134,6 @@ Shader CreateShaderES3(const char *vsrc, const char *fsrc) {
return out;
}
// ---------- InitRender for ES3 ----------
void InitRender() {
#if !OS_WASM
glDebugMessageCallback(&GLDebugCallback, NULL);
@@ -185,7 +181,6 @@ void BeginFrameRender(float wx, float wy) {
CurrentScissor = Rect0Size(wx, wy);
}
// ---------- EndFrameRender for ES3 ----------
void EndFrameRender(float wx, float wy, Color color) {
ProfileFunction();
glEnable(GL_BLEND);
@@ -391,6 +386,9 @@ void ReloadFont(String path, U32 size) {
Scratch scratch;
Atlas atlas = CreateAtlas(scratch, {2048, 2048});
PrimaryFont = CreateFont(&atlas, (uint32_t)ClampBottom(2u, (U32)size), path);
SecondaryFont = CreateFont(&atlas, 12, path);
SecondaryFont.texture_id = PrimaryFont.texture_id = UploadAtlas(&atlas);
PrimaryFont.texture_id = UploadAtlas(&atlas);
}
void CleanupRender() {
Dealloc(&PrimaryFont.glyphs);
}