feat: add spot light shadows with a tilled buffer

This commit is contained in:
2026-10-18 12:56:52 +02:00
parent 4bd99b25d1
commit 65a7310b56
19 changed files with 519 additions and 122 deletions
+12 -1
View File
@@ -7,6 +7,10 @@
#define TYPE_POINT_LIGHT 1
#define TYPE_SPOT_LIGHT 2
#define NO_SHADOW 0xFFFFFFFFu
// Must match ShadowMapPipeline::MAX_SPOT_SHADOWS
#define MAX_SPOT_SHADOWS 16
// Forward+ tiling, must match LightCullingPipeline::TILE_SIZE / MAX_LIGHTS_PER_TILE
#define LIGHT_TILE_SIZE 16
#define MAX_LIGHTS_PER_TILE 255
@@ -27,10 +31,17 @@ struct Light {
float spotInnerCos;
float spotOuterCos;
uint castShadows;
// NO_SHADOW, or the light's slot in the shadow data of its type
uint shadowIndex;
float padding;
};
// Must match GPUSpotShadow in Light.h
struct SpotShadow {
mat4 lightViewProj;
float normalOffsetPerMeter;
};
layout (buffer_reference, std430) readonly buffer LightsBuffer {
Light data[];
};