From 774f04a0f7e70e134dcf41269e6ab754faa95ff7 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sun, 13 Mar 2022 11:48:22 -0400 Subject: [PATCH] add FIXME notes, and update global TODO list --- include/shader.h | 3 +++ include/tangerine.h | 12 +++++++----- src/shader.cpp | 7 ++++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/shader.h b/include/shader.h index 2d5cadb..2c26226 100644 --- a/include/shader.h +++ b/include/shader.h @@ -162,6 +162,9 @@ GLContext* initGLContext(MemoryArena* arena, u32 max_textures, u32 max_ubos); +// TODO: add more notes here describing the internals? This is the entry point +// to a complex process of programatically assigning properties to our notion +// of what a shader needs ie) uniforms, buffer block bindings, etc // NOTE: every shader program is assumed to have one uniform block named // "matrices" that contains the projection and view matrices, and one uniform // named "node_xform" for the node matrix diff --git a/include/tangerine.h b/include/tangerine.h index 1b16c3f..d1e3d1e 100644 --- a/include/tangerine.h +++ b/include/tangerine.h @@ -13,18 +13,19 @@ * gameplay. So, we need to extend MemoryArena to be a pool allocator * instead of an allocate only linear allocator * - add libTangerine namespace? -* - merge back into libTangerine -* - make separate shaders for per vertex, and per pixel/fragment lighting -* see red book chapter 7 -* - add a bloom/blur render to texture shader for light sources? -* https://learnopengl.com/Advanced-Lighting/Bloom * - clean up examples with new asset system * - merge render_group_fix branch back into master * - make a test case for overflowing default array sizes, rg->assets * rg_info->groups, render_group->enitities, rg->textures +* - test for video memory leaking since we're not actually deleting GLBuffers +* anywhere * - look for glm::mat4 in structs, and replace with pointers (easier debugging) * - resizable arrays for entities and asset system * - defaults include for various #defines +* - make separate shaders for per vertex, and per pixel/fragment lighting +* see red book chapter 7 +* - add a bloom/blur render to texture shader for light sources? +* https://learnopengl.com/Advanced-Lighting/Bloom * * === TODONE: === * - don't allocate Asset structure on asset arena @@ -61,6 +62,7 @@ * - add ambient light to LightsBuffer structure * - remember to update offsets in initLights() * - use rg_arena for store GLMeshes, see initGLMesh() +* - merge back into libTangerine */ diff --git a/src/shader.cpp b/src/shader.cpp index cf41e96..ead5ef3 100644 --- a/src/shader.cpp +++ b/src/shader.cpp @@ -85,6 +85,8 @@ addShaderProgram(MemoryArena* arena, snprintf(input_str, max_len, "%s%s", vs, fs); u64 hash = utilFNV64a_str(input_str); + // FIXME: replace with utilCStrMatch, and remove getShaderByHash, we don't + // need a hashing function if we're not storing in a hash table if (getShaderByHash(gl_ctx, hash)) { LOGF(Error, "shader is already loaded\n"); return false; @@ -319,11 +321,13 @@ initGLAttribBuffer(GLBuffer* buf, GLenum target, GLVertexAttrib* attrib) buf->target = target; buf->data_type = attrib->data_type; buf->location = attrib->location; + // FIXME: this should be allocated on the same arena as the parent GLBuffer + // with utilAllocateCStr buf->name = utilAllocateCStr(attrib->name); } // TODO: might as well pass in pointer to GLMesh, since that's how we're -// going to use this, can void copying GLMesh twice that way +// going to use this, can avoid copying GLMesh twice that way GLMesh loadGLMesh(MemoryArena* arena, const Mesh& m, @@ -363,6 +367,7 @@ loadGLMesh(MemoryArena* arena, glEnableVertexAttribArray(attrib->location); } + // FIXME: should we be re-using initGLAttribBuffer here? glGenBuffers(1, &glm.element_buf->id); glm.element_buf->target = GL_ELEMENT_ARRAY_BUFFER; glm.element_buf->data_type = GL_UNSIGNED_SHORT;