From ec99fb2d0cbb01a3636c749aacfc2071edd83ec2 Mon Sep 17 00:00:00 2001 From: Egor Olefirenko Date: Fri, 2 Feb 2024 02:47:38 +0300 Subject: [PATCH] fix codestyle issues 2 --- src/Layers/xrRender_R2/r2_R_lights.cpp | 21 +++++++++++---------- src/xrGame/space_restriction_shape.cpp | 10 ++++++---- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/Layers/xrRender_R2/r2_R_lights.cpp b/src/Layers/xrRender_R2/r2_R_lights.cpp index d88a8d92785..2d245b19000 100644 --- a/src/Layers/xrRender_R2/r2_R_lights.cpp +++ b/src/Layers/xrRender_R2/r2_R_lights.cpp @@ -43,6 +43,7 @@ void CRender::render_lights(light_Package& LP) } } + // 2. refactor { xr_vector& source = LP.v_shadowed; xr_vector refactored; @@ -129,14 +130,14 @@ void CRender::render_lights(light_Package& LP) } }; - const auto& flush_lights = [] (CRender& render, xr_vector& lights_queue) + const auto& flush_lights = [] (xr_vector& lights_queue) { for (const auto& [L, task, batch_id] : lights_queue) { VERIFY(task); TaskScheduler->Wait(*task); - auto& dsgraph = render.get_context(batch_id); + auto& dsgraph = RImplementation.get_context(batch_id); const bool bNormal = !dsgraph.mapNormalPasses[0][0].empty() || !dsgraph.mapMatrixPasses[0][0].empty(); const bool bSpecial = !dsgraph.mapNormalPasses[1][0].empty() || !dsgraph.mapMatrixPasses[1][0].empty() || @@ -145,27 +146,27 @@ void CRender::render_lights(light_Package& LP) { PIX_EVENT_CTX(dsgraph.cmd_list, SHADOWED_LIGHT); - render.Stats.s_merged++; + RImplementation.Stats.s_merged++; L_spot_s.push_back(L); - render.Target->phase_smap_spot(dsgraph.cmd_list, L); + RImplementation.Target->phase_smap_spot(dsgraph.cmd_list, L); dsgraph.cmd_list.set_xform_world(Fidentity); dsgraph.cmd_list.set_xform_view(L->X.S.view); dsgraph.cmd_list.set_xform_project(L->X.S.project); dsgraph.render_graph(0); if (ps_r2_ls_flags.test(R2FLAG_SUN_DETAILS)) { - if (check_grass_shadow(L, render.ViewBase)) + if (check_grass_shadow(L, RImplementation.ViewBase)) { - render.Details->fade_distance = -1; // Use light position to calc "fade" - render.Details->light_position.set(L->position); - render.Details->Render(dsgraph.cmd_list); + RImplementation.Details->fade_distance = -1; // Use light position to calc "fade" + RImplementation.Details->light_position.set(L->position); + RImplementation.Details->Render(dsgraph.cmd_list); } } L->X.S.transluent = FALSE; if (bSpecial) { L->X.S.transluent = TRUE; - render.Target->phase_smap_spot_tsh(dsgraph.cmd_list, L); + RImplementation.Target->phase_smap_spot_tsh(dsgraph.cmd_list, L); PIX_EVENT_CTX(dsgraph.cmd_list, SHADOWED_LIGHTS_RENDER_GRAPH); dsgraph.render_graph(1); // normal level, secondary priority PIX_EVENT_CTX(dsgraph.cmd_list, SHADOWED_LIGHTS_RENDER_SORTED); @@ -174,7 +175,7 @@ void CRender::render_lights(light_Package& LP) } else { - render.Stats.s_finalclip++; + RImplementation.Stats.s_finalclip++; } L->svis[batch_id].end(); // NOTE(DX11): occqs are fetched here, this should be done on the imm context only diff --git a/src/xrGame/space_restriction_shape.cpp b/src/xrGame/space_restriction_shape.cpp index b574cdcaf94..dfddf02133f 100644 --- a/src/xrGame/space_restriction_shape.cpp +++ b/src/xrGame/space_restriction_shape.cpp @@ -86,10 +86,11 @@ void CSpaceRestrictionShape::fill_shape(const CCF_Shape::shape_def& shape) std::mutex mergeMutex; auto [begin, end] = graph.get_range(start, dest); - xr_parallel_for(TaskRange(begin, end), [this, &mergeMutex, &graph] (const auto& range) { + xr_parallel_for(TaskRange(begin, end), [this, &mergeMutex, &graph] (const auto& range) + { xr_vector m_border_chunk; m_border_chunk.reserve(range.size()); - for (auto &vertex : range) + for (const auto& vertex : range) { if (inside(graph.vertex_id(&vertex), true) && !inside(graph.vertex_id(&vertex), false)) @@ -103,10 +104,11 @@ void CSpaceRestrictionShape::fill_shape(const CCF_Shape::shape_def& shape) }); #ifdef DEBUG - xr_parallel_for(TaskRange(begin, end), [this, &mergeMutex, &graph] (const auto& range) { + xr_parallel_for(TaskRange(begin, end), [this, &mergeMutex, &graph] (const auto& range) + { xr_vector m_test_storage_chunk; m_test_storage_chunk.reserve(range.size()); - for (auto &vertex : range) + for (const auto& vertex : range) { if (inside(graph.vertex_id(&vertex), false)) m_test_storage_chunk.push_back(graph.vertex_id(&vertex));