rsx/gl: Fix zcull queries and log conditional render modes

- Fixes a situation where a query readback is requested while zcull render is still active
This commit is contained in:
kd-11 2017-08-06 23:06:13 +03:00
parent ae440a92ac
commit 4c019c55d2
4 changed files with 23 additions and 7 deletions

View File

@ -1181,8 +1181,10 @@ bool GLGSRender::scaled_image_from_memory(rsx::blit_src_info& src, rsx::blit_dst
return m_gl_texture_cache.upload_scaled_image(src, dst, interpolate, m_rtts);
}
void GLGSRender::check_zcull_status(bool framebuffer_swap)
void GLGSRender::check_zcull_status(bool framebuffer_swap, bool force_read)
{
bool testing_enabled = zcull_pixel_cnt_enabled || zcull_stats_enabled;
if (framebuffer_swap)
{
zcull_surface_active = false;
@ -1206,7 +1208,6 @@ void GLGSRender::check_zcull_status(bool framebuffer_swap)
}
}
bool testing_enabled = zcull_pixel_cnt_enabled || zcull_stats_enabled;
occlusion_query_info* query = nullptr;
if (zcull_task_queue.task_stack.size() > 0)
@ -1214,7 +1215,7 @@ void GLGSRender::check_zcull_status(bool framebuffer_swap)
if (query && query->active)
{
if (!zcull_rendering_enabled || !testing_enabled || !zcull_surface_active)
if (force_read || (!zcull_rendering_enabled || !testing_enabled || !zcull_surface_active))
{
glEndQuery(GL_ANY_SAMPLES_PASSED);
query->active = false;
@ -1241,13 +1242,27 @@ void GLGSRender::clear_zcull_stats(u32 type)
{
if (type == CELL_GCM_ZPASS_PIXEL_CNT)
{
//synchronize_zcull_stats(true);
if (zcull_task_queue.active_query &&
zcull_task_queue.active_query->active)
{
//discard active query if any
check_zcull_status(false, true);
}
current_zcull_stats.clear();
}
}
u32 GLGSRender::get_zcull_stats(u32 type)
{
if (zcull_task_queue.active_query &&
zcull_task_queue.active_query->active &&
current_zcull_stats.zpass_pixel_cnt == 0)
{
//The zcull unit is still bound as the read is happening and there are no results ready
check_zcull_status(false, true);
}
switch (type)
{
case CELL_GCM_ZPASS_PIXEL_CNT:
@ -1323,5 +1338,5 @@ u32 GLGSRender::synchronize_zcull_stats(bool hard_sync)
void GLGSRender::notify_zcull_info_changed()
{
check_zcull_status(false);
check_zcull_status(false, false);
}

View File

@ -397,7 +397,7 @@ public:
bool scaled_image_from_memory(rsx::blit_src_info& src_info, rsx::blit_dst_info& dst_info, bool interpolate) override;
void check_zcull_status(bool framebuffer_swap);
void check_zcull_status(bool framebuffer_swap, bool force_read);
u32 synchronize_zcull_stats(bool hard_sync = false);
protected:

View File

@ -246,7 +246,7 @@ void GLGSRender::init_buffers(bool skip_reading)
framebuffer_status_valid = draw_fbo.check();
if (!framebuffer_status_valid) return;
check_zcull_status(true);
check_zcull_status(true, false);
draw_fbo.bind();
set_viewport();

View File

@ -406,6 +406,7 @@ namespace rsx
return;
case 2:
rsx->conditional_render_enabled = true;
LOG_WARNING(RSX, "Conditional rendering mode enabled (mode 2)");
break;
default:
rsx->conditional_render_enabled = false;