Clamp skybox to prevent +inf overflow

This commit is contained in:
2025-12-08 01:31:30 +01:00
parent d760e9e259
commit df43975af4

View File

@@ -41,6 +41,11 @@ pub fn load(filename: []const u8, engine: *Engine, cube_size: u32, global_unifor
defer img.deinit();
std.debug.assert(img.num_components == 4);
// clamp +inf to max half float
for (std.mem.bytesAsSlice(f16, img.data)) |*sample| {
sample.* = @min(sample.*, std.math.floatMax(f16));
}
// --- SYNCHRONIZATION PRIMITIVES ------------------------------------------
const semaphore_transfer_transition = try engine.createSemaphore();