Remove query_array usage from deferred renderer

This commit is contained in:
Nikita Lisitsa 2022-04-21 23:16:24 +03:00
parent 2fd8e73738
commit 86296209c8

View file

@ -5,7 +5,6 @@
#include <psemek/gfx/texture.hpp>
#include <psemek/gfx/mesh.hpp>
#include <psemek/gfx/error.hpp>
#include <psemek/gfx/query.hpp>
#include <psemek/gfx/effect/blur.hpp>
#include <psemek/gfx/effect/overlay.hpp>
@ -872,7 +871,7 @@ void main(){}
gfx::mesh screen_mesh;
query_array queries;
std::vector<GLuint> queries;
gfx::array box_array;
std::optional<geom::matrix<float, 4, 4>> 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);