Lights: Make possible for gpu drivers to unroll loop.
GPU doesn't like indirect addressing and thus it's better to have unrolled loop. This is only possible for loop with a static iteration count. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14830 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4c725ac8f4
commit
a2d1a86bac
@ -3,7 +3,6 @@ uniform sampler2D ntex;
|
|||||||
uniform vec4 center[16];
|
uniform vec4 center[16];
|
||||||
uniform vec4 col[16];
|
uniform vec4 col[16];
|
||||||
uniform float energy[16];
|
uniform float energy[16];
|
||||||
uniform int lightcount;
|
|
||||||
uniform float spec;
|
uniform float spec;
|
||||||
uniform vec2 screen;
|
uniform vec2 screen;
|
||||||
uniform mat4 invproj;
|
uniform mat4 invproj;
|
||||||
@ -19,7 +18,7 @@ void main() {
|
|||||||
|
|
||||||
vec3 diffuse = vec3(0.), specular = vec3(0.);
|
vec3 diffuse = vec3(0.), specular = vec3(0.);
|
||||||
|
|
||||||
for (int i = 0; i < lightcount; ++i) {
|
for (int i = 0; i < 16; ++i) {
|
||||||
vec4 pseudocenter = viewm * vec4(center[i].xyz, 1.0);
|
vec4 pseudocenter = viewm * vec4(center[i].xyz, 1.0);
|
||||||
pseudocenter /= pseudocenter.w;
|
pseudocenter /= pseudocenter.w;
|
||||||
vec3 light_pos = pseudocenter.xyz;
|
vec3 light_pos = pseudocenter.xyz;
|
||||||
|
@ -364,7 +364,6 @@ void PointLightProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
|||||||
srv->setVertexShaderConstant("col[0]", m_color.data(), m_color.size());
|
srv->setVertexShaderConstant("col[0]", m_color.data(), m_color.size());
|
||||||
srv->setVertexShaderConstant("center[0]", m_pos.data(), m_pos.size());
|
srv->setVertexShaderConstant("center[0]", m_pos.data(), m_pos.size());
|
||||||
srv->setVertexShaderConstant("viewm", m_view.pointer(), 16);
|
srv->setVertexShaderConstant("viewm", m_view.pointer(), 16);
|
||||||
srv->setVertexShaderConstant("lightcount", &lightcount, 1);
|
|
||||||
|
|
||||||
if (!firstdone)
|
if (!firstdone)
|
||||||
{
|
{
|
||||||
|
@ -760,6 +760,18 @@ void IrrDriver::renderLights(const core::aabbox3df& cambox,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Fill lights
|
||||||
|
for (; lightnum < MAXLIGHT; lightnum++) {
|
||||||
|
accumulatedLightPos.push_back(0.);
|
||||||
|
accumulatedLightPos.push_back(0.);
|
||||||
|
accumulatedLightPos.push_back(0.);
|
||||||
|
accumulatedLightPos.push_back(0.);
|
||||||
|
accumulatedLightColor.push_back(0.);
|
||||||
|
accumulatedLightColor.push_back(0.);
|
||||||
|
accumulatedLightColor.push_back(0.);
|
||||||
|
accumulatedLightColor.push_back(0.);
|
||||||
|
accumulatedLightEnergy.push_back(0.);
|
||||||
|
}
|
||||||
LightNode::renderLightSet(accumulatedLightPos, accumulatedLightColor, accumulatedLightEnergy);
|
LightNode::renderLightSet(accumulatedLightPos, accumulatedLightColor, accumulatedLightEnergy);
|
||||||
// Handle SSAO
|
// Handle SSAO
|
||||||
SMaterial m_material;
|
SMaterial m_material;
|
||||||
|
Loading…
Reference in New Issue
Block a user