17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-11 15:44:35 +01:00

fix: the bugs and vulnerabilities SonarCloud reports on PR #216

This commit is contained in:
2026-11-07 22:11:08 +01:00
parent 8e85def98f
commit 7667e5b2ec
65 changed files with 910 additions and 121 deletions

View File

@@ -3705,7 +3705,8 @@ void opengl46_renderer::Render_Instances_Indirect()
part( m_cullparts.record );
using command_set = opengl46_instance_cull::command_set;
auto const twophase { m_instancecull.two_phase() };
// two phases only with the occlusion test, which needs the viewport
auto const twophase { useocclusion && m_instancecull.two_phase() };
auto const draws { false == m_indirectdraws.empty() };
// the depth comes first in the depth pass of the whole scene, which has its state set and leaves the colour to the colour
// pass (m_indirectcolourpending), and with the depth prepass of the instances: the colour pass shades only what stays in
@@ -6380,7 +6381,8 @@ void opengl46_renderer::Render_local_shadows()
// only the light buffers with the lamps read the maps
auto const *vehicle{Global.gfx_lights_clustered ? m_locallights.cab_lamp_vehicle() : nullptr};
m_localshadows.update_cab(vehicle, (vehicle != nullptr ? vehicle->mdKabina : nullptr), m_locallights.cab_lights(), m_framestamp);
if (m_localshadows.cab_draws().empty())
// without a vehicle there are no draws either
if ((vehicle == nullptr) || m_localshadows.cab_draws().empty())
return;
glDebug("render lamp shadows");
@@ -6423,7 +6425,8 @@ void opengl46_renderer::Render_cab_probe()
// the lights of the cab light the probe when they're lights of the frame
std::vector<gfx::local_lights::cab_light> const nolights;
auto const &lights{(vehicle != nullptr) && (m_locallights.cab_lamp_vehicle() == vehicle) ? m_locallights.cab_lights() : nolights};
if (false == m_cabprobe.update_wanted(vehicle, (vehicle != nullptr ? vehicle->mdKabina : nullptr), center, extent, lights, m_framestamp))
// update_wanted() wants no update without a vehicle, but is called anyway to forget the probe
if ((false == m_cabprobe.update_wanted(vehicle, (vehicle != nullptr ? vehicle->mdKabina : nullptr), center, extent, lights, m_framestamp)) || (vehicle == nullptr))
return;
glDebug("render cab probe");