Skip to content

Commit

Permalink
pointlights: Add comment to explain the *4
Browse files Browse the repository at this point in the history
  • Loading branch information
vlj committed Jan 13, 2024
1 parent 92c20e7 commit 8cd2d90
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ivis_opengl/pielighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ void renderingNew::LightingManager::ComputeFrameData(const LightingData& data, L
// Iterate over all buckets
size_t overallId = 0;
size_t bucketId = 0;

// GLSL std layout 140 force us to store array of int with the same stride as
// an array of ivec4, wasting 3/4 of the storage.
// To circumvent this, we pack 4 consecutives index in a ivec4 here, and unpack the value in the shader.
std::array<size_t, gfx_api::max_indexed_lights * 4> lightList;
for (size_t i = 0; i < gfx_api::bucket_dimension; i++)
{
Expand Down

0 comments on commit 8cd2d90

Please sign in to comment.