Browse Source

add note about LightsBuffer being fragile if changed

main
cinnaboot 4 years ago
parent
commit
7ad8cadb77
  1. 1
      src/tangerine.cpp
  2. 4
      src/tangerine.h

1
src/tangerine.cpp

@ -313,7 +313,6 @@ initLights(MemoryArena* arena, GLContext* gl_ctx, u32 max_lights)
{
// FIXME: revisit for 'Scene' abstraction
// TODO: we need a way to do this automatically somehow
LightsBuffer* lb = ARENA_ALLOC(arena, LightsBuffer, 1);
lb->buf_size = 8 * sizeof(u32) // NOTE: 'header'
+ 6 * max_lights * sizeof(glm::vec4); // NOTE: vector arrays

4
src/tangerine.h

@ -120,6 +120,10 @@ struct GLClearColor
// pointers are required to start on 16 byte boundaries as per layout std140,
// so there may be some padding added between the 'header', and the start of
// the arrays
// NOTE: this is also very fragile. Since c/c++ doesn't support reflection, we
// need to manually update 'initLights()' if we ever update this structure.
// And remember to update the 'padding' if the number of 'header' attributes
// change
struct LightsBuffer
{
u32 buf_size;

Loading…
Cancel
Save