rsx: Implement precise ZCULL stats

This commit is contained in:
kd-11 2021-09-04 21:50:53 +03:00 committed by kd-11
parent 0525070898
commit 472efc08eb
7 changed files with 62 additions and 58 deletions

View file

@ -3377,7 +3377,10 @@ namespace rsx
switch (type)
{
case CELL_GCM_ZPASS_PIXEL_CNT:
value = value ? u16{umax} : 0;
if (!g_cfg.video.precise_zpass_count)
{
value = value ? u16{ umax } : 0;
}
break;
case CELL_GCM_ZCULL_STATS3:
value = value ? 0 : u16{umax};
@ -3470,7 +3473,9 @@ namespace rsx
ensure(query->pending);
const bool implemented = (writer.type == CELL_GCM_ZPASS_PIXEL_CNT || writer.type == CELL_GCM_ZCULL_STATS3);
if (implemented && !result && query->num_draws)
const bool have_result = result && !g_cfg.video.precise_zpass_count;
if (implemented && !have_result && query->num_draws)
{
get_occlusion_query_result(query);
@ -3622,55 +3627,30 @@ namespace rsx
ensure(query->pending);
const bool implemented = (writer.type == CELL_GCM_ZPASS_PIXEL_CNT || writer.type == CELL_GCM_ZCULL_STATS3);
if (force_read)
{
if (implemented && !result && query->num_draws)
{
get_occlusion_query_result(query);
const bool have_result = result && !g_cfg.video.precise_zpass_count;
if (query->result)
{
result += query->result;
if (query->data_type & CELL_GCM_ZPASS_PIXEL_CNT)
{
m_statistics_map[writer.counter_tag] += query->result;
}
}
}
else
if (!implemented || !query->num_draws || have_result)
{
discard_occlusion_query(query);
}
else if (force_read || check_occlusion_query_status(query))
{
get_occlusion_query_result(query);
if (query->result)
{
//No need to read this
discard_occlusion_query(query);
result += query->result;
if (query->data_type & CELL_GCM_ZPASS_PIXEL_CNT)
{
m_statistics_map[writer.counter_tag] += query->result;
}
}
}
else
{
if (implemented && !result && query->num_draws)
{
//Maybe we get lucky and results are ready
if (check_occlusion_query_status(query))
{
get_occlusion_query_result(query);
if (query->result)
{
result += query->result;
if (query->data_type & CELL_GCM_ZPASS_PIXEL_CNT)
{
m_statistics_map[writer.counter_tag] += query->result;
}
}
}
else
{
//Too early; abort
break;
}
}
else
{
//Not necessary to read the result anymore
discard_occlusion_query(query);
}
// Too early; abort
ensure(!force_read && implemented);
break;
}
free_query(query);