mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
Remove redundant command buffer checks
This commit is contained in:
@@ -151,7 +151,6 @@ private:
|
|||||||
void SuspendPm4();
|
void SuspendPm4();
|
||||||
CommandScheduler& GetScheduler() const { return m_renderer.GetCommandScheduler(); }
|
CommandScheduler& GetScheduler() const { return m_renderer.GetCommandScheduler(); }
|
||||||
CommandBuffer& CurrentBuffer() { return GetScheduler().Current(); }
|
CommandBuffer& CurrentBuffer() { return GetScheduler().Current(); }
|
||||||
void CheckBuffer() const { GetScheduler().CheckActive(); }
|
|
||||||
|
|
||||||
RenderContext& m_renderer;
|
RenderContext& m_renderer;
|
||||||
HW::Context m_ctx;
|
HW::Context m_ctx;
|
||||||
|
|||||||
@@ -874,8 +874,6 @@ void CommandProcessor::SetPredication(uint32_t condition, uint32_t op, uint32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::DrawIndex(DrawIndexArgs args) {
|
void CommandProcessor::DrawIndex(DrawIndexArgs args) {
|
||||||
CheckBuffer();
|
|
||||||
|
|
||||||
args.index_type_and_size = m_index_type_and_size;
|
args.index_type_and_size = m_index_type_and_size;
|
||||||
if (args.instance_count == 0) {
|
if (args.instance_count == 0) {
|
||||||
args.instance_count = m_num_instances;
|
args.instance_count = m_num_instances;
|
||||||
@@ -1039,7 +1037,6 @@ void CommandProcessor::DispatchDirect(uint32_t thread_group_x, uint32_t thread_g
|
|||||||
// uint32_t local_z = 1;
|
// uint32_t local_z = 1;
|
||||||
|
|
||||||
{
|
{
|
||||||
CheckBuffer();
|
|
||||||
frame_num = m_renderer.GetGpu().GetFrameNum();
|
frame_num = m_renderer.GetGpu().GetFrameNum();
|
||||||
if (GraphicsRunDebugDumpEnabled()) {
|
if (GraphicsRunDebugDumpEnabled()) {
|
||||||
static std::atomic<uint32_t> log_count {0};
|
static std::atomic<uint32_t> log_count {0};
|
||||||
@@ -1098,13 +1095,10 @@ void CommandProcessor::DispatchIndirect(uint64_t args_addr, uint32_t mode) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_sh_ctx.SetCsWaveSize(Pm4::ComputeWaveSize(mode));
|
m_sh_ctx.SetCsWaveSize(Pm4::ComputeWaveSize(mode));
|
||||||
CheckBuffer();
|
|
||||||
m_renderer.GetRenderExecutor().DispatchIndirect(m_submit_id, CurrentBuffer(), args_addr, mode);
|
m_renderer.GetRenderExecutor().DispatchIndirect(m_submit_id, CurrentBuffer(), args_addr, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::DrawIndexAuto(DrawAutoArgs args) {
|
void CommandProcessor::DrawIndexAuto(DrawAutoArgs args) {
|
||||||
CheckBuffer();
|
|
||||||
|
|
||||||
if (args.instance_count == 0) {
|
if (args.instance_count == 0) {
|
||||||
args.instance_count = m_num_instances;
|
args.instance_count = m_num_instances;
|
||||||
}
|
}
|
||||||
@@ -1126,7 +1120,7 @@ void CommandProcessor::WriteAtEndOfPipe(uint32_t cache_policy, uint32_t event_wr
|
|||||||
uint32_t interrupt_context_id) {
|
uint32_t interrupt_context_id) {
|
||||||
static_assert(sizeof(T) == sizeof(uint32_t) || sizeof(T) == sizeof(uint64_t));
|
static_assert(sizeof(T) == sizeof(uint32_t) || sizeof(T) == sizeof(uint64_t));
|
||||||
|
|
||||||
CheckBuffer();
|
auto& command = CurrentBuffer();
|
||||||
|
|
||||||
if (GraphicsRunDebugDumpEnabled()) {
|
if (GraphicsRunDebugDumpEnabled()) {
|
||||||
const auto bits = static_cast<unsigned>(sizeof(T) * 8u);
|
const auto bits = static_cast<unsigned>(sizeof(T) * 8u);
|
||||||
@@ -1157,7 +1151,7 @@ void CommandProcessor::WriteAtEndOfPipe(uint32_t cache_policy, uint32_t event_wr
|
|||||||
case 0x03: with_interrupt = false; break;
|
case 0x03: with_interrupt = false; break;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
if (!IsAsyncComputeQueue()) {
|
if (!IsAsyncComputeQueue()) {
|
||||||
Sync::TriggerEopEventAtEndOfPipe(CurrentBuffer(), m_interrupt_event_id,
|
Sync::TriggerEopEventAtEndOfPipe(command, m_interrupt_event_id,
|
||||||
interrupt_context_id);
|
interrupt_context_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1174,17 +1168,17 @@ void CommandProcessor::WriteAtEndOfPipe(uint32_t cache_policy, uint32_t event_wr
|
|||||||
|
|
||||||
if (with_interrupt) {
|
if (with_interrupt) {
|
||||||
if (with_writeback) {
|
if (with_writeback) {
|
||||||
Sync::WriteAtEndOfPipeWithInterruptWriteBack32(m_submit_id, CurrentBuffer(), dst,
|
Sync::WriteAtEndOfPipeWithInterruptWriteBack32(m_submit_id, command, dst,
|
||||||
data, m_interrupt_event_id,
|
data, m_interrupt_event_id,
|
||||||
interrupt_context_id);
|
interrupt_context_id);
|
||||||
} else {
|
} else {
|
||||||
Sync::WriteAtEndOfPipeWithInterrupt32(m_submit_id, CurrentBuffer(), dst, data,
|
Sync::WriteAtEndOfPipeWithInterrupt32(m_submit_id, command, dst, data,
|
||||||
m_interrupt_event_id, interrupt_context_id);
|
m_interrupt_event_id, interrupt_context_id);
|
||||||
}
|
}
|
||||||
} else if (with_writeback) {
|
} else if (with_writeback) {
|
||||||
Sync::WriteAtEndOfPipeWithWriteBack32(m_submit_id, CurrentBuffer(), dst, data);
|
Sync::WriteAtEndOfPipeWithWriteBack32(m_submit_id, command, dst, data);
|
||||||
} else {
|
} else {
|
||||||
Sync::WriteAtEndOfPipe32(m_submit_id, CurrentBuffer(), dst, data);
|
Sync::WriteAtEndOfPipe32(m_submit_id, command, dst, data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1196,7 +1190,7 @@ void CommandProcessor::WriteAtEndOfPipe(uint32_t cache_policy, uint32_t event_wr
|
|||||||
SynchronizeGpu();
|
SynchronizeGpu();
|
||||||
Sync::ReadGds(*m_renderer.GetBufferCache().GetGdsBuffer(), dst, value & 0xffffu,
|
Sync::ReadGds(*m_renderer.GetBufferCache().GetGdsBuffer(), dst, value & 0xffffu,
|
||||||
value >> 16u);
|
value >> 16u);
|
||||||
Sync::WriteAtEndOfPipeGds32(m_submit_id, CurrentBuffer(), dst, value & 0xffffu,
|
Sync::WriteAtEndOfPipeGds32(m_submit_id, command, dst, value & 0xffffu,
|
||||||
value >> 16u);
|
value >> 16u);
|
||||||
if (with_interrupt) {
|
if (with_interrupt) {
|
||||||
m_renderer.TriggerInterrupt(m_interrupt_event_id, interrupt_context_id);
|
m_renderer.TriggerInterrupt(m_interrupt_event_id, interrupt_context_id);
|
||||||
@@ -1225,18 +1219,18 @@ void CommandProcessor::WriteAtEndOfPipe(uint32_t cache_policy, uint32_t event_wr
|
|||||||
if (with_interrupt) {
|
if (with_interrupt) {
|
||||||
if (with_writeback) {
|
if (with_writeback) {
|
||||||
Sync::WriteAtEndOfPipeWithInterruptWriteBack64(
|
Sync::WriteAtEndOfPipeWithInterruptWriteBack64(
|
||||||
m_submit_id, CurrentBuffer(), dst, value, m_interrupt_event_id,
|
m_submit_id, command, dst, value, m_interrupt_event_id,
|
||||||
interrupt_context_id);
|
interrupt_context_id);
|
||||||
} else {
|
} else {
|
||||||
Sync::WriteAtEndOfPipeWithInterrupt64(m_submit_id, CurrentBuffer(), dst,
|
Sync::WriteAtEndOfPipeWithInterrupt64(m_submit_id, command, dst,
|
||||||
value, m_interrupt_event_id,
|
value, m_interrupt_event_id,
|
||||||
interrupt_context_id);
|
interrupt_context_id);
|
||||||
}
|
}
|
||||||
} else if (with_writeback) {
|
} else if (with_writeback) {
|
||||||
Sync::WriteAtEndOfPipeWithWriteBack64(m_submit_id, CurrentBuffer(), dst,
|
Sync::WriteAtEndOfPipeWithWriteBack64(m_submit_id, command, dst,
|
||||||
value);
|
value);
|
||||||
} else {
|
} else {
|
||||||
Sync::WriteAtEndOfPipe64(m_submit_id, CurrentBuffer(), dst, value);
|
Sync::WriteAtEndOfPipe64(m_submit_id, command, dst, value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1317,10 +1311,10 @@ void CommandProcessor::WriteAtEndOfPipe(uint32_t cache_policy, uint32_t event_wr
|
|||||||
(eop_event_type == 0x28 && event_index == 0x00)) {
|
(eop_event_type == 0x28 && event_index == 0x00)) {
|
||||||
if (with_interrupt) {
|
if (with_interrupt) {
|
||||||
Sync::WriteAtEndOfPipeWithInterrupt64(
|
Sync::WriteAtEndOfPipeWithInterrupt64(
|
||||||
m_submit_id, CurrentBuffer(), dst, clock, m_interrupt_event_id,
|
m_submit_id, command, dst, clock, m_interrupt_event_id,
|
||||||
interrupt_context_id);
|
interrupt_context_id);
|
||||||
} else {
|
} else {
|
||||||
Sync::WriteAtEndOfPipeClockCounter(m_submit_id, CurrentBuffer(),
|
Sync::WriteAtEndOfPipeClockCounter(m_submit_id, command,
|
||||||
dst, clock);
|
dst, clock);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -1332,11 +1326,11 @@ void CommandProcessor::WriteAtEndOfPipe(uint32_t cache_policy, uint32_t event_wr
|
|||||||
(eop_event_type == 0x28 && event_index == 0x00)) {
|
(eop_event_type == 0x28 && event_index == 0x00)) {
|
||||||
if (with_interrupt) {
|
if (with_interrupt) {
|
||||||
Sync::WriteAtEndOfPipeWithInterruptWriteBack64(
|
Sync::WriteAtEndOfPipeWithInterruptWriteBack64(
|
||||||
m_submit_id, CurrentBuffer(), dst, clock, m_interrupt_event_id,
|
m_submit_id, command, dst, clock, m_interrupt_event_id,
|
||||||
interrupt_context_id);
|
interrupt_context_id);
|
||||||
} else {
|
} else {
|
||||||
Sync::WriteAtEndOfPipeClockCounterWithWriteBack(
|
Sync::WriteAtEndOfPipeClockCounterWithWriteBack(
|
||||||
m_submit_id, CurrentBuffer(), dst, clock);
|
m_submit_id, command, dst, clock);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1374,8 +1368,6 @@ void CommandProcessor::WriteAtEndOfPipe64(uint32_t cache_policy, uint32_t event_
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::EmitGlobalBarrier() {
|
void CommandProcessor::EmitGlobalBarrier() {
|
||||||
CheckBuffer();
|
|
||||||
|
|
||||||
Common::LockGuard lock(m_renderer.GetMutex());
|
Common::LockGuard lock(m_renderer.GetMutex());
|
||||||
|
|
||||||
vk::MemoryBarrier2 barrier {};
|
vk::MemoryBarrier2 barrier {};
|
||||||
@@ -1392,8 +1384,6 @@ void CommandProcessor::EmitGlobalBarrier() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::TriggerEopEventAtEndOfPipe(uint32_t interrupt_context_id) {
|
void CommandProcessor::TriggerEopEventAtEndOfPipe(uint32_t interrupt_context_id) {
|
||||||
CheckBuffer();
|
|
||||||
|
|
||||||
Sync::TriggerEopEventAtEndOfPipe(CurrentBuffer(), m_interrupt_event_id, interrupt_context_id);
|
Sync::TriggerEopEventAtEndOfPipe(CurrentBuffer(), m_interrupt_event_id, interrupt_context_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1477,8 +1467,6 @@ void CommandProcessor::TriggerEvent(uint32_t event_type, uint32_t event_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::Flip() {
|
void CommandProcessor::Flip() {
|
||||||
CheckBuffer();
|
|
||||||
|
|
||||||
if (GraphicsRunDebugDumpEnabled()) {
|
if (GraphicsRunDebugDumpEnabled()) {
|
||||||
LOGF("CommandProcessor::Flip()\n");
|
LOGF("CommandProcessor::Flip()\n");
|
||||||
}
|
}
|
||||||
@@ -1492,7 +1480,7 @@ void CommandProcessor::Flip() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::Flip(void* dst_gpu_addr, uint32_t value) {
|
void CommandProcessor::Flip(void* dst_gpu_addr, uint32_t value) {
|
||||||
CheckBuffer();
|
auto& command = CurrentBuffer();
|
||||||
|
|
||||||
if (GraphicsRunDebugDumpEnabled()) {
|
if (GraphicsRunDebugDumpEnabled()) {
|
||||||
LOGF("CommandProcessor::Flip()\n"
|
LOGF("CommandProcessor::Flip()\n"
|
||||||
@@ -1502,7 +1490,6 @@ void CommandProcessor::Flip(void* dst_gpu_addr, uint32_t value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::memcpy(dst_gpu_addr, &value, sizeof(value));
|
std::memcpy(dst_gpu_addr, &value, sizeof(value));
|
||||||
auto& command = CurrentBuffer();
|
|
||||||
auto request = Sync::PrepareVideoOutFlip(command, m_flip.handle, m_flip.index, m_flip.flip_mode,
|
auto request = Sync::PrepareVideoOutFlip(command, m_flip.handle, m_flip.index, m_flip.flip_mode,
|
||||||
m_flip.flip_arg);
|
m_flip.flip_arg);
|
||||||
Sync::WriteAtEndOfPipeWithFlip32(m_submit_id, command, static_cast<uint32_t*>(dst_gpu_addr),
|
Sync::WriteAtEndOfPipeWithFlip32(m_submit_id, command, static_cast<uint32_t*>(dst_gpu_addr),
|
||||||
@@ -1513,7 +1500,7 @@ void CommandProcessor::Flip(void* dst_gpu_addr, uint32_t value) {
|
|||||||
|
|
||||||
void CommandProcessor::FlipWithInterrupt(uint32_t eop_event_type, uint32_t cache_action,
|
void CommandProcessor::FlipWithInterrupt(uint32_t eop_event_type, uint32_t cache_action,
|
||||||
void* dst_gpu_addr, uint32_t value) {
|
void* dst_gpu_addr, uint32_t value) {
|
||||||
CheckBuffer();
|
auto& command = CurrentBuffer();
|
||||||
|
|
||||||
if (GraphicsRunDebugDumpEnabled()) {
|
if (GraphicsRunDebugDumpEnabled()) {
|
||||||
LOGF("CommandProcessor::FlipWithInterrupt()\n"
|
LOGF("CommandProcessor::FlipWithInterrupt()\n"
|
||||||
@@ -1528,7 +1515,6 @@ void CommandProcessor::FlipWithInterrupt(uint32_t eop_event_type, uint32_t cache
|
|||||||
EXIT("unknown event type\n");
|
EXIT("unknown event type\n");
|
||||||
}
|
}
|
||||||
std::memcpy(dst_gpu_addr, &value, sizeof(value));
|
std::memcpy(dst_gpu_addr, &value, sizeof(value));
|
||||||
auto& command = CurrentBuffer();
|
|
||||||
auto request = Sync::PrepareVideoOutFlip(command, m_flip.handle, m_flip.index, m_flip.flip_mode,
|
auto request = Sync::PrepareVideoOutFlip(command, m_flip.handle, m_flip.index, m_flip.flip_mode,
|
||||||
m_flip.flip_arg);
|
m_flip.flip_arg);
|
||||||
Sync::WriteAtEndOfPipeWithInterruptWriteBackFlip32(
|
Sync::WriteAtEndOfPipeWithInterruptWriteBackFlip32(
|
||||||
@@ -1538,7 +1524,7 @@ void CommandProcessor::FlipWithInterrupt(uint32_t eop_event_type, uint32_t cache
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CommandProcessor::PrepareCpuFlip(uint64_t request_id) {
|
void CommandProcessor::PrepareCpuFlip(uint64_t request_id) {
|
||||||
CheckBuffer();
|
auto& command = CurrentBuffer();
|
||||||
if (g_current_processor != nullptr) {
|
if (g_current_processor != nullptr) {
|
||||||
EXIT("invalid graphics-thread CPU flip preparation\n");
|
EXIT("invalid graphics-thread CPU flip preparation\n");
|
||||||
}
|
}
|
||||||
@@ -1548,7 +1534,7 @@ void CommandProcessor::PrepareCpuFlip(uint64_t request_id) {
|
|||||||
};
|
};
|
||||||
ProcessorScope processor_scope(*this);
|
ProcessorScope processor_scope(*this);
|
||||||
|
|
||||||
m_renderer.GetVideoOut().PrepareFlip(request_id, CurrentBuffer());
|
m_renderer.GetVideoOut().PrepareFlip(request_id, command);
|
||||||
GetScheduler().Flush();
|
GetScheduler().Flush();
|
||||||
m_renderer.GetVideoOut().CompleteFlip(request_id);
|
m_renderer.GetVideoOut().CompleteFlip(request_id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user