quakeforge/libs/video/renderer/vulkan/shader/lighting_cube.frag
Bill Currie a626dc7ca8 [vulkan] Split the lighting pass into per-type passes
This takes care of the type punning issue by each pass using the correct
sampler type with the correct view types bound. Also, point light and
spot light shadow maps are now guaranteed to be separated (it was just
luck that they were before) and spot light maps may be significantly
smaller as their cone angle is taken into account. Lighting is quite
borked, but at least the engine is running again.
2023-08-02 19:34:26 +09:00

17 lines
456 B
GLSL

#version 450
#extension GL_GOOGLE_include_directive : enable
layout (set = 0, binding = 0) buffer ShadowMatrices {
mat4 shadow_mats[];
};
layout (set = 3, binding = 0) uniform samplerCubeArrayShadow shadow_map[32];
float
shadow (uint map_id, uint layer, uint mat_id, vec3 pos)
{
vec4 p = shadow_mats[mat_id] * vec4 (pos, 1);
float depth = (p / p.w).z;
return texture (shadow_map[map_id], vec4 (p.xyz, layer), depth);
}
#include "lighting_main.finc"