From 6d94de494ec0723d702254ae1a1347a66329ccd5 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Thu, 1 Jun 2023 05:07:24 -0500 Subject: [PATCH] hwr2: Only upload lighttable if currently valid --- src/hwr2/pass_resource_managers.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hwr2/pass_resource_managers.cpp b/src/hwr2/pass_resource_managers.cpp index a12cb19aa..550f5a015 100644 --- a/src/hwr2/pass_resource_managers.cpp +++ b/src/hwr2/pass_resource_managers.cpp @@ -181,8 +181,11 @@ void MainPaletteManager::upload_palette(Rhi& rhi, Handle ctx) void MainPaletteManager::upload_lighttables(Rhi& rhi, Handle ctx) { - tcb::span colormap_bytes = tcb::as_bytes(tcb::span(colormaps, kPaletteSize * kLighttableRows)); - rhi.update_texture(ctx, lighttable_, {0, 0, kPaletteSize, kLighttableRows}, PixelFormat::kR8, colormap_bytes); + if (colormaps != nullptr) + { + tcb::span colormap_bytes = tcb::as_bytes(tcb::span(colormaps, kPaletteSize * kLighttableRows)); + rhi.update_texture(ctx, lighttable_, {0, 0, kPaletteSize, kLighttableRows}, PixelFormat::kR8, colormap_bytes); + } if (encoremap != nullptr) {