Base classes for decoupled forward+ renderer and a fix where if you had to many lights in a tile(200-300+) the list would fill up before the end of frustums.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#ifndef LightCullingPass_h__
|
||||
#define LightCullingPass_h__
|
||||
|
||||
#include "IRenderer.h"
|
||||
#include "LightCullingPassState.h"
|
||||
#include "ShaderProgram.h"
|
||||
|
||||
|
||||
class LightCullingPass
|
||||
{
|
||||
public:
|
||||
LightCullingPass();
|
||||
~LightCullingPass();
|
||||
|
||||
|
||||
void GenerateNewFrustum();
|
||||
private:
|
||||
void CullLights();
|
||||
|
||||
void InitializeTextures();
|
||||
void InitializeSSBOs();
|
||||
void InitializeShaderPrograms();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
|
||||
#define MAX_LIGHTS_PER_TILE 1024
|
||||
#define MAX_LIGHTS_PER_TILE 200
|
||||
#define NUM_TILES 3600
|
||||
#define TILE_SIZE 16
|
||||
|
||||
|
||||
@@ -218,8 +218,6 @@ void Renderer::InitializeSSBOs()
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
||||
GLERROR("m_LightSSBO");
|
||||
|
||||
|
||||
|
||||
glGenBuffers(1, &m_LightGridSSBO);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightGridSSBO);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightGrid), &m_LightGrid, GL_DYNAMIC_COPY);
|
||||
@@ -233,7 +231,6 @@ void Renderer::InitializeSSBOs()
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
||||
GLERROR("m_LightOffsetSSBO");
|
||||
|
||||
|
||||
glGenBuffers(1, &m_LightIndexSSBO);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, m_LightIndexSSBO);
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightIndex), &m_LightIndex, GL_DYNAMIC_COPY);
|
||||
@@ -254,8 +251,6 @@ void Renderer::CalculateFrustum()
|
||||
|
||||
m_CalculateFrustumProgram->Bind();
|
||||
|
||||
|
||||
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_FrustumSSBO);
|
||||
glUniformMatrix4fv(glGetUniformLocation(m_CalculateFrustumProgram->GetHandle(), "P"), 1, false, glm::value_ptr(m_Camera->ProjectionMatrix()));
|
||||
glUniform2f(glGetUniformLocation(m_CalculateFrustumProgram->GetHandle(), "ScreenDimensions"), m_Resolution.Width, m_Resolution.Height);
|
||||
@@ -284,7 +279,6 @@ void Renderer::CullLights()
|
||||
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(m_LightOffset), &m_LightOffset, GL_DYNAMIC_COPY);
|
||||
glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
|
||||
|
||||
|
||||
m_LightCullProgram->Bind();
|
||||
glUniformMatrix4fv(glGetUniformLocation(m_LightCullProgram->GetHandle(), "V"), 1, false, glm::value_ptr(m_Camera->ViewMatrix()));
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, m_FrustumSSBO);
|
||||
|
||||
Reference in New Issue
Block a user