[vulkan] Increase matrix id bits

I had missed that upping max lights to 2048 meant that up to 12288
matrices are needed for all the possible lights. This made it so the
light type could not be encoded in id_data, but the shaders never used
it anyway. This leaves one bit free.
This commit is contained in:
Bill Currie 2023-12-13 12:20:10 +09:00
parent 39616bc84d
commit 7506117e43
3 changed files with 9 additions and 8 deletions

View file

@ -60,7 +60,7 @@ enum {
};
typedef struct qfv_light_render_s {
// mat_id (0,13) map_id (13,5) layer (18,11) type (29,2)
// mat_id (0,14) map_id (14,5) layer (19,11) nostyle (31,1)
uint32_t id_data;
// light style (6)
uint32_t style;

View file

@ -48,9 +48,9 @@ main (void)
float I = (1 - a.w * r.y) / dot (a, r);
uint id_data = renderer[id].id_data;
uint mat_id = bitfieldExtract (id_data, 0, 13);
uint map_id = bitfieldExtract (id_data, 13, 5);
uint layer = bitfieldExtract (id_data, 18, 11);
uint mat_id = bitfieldExtract (id_data, 0, 14);
uint map_id = bitfieldExtract (id_data, 14, 5);
uint layer = bitfieldExtract (id_data, 19, 11);
I *= shadow (map_id, layer, mat_id, p, l.position.xyz);

View file

@ -335,12 +335,13 @@ make_id (uint32_t matrix_index, uint32_t map_index, uint32_t layer,
uint32_t type)
{
if (type == ST_CUBE) {
// on the GPU, layer is the cube layer, and one cube layer is 6
// flat image layers
layer /= 6;
}
return ((matrix_index & 0x1fff) << 0)
| ((map_index & 0x1f) << 13)
| ((layer & 0x7ff) << 18)
| ((type & 3) << 29);
return ((matrix_index & 0x3fff) << 0)
| ((map_index & 0x1f) << 14)
| ((layer & 0x7ff) << 19);
}
static void