mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 21:21:14 +00:00
Batching shadow map rendering needs be able to reference matrices for multiple lights in a single batch, but the only input is the view index, so use that to look up the matrix index rather than using it to index the matrices directly (modulo the base index that's still there).
30 lines
675 B
GLSL
30 lines
675 B
GLSL
#version 450
|
|
#extension GL_GOOGLE_include_directive : enable
|
|
#extension GL_EXT_multiview : enable
|
|
|
|
layout (set = 0, binding = 0) buffer ShadowView {
|
|
mat4x4 shadowView[];
|
|
};
|
|
|
|
layout (set = 0, binding = 1) buffer ShadowId {
|
|
uint shadowId[];
|
|
};
|
|
|
|
layout (push_constant) uniform PushConstants {
|
|
mat4 Model;
|
|
float blend;
|
|
uint MatrixBase;
|
|
};
|
|
|
|
layout (location = 0) in vec4 vertexa;
|
|
layout (location = 1) in vec3 normala;
|
|
layout (location = 2) in vec4 vertexb;
|
|
layout (location = 3) in vec3 normalb;
|
|
|
|
void
|
|
main (void)
|
|
{
|
|
vec4 pos = mix (vertexa, vertexb, blend);
|
|
uint matid = shadowId[MatrixBase + gl_ViewIndex];
|
|
gl_Position = shadowView[matid] * (Model * pos);
|
|
}
|