Commit ee726d00 authored by Johannes Braun's avatar Johannes Braun
Browse files

Remove size-zero buffer binding for ligths

parent 0082c27e
......@@ -355,7 +355,7 @@ void Renderer::render(const glm::mat4& view, const glm::mat4& projection)
m_cameraInfo.assign(CameraInfo(view, projection));
// update light buffer
if(m_lightBuffer.size() != static_cast<GLsizeiptr>(m_lights.size()))
if(m_lightBuffer.size() < static_cast<GLsizeiptr>(m_lights.size()))
{
m_lightBuffer.resize(m_lights.size(), GL_DYNAMIC_STORAGE_BIT);
}
......@@ -369,7 +369,10 @@ void Renderer::render(const glm::mat4& view, const glm::mat4& projection)
lights.push_back(static_cast<Light>(*lightPtr.second));
});
m_lightBuffer.assign(lights);
m_lightBuffer.bind(GL_SHADER_STORAGE_BUFFER, LIGHTS_STORAGE_BINDING);
if (lights.size() > 0)
m_lightBuffer.bind(GL_SHADER_STORAGE_BUFFER, LIGHTS_STORAGE_BINDING, 0, lights.size());
else
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, LIGHTS_STORAGE_BINDING, 0);
glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
......@@ -397,7 +400,7 @@ void Renderer::render(const glm::mat4& view, const glm::mat4& projection)
m_smBuffer.resize(shadowMaps.size(), GL_DYNAMIC_STORAGE_BIT);
m_smBuffer.assign(shadowMaps);
if (shadowMaps.size() > 0)
m_smBuffer.bind(GL_SHADER_STORAGE_BUFFER, SM_STORAGE_BINDING);
m_smBuffer.bind(GL_SHADER_STORAGE_BUFFER, SM_STORAGE_BINDING, 0, shadowMaps.size());
else
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, SM_STORAGE_BINDING, 0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment