1
0
Fork 0
forked from suyu/suyu

metal: print debug messages

This commit is contained in:
Samuliak 2024-04-06 14:46:54 +02:00
parent e4d2bcaaeb
commit 19503fd643
3 changed files with 115 additions and 22 deletions

View file

@ -46,6 +46,7 @@ void CommandRecorder::EndEncoding() {
} }
void CommandRecorder::Present(CAMetalDrawable_t drawable) { void CommandRecorder::Present(CAMetalDrawable_t drawable) {
EndEncoding();
[command_buffer presentDrawable:drawable]; [command_buffer presentDrawable:drawable];
} }

View file

@ -79,10 +79,19 @@ void RasterizerMetal::Clear(u32 layer_count) {
command_recorder.BeginRenderPass(framebuffer->GetHandle()); command_recorder.BeginRenderPass(framebuffer->GetHandle());
} }
void RasterizerMetal::DispatchCompute() {} void RasterizerMetal::DispatchCompute() {
void RasterizerMetal::ResetCounter(VideoCommon::QueryType type) {} std::cout << "Dispatch compute" << std::endl;
}
void RasterizerMetal::ResetCounter(VideoCommon::QueryType type) {
std::cout << "Reset counter" << std::endl;
}
void RasterizerMetal::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type, void RasterizerMetal::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
VideoCommon::QueryPropertiesFlags flags, u32 payload, u32 subreport) { VideoCommon::QueryPropertiesFlags flags, u32 payload, u32 subreport) {
std::cout << "Query" << std::endl;
// TODO: remove this
if (!gpu_memory) { if (!gpu_memory) {
return; return;
} }
@ -94,20 +103,43 @@ void RasterizerMetal::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
gpu_memory->Write<u32>(gpu_addr, payload); gpu_memory->Write<u32>(gpu_addr, payload);
} }
} }
void RasterizerMetal::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, void RasterizerMetal::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
u32 size) {} u32 size) {
void RasterizerMetal::DisableGraphicsUniformBuffer(size_t stage, u32 index) {} std::cout << "Bind graphics uniform buffer" << std::endl;
void RasterizerMetal::FlushAll() {} }
void RasterizerMetal::FlushRegion(DAddr addr, u64 size, VideoCommon::CacheType) {}
void RasterizerMetal::DisableGraphicsUniformBuffer(size_t stage, u32 index) {
std::cout << "Disable graphics uniform buffer" << std::endl;
}
void RasterizerMetal::FlushAll() {
std::cout << "Flush all" << std::endl;
}
void RasterizerMetal::FlushRegion(DAddr addr, u64 size, VideoCommon::CacheType) {
std::cout << "Flush region" << std::endl;
}
bool RasterizerMetal::MustFlushRegion(DAddr addr, u64 size, VideoCommon::CacheType) { bool RasterizerMetal::MustFlushRegion(DAddr addr, u64 size, VideoCommon::CacheType) {
return false; return false;
} }
void RasterizerMetal::InvalidateRegion(DAddr addr, u64 size, VideoCommon::CacheType) {}
void RasterizerMetal::InvalidateRegion(DAddr addr, u64 size, VideoCommon::CacheType) {
std::cout << "Invalidate region" << std::endl;
}
bool RasterizerMetal::OnCPUWrite(PAddr addr, u64 size) { bool RasterizerMetal::OnCPUWrite(PAddr addr, u64 size) {
return false; return false;
} }
void RasterizerMetal::OnCacheInvalidation(PAddr addr, u64 size) {}
void RasterizerMetal::OnCacheInvalidation(PAddr addr, u64 size) {
std::cout << "On cache invalidation" << std::endl;
}
VideoCore::RasterizerDownloadArea RasterizerMetal::GetFlushArea(PAddr addr, u64 size) { VideoCore::RasterizerDownloadArea RasterizerMetal::GetFlushArea(PAddr addr, u64 size) {
std::cout << "Get flush area" << std::endl;
VideoCore::RasterizerDownloadArea new_area{ VideoCore::RasterizerDownloadArea new_area{
.start_address = Common::AlignDown(addr, Core::DEVICE_PAGESIZE), .start_address = Common::AlignDown(addr, Core::DEVICE_PAGESIZE),
.end_address = Common::AlignUp(addr + size, Core::DEVICE_PAGESIZE), .end_address = Common::AlignUp(addr + size, Core::DEVICE_PAGESIZE),
@ -115,49 +147,110 @@ VideoCore::RasterizerDownloadArea RasterizerMetal::GetFlushArea(PAddr addr, u64
}; };
return new_area; return new_area;
} }
void RasterizerMetal::InvalidateGPUCache() {}
void RasterizerMetal::UnmapMemory(DAddr addr, u64 size) {} void RasterizerMetal::InvalidateGPUCache() {
void RasterizerMetal::ModifyGPUMemory(size_t as_id, GPUVAddr addr, u64 size) {} std::cout << "Invalidate GPU cache" << std::endl;
}
void RasterizerMetal::UnmapMemory(DAddr addr, u64 size) {
std::cout << "Unmap memory" << std::endl;
}
void RasterizerMetal::ModifyGPUMemory(size_t as_id, GPUVAddr addr, u64 size) {
std::cout << "Modify GPU memory" << std::endl;
}
void RasterizerMetal::SignalFence(std::function<void()>&& func) { void RasterizerMetal::SignalFence(std::function<void()>&& func) {
std::cout << "Signal fence" << std::endl;
func(); func();
} }
void RasterizerMetal::SyncOperation(std::function<void()>&& func) { void RasterizerMetal::SyncOperation(std::function<void()>&& func) {
std::cout << "Sync operation" << std::endl;
func(); func();
} }
void RasterizerMetal::SignalSyncPoint(u32 value) { void RasterizerMetal::SignalSyncPoint(u32 value) {
std::cout << "Signal sync point" << std::endl;
auto& syncpoint_manager = gpu.Host1x().GetSyncpointManager(); auto& syncpoint_manager = gpu.Host1x().GetSyncpointManager();
syncpoint_manager.IncrementGuest(value); syncpoint_manager.IncrementGuest(value);
syncpoint_manager.IncrementHost(value); syncpoint_manager.IncrementHost(value);
} }
void RasterizerMetal::SignalReference() {}
void RasterizerMetal::ReleaseFences(bool) {} void RasterizerMetal::SignalReference() {
void RasterizerMetal::FlushAndInvalidateRegion(DAddr addr, u64 size, VideoCommon::CacheType) {} std::cout << "Signal reference" << std::endl;
void RasterizerMetal::WaitForIdle() {} }
void RasterizerMetal::FragmentBarrier() {}
void RasterizerMetal::TiledCacheBarrier() {} void RasterizerMetal::ReleaseFences(bool) {
void RasterizerMetal::FlushCommands() {} std::cout << "Release fences" << std::endl;
void RasterizerMetal::TickFrame() {} }
void RasterizerMetal::FlushAndInvalidateRegion(DAddr addr, u64 size, VideoCommon::CacheType) {
std::cout << "Flush and invalidate region" << std::endl;
}
void RasterizerMetal::WaitForIdle() {
std::cout << "Wait for idle" << std::endl;
}
void RasterizerMetal::FragmentBarrier() {
std::cout << "Fragment barrier" << std::endl;
}
void RasterizerMetal::TiledCacheBarrier() {
std::cout << "Tiled cache barrier" << std::endl;
}
void RasterizerMetal::FlushCommands() {
std::cout << "Flush commands" << std::endl;
}
void RasterizerMetal::TickFrame() {
std::cout << "Tick frame" << std::endl;
}
Tegra::Engines::AccelerateDMAInterface& RasterizerMetal::AccessAccelerateDMA() { Tegra::Engines::AccelerateDMAInterface& RasterizerMetal::AccessAccelerateDMA() {
return accelerate_dma; return accelerate_dma;
} }
bool RasterizerMetal::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Surface& src, bool RasterizerMetal::AccelerateSurfaceCopy(const Tegra::Engines::Fermi2D::Surface& src,
const Tegra::Engines::Fermi2D::Surface& dst, const Tegra::Engines::Fermi2D::Surface& dst,
const Tegra::Engines::Fermi2D::Config& copy_config) { const Tegra::Engines::Fermi2D::Config& copy_config) {
std::cout << "Accelerate surface copy" << std::endl;
return true; return true;
} }
void RasterizerMetal::AccelerateInlineToMemory(GPUVAddr address, size_t copy_size, void RasterizerMetal::AccelerateInlineToMemory(GPUVAddr address, size_t copy_size,
std::span<const u8> memory) {} std::span<const u8> memory) {
std::cout << "Accelerate inline to memory" << std::endl;
}
void RasterizerMetal::LoadDiskResources(u64 title_id, std::stop_token stop_loading, void RasterizerMetal::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
const VideoCore::DiskResourceLoadCallback& callback) {} const VideoCore::DiskResourceLoadCallback& callback) {
std::cout << "Load disk resources" << std::endl;
}
void RasterizerMetal::InitializeChannel(Tegra::Control::ChannelState& channel) { void RasterizerMetal::InitializeChannel(Tegra::Control::ChannelState& channel) {
std::cout << "Initialize channel" << std::endl;
CreateChannel(channel); CreateChannel(channel);
texture_cache.CreateChannel(channel); texture_cache.CreateChannel(channel);
} }
void RasterizerMetal::BindChannel(Tegra::Control::ChannelState& channel) { void RasterizerMetal::BindChannel(Tegra::Control::ChannelState& channel) {
std::cout << "Bind channel" << std::endl;
BindToChannel(channel.bind_id); BindToChannel(channel.bind_id);
texture_cache.BindToChannel(channel.bind_id); texture_cache.BindToChannel(channel.bind_id);
} }
void RasterizerMetal::ReleaseChannel(s32 channel_id) { void RasterizerMetal::ReleaseChannel(s32 channel_id) {
std::cout << "Release channel" << std::endl;
EraseChannel(channel_id); EraseChannel(channel_id);
texture_cache.EraseChannel(channel_id); texture_cache.EraseChannel(channel_id);
} }

View file

@ -37,7 +37,6 @@ void RendererMetal::Composite(std::span<const Tegra::FramebufferConfig> framebuf
render_pass_descriptor.colorAttachments[0].texture = swap_chain.GetDrawableTexture(); render_pass_descriptor.colorAttachments[0].texture = swap_chain.GetDrawableTexture();
command_recorder.BeginRenderPass(render_pass_descriptor); command_recorder.BeginRenderPass(render_pass_descriptor);
command_recorder.EndEncoding();
swap_chain.Present(); swap_chain.Present();
command_recorder.Submit(); command_recorder.Submit();