From 86296209c8ebf21a1f1d5d6248d7c632ba721f56 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Thu, 21 Apr 2022 23:16:24 +0300 Subject: [PATCH] Remove query_array usage from deferred renderer --- libs/gfx/source/renderer/deferred.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/gfx/source/renderer/deferred.cpp b/libs/gfx/source/renderer/deferred.cpp index dbb0daca..c164d6f8 100644 --- a/libs/gfx/source/renderer/deferred.cpp +++ b/libs/gfx/source/renderer/deferred.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include @@ -872,7 +871,7 @@ void main(){} gfx::mesh screen_mesh; - query_array queries; + std::vector queries; gfx::array box_array; std::optional> prev_transform; }; @@ -1018,7 +1017,11 @@ void main(){} std::size_t const bins_total = opts.grid_size[0] * opts.grid_size[1] * opts.grid_size[2]; if (impl().queries.size() < bins_total) + { + auto old_size = impl().queries.size(); impl().queries.resize(bins_total); + gl::GenQueries(bins_total - old_size, impl().queries.data() + old_size); + } // Get camera info @@ -1306,8 +1309,9 @@ void main(){} impl().occlusion_pass_program["u_box_min"] = geom::vector{b.bbox[0].min, b.bbox[1].min, b.bbox[2].min}; impl().occlusion_pass_program["u_box_max"] = geom::vector{b.bbox[0].max, b.bbox[1].max, b.bbox[2].max}; - auto query_scope = impl().queries.begin(bi, gl::ANY_SAMPLES_PASSED); + gl::BeginQuery(gl::ANY_SAMPLES_PASSED, impl().queries[bi]); gl::DrawArrays(gl::TRIANGLES, 0, 36); + gl::EndQuery(gl::ANY_SAMPLES_PASSED); } gl::DepthMask(gl::TRUE);