From 26a5159c77b6874ebc005ab1ae91777a67e6d1d2 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sat, 13 Jan 2024 23:54:56 +0100 Subject: [PATCH] pointlights: Add comment to explain the *4 --- lib/ivis_opengl/pielighting.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ivis_opengl/pielighting.cpp b/lib/ivis_opengl/pielighting.cpp index 1e374657dc4..0fe6ea5651a 100644 --- a/lib/ivis_opengl/pielighting.cpp +++ b/lib/ivis_opengl/pielighting.cpp @@ -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 lightList; for (size_t i = 0; i < gfx_api::bucket_dimension; i++) {