From da45d163889e8e0f5675a0e5102d9fa036f10d03 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 18 Feb 2022 17:38:27 -0500 Subject: [PATCH] Protect against buffers that actually don't have their contents mapped --- engine/renderer/src/imguipass.cpp | 3 +++ engine/renderer/src/shadowpass.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/engine/renderer/src/imguipass.cpp b/engine/renderer/src/imguipass.cpp index 9f92ba5..86bbfb2 100755 --- a/engine/renderer/src/imguipass.cpp +++ b/engine/renderer/src/imguipass.cpp @@ -216,6 +216,9 @@ void ImGuiPass::update_buffers(RenderTarget& target, const ImDrawData& draw_data auto vtx_map = engine->get_gfx()->get_buffer_contents(target.vertex_buffer[target.current_frame]); auto idx_map = engine->get_gfx()->get_buffer_contents(target.index_buffer[target.current_frame]); + if(vtx_map == nullptr || idx_map == nullptr) + return; + auto vtx_dst = (ImDrawVert*)vtx_map; auto idx_dst = (ImDrawIdx*)idx_map; diff --git a/engine/renderer/src/shadowpass.cpp b/engine/renderer/src/shadowpass.cpp index dc6911e..2d7f99c 100755 --- a/engine/renderer/src/shadowpass.cpp +++ b/engine/renderer/src/shadowpass.cpp @@ -264,6 +264,9 @@ void ShadowPass::render_point(GFXCommandBuffer* command_buffer, Scene& scene, pr if((last_point_light + 1) == max_point_shadows) return; + + if(point_location_map == nullptr) + return; if(scene.point_light_dirty[last_point_light] || light.use_dynamic_shadows) { const prism::float3 lightPos = scene.get(light_object).get_world_position();