mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
[vulkan] Early out from lights that are too distant
Gives a 43% speed boost to bigass1 timedemo (366 -> 525 fps).
This commit is contained in:
parent
4eecbe867d
commit
de581501fb
1 changed files with 6 additions and 1 deletions
|
@ -28,12 +28,17 @@ layout (location = 0) out vec4 frag_color;
|
|||
vec3
|
||||
calc_light (LightData light, vec3 position, vec3 normal)
|
||||
{
|
||||
float r = light.radius;
|
||||
vec3 dist = light.position - position;
|
||||
float d = sqrt (dot (dist, dist));
|
||||
if (d > r) {
|
||||
// the light is too far away
|
||||
return vec3 (0);
|
||||
}
|
||||
|
||||
vec3 incoming = dist / d;
|
||||
float spotdot = dot (incoming, light.direction);
|
||||
float lightdot = dot (incoming, normal);
|
||||
float r = light.radius;
|
||||
|
||||
int style = light.data & 0x7f;
|
||||
// deliberate array index error: access intensity2 as well
|
||||
|
|
Loading…
Reference in a new issue