mirror of https://github.com/RPCS3/rpcs3.git
rsx: Simplify ZCULL logic a bit
This commit is contained in:
parent
850eef0c1a
commit
0b7e013fbe
|
@ -134,7 +134,7 @@ namespace rsx
|
||||||
if (m_pending_writes.empty())
|
if (m_pending_writes.empty())
|
||||||
{
|
{
|
||||||
// No need to queue this if there is no pending request in the pipeline anyway
|
// No need to queue this if there is no pending request in the pipeline anyway
|
||||||
write(sink, ptimer->timestamp(), type, m_statistics_map[m_statistics_tag_id]);
|
write(sink, ptimer->timestamp(), type, m_statistics_map[m_statistics_tag_id].result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ namespace rsx
|
||||||
|
|
||||||
ptimer->async_tasks_pending++;
|
ptimer->async_tasks_pending++;
|
||||||
|
|
||||||
if (m_statistics_map[m_statistics_tag_id] != 0)
|
if (m_statistics_map[m_statistics_tag_id].result != 0)
|
||||||
{
|
{
|
||||||
// Flush guaranteed results; only one positive is needed
|
// Flush guaranteed results; only one positive is needed
|
||||||
update(ptimer);
|
update(ptimer);
|
||||||
|
@ -256,7 +256,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
m_statistics_tag_id++;
|
m_statistics_tag_id++;
|
||||||
m_statistics_map[m_statistics_tag_id] = 0;
|
m_statistics_map[m_statistics_tag_id] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZCULL_control::on_draw()
|
void ZCULL_control::on_draw()
|
||||||
|
@ -326,7 +326,7 @@ namespace rsx
|
||||||
if (!writer->forwarder)
|
if (!writer->forwarder)
|
||||||
{
|
{
|
||||||
// No other queries in the chain, write result
|
// No other queries in the chain, write result
|
||||||
const auto value = (writer->type == CELL_GCM_ZPASS_PIXEL_CNT) ? m_statistics_map[writer->counter_tag] : result;
|
const auto value = (writer->type == CELL_GCM_ZPASS_PIXEL_CNT) ? m_statistics_map[writer->counter_tag].result : result;
|
||||||
write(writer, ptimer->timestamp(), value);
|
write(writer, ptimer->timestamp(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,38 +379,30 @@ namespace rsx
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto query = writer.query;
|
auto query = writer.query;
|
||||||
u32 result = m_statistics_map[writer.counter_tag];
|
auto& counter = m_statistics_map[writer.counter_tag];
|
||||||
|
|
||||||
if (query)
|
if (query)
|
||||||
{
|
{
|
||||||
ensure(query->pending);
|
ensure(query->pending);
|
||||||
|
|
||||||
const bool implemented = (writer.type == CELL_GCM_ZPASS_PIXEL_CNT || writer.type == CELL_GCM_ZCULL_STATS3);
|
const bool implemented = (writer.type == CELL_GCM_ZPASS_PIXEL_CNT || writer.type == CELL_GCM_ZCULL_STATS3);
|
||||||
const bool have_result = result && !g_cfg.video.precise_zpass_count;
|
const bool have_result = counter.result && !g_cfg.video.precise_zpass_count;
|
||||||
|
|
||||||
if (implemented && !have_result && query->num_draws)
|
if (implemented && !have_result && query->num_draws)
|
||||||
{
|
{
|
||||||
get_occlusion_query_result(query);
|
get_occlusion_query_result(query);
|
||||||
|
counter.result += query->result;
|
||||||
if (query->result)
|
|
||||||
{
|
|
||||||
result += query->result;
|
|
||||||
if (query->data_type & CELL_GCM_ZPASS_PIXEL_CNT)
|
|
||||||
{
|
|
||||||
m_statistics_map[writer.counter_tag] += query->result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Already have a hit, no need to retest
|
// Already have a hit, no need to retest
|
||||||
discard_occlusion_query(query);
|
discard_occlusion_query(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
free_query(query);
|
free_query(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
retire(ptimer, &writer, result);
|
retire(ptimer, &writer, counter.result);
|
||||||
processed++;
|
processed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +518,7 @@ namespace rsx
|
||||||
}
|
}
|
||||||
|
|
||||||
auto query = writer.query;
|
auto query = writer.query;
|
||||||
u32 result = m_statistics_map[writer.counter_tag];
|
auto& counter = m_statistics_map[writer.counter_tag];
|
||||||
|
|
||||||
const bool force_read = (sync_address != 0);
|
const bool force_read = (sync_address != 0);
|
||||||
if (force_read && writer.sink == sync_address && !writer.forwarder)
|
if (force_read && writer.sink == sync_address && !writer.forwarder)
|
||||||
|
@ -540,7 +532,7 @@ namespace rsx
|
||||||
ensure(query->pending);
|
ensure(query->pending);
|
||||||
|
|
||||||
const bool implemented = (writer.type == CELL_GCM_ZPASS_PIXEL_CNT || writer.type == CELL_GCM_ZCULL_STATS3);
|
const bool implemented = (writer.type == CELL_GCM_ZPASS_PIXEL_CNT || writer.type == CELL_GCM_ZCULL_STATS3);
|
||||||
const bool have_result = result && !g_cfg.video.precise_zpass_count;
|
const bool have_result = counter.result && !g_cfg.video.precise_zpass_count;
|
||||||
|
|
||||||
if (!implemented || !query->num_draws || have_result)
|
if (!implemented || !query->num_draws || have_result)
|
||||||
{
|
{
|
||||||
|
@ -549,15 +541,7 @@ namespace rsx
|
||||||
else if (force_read || check_occlusion_query_status(query))
|
else if (force_read || check_occlusion_query_status(query))
|
||||||
{
|
{
|
||||||
get_occlusion_query_result(query);
|
get_occlusion_query_result(query);
|
||||||
|
counter.result += query->result;
|
||||||
if (query->result)
|
|
||||||
{
|
|
||||||
result += query->result;
|
|
||||||
if (query->data_type & CELL_GCM_ZPASS_PIXEL_CNT)
|
|
||||||
{
|
|
||||||
m_statistics_map[writer.counter_tag] += query->result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -571,7 +555,7 @@ namespace rsx
|
||||||
|
|
||||||
stat_tag_to_remove = writer.counter_tag;
|
stat_tag_to_remove = writer.counter_tag;
|
||||||
|
|
||||||
retire(ptimer, &writer, result);
|
retire(ptimer, &writer, counter.result);
|
||||||
processed++;
|
processed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,12 @@ namespace rsx
|
||||||
std::vector<occlusion_query_info*> queries;
|
std::vector<occlusion_query_info*> queries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct query_stat_counter
|
||||||
|
{
|
||||||
|
u32 result;
|
||||||
|
u32 reserved;
|
||||||
|
};
|
||||||
|
|
||||||
enum sync_control
|
enum sync_control
|
||||||
{
|
{
|
||||||
sync_none = 0,
|
sync_none = 0,
|
||||||
|
@ -84,7 +90,7 @@ namespace rsx
|
||||||
u64 m_timer = 0;
|
u64 m_timer = 0;
|
||||||
|
|
||||||
std::vector<queued_report_write> m_pending_writes{};
|
std::vector<queued_report_write> m_pending_writes{};
|
||||||
std::unordered_map<u32, u32> m_statistics_map{};
|
std::unordered_map<u32, query_stat_counter> m_statistics_map{};
|
||||||
|
|
||||||
// Enables/disables the ZCULL unit
|
// Enables/disables the ZCULL unit
|
||||||
void set_active(class ::rsx::thread* ptimer, bool state, bool flush_queue);
|
void set_active(class ::rsx::thread* ptimer, bool state, bool flush_queue);
|
||||||
|
|
|
@ -36,15 +36,10 @@ namespace vk
|
||||||
}
|
}
|
||||||
case VK_NOT_READY:
|
case VK_NOT_READY:
|
||||||
{
|
{
|
||||||
if (result[0] && (flags & VK_QUERY_RESULT_PARTIAL_BIT))
|
query.any_passed = !!result[0];
|
||||||
{
|
query.ready = query.any_passed && !!(flags & VK_QUERY_RESULT_PARTIAL_BIT);
|
||||||
query.any_passed = true;
|
|
||||||
query.ready = true;
|
|
||||||
query.data = result[0];
|
query.data = result[0];
|
||||||
return true;
|
return query.ready;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
die_with_error(error);
|
die_with_error(error);
|
||||||
|
|
Loading…
Reference in New Issue