From a72136419c97174072f291c0a76946be920d89d9 Mon Sep 17 00:00:00 2001 From: Samuliak Date: Fri, 15 Nov 2024 17:32:29 +0100 Subject: [PATCH] log instead of printf --- src/Cafe/HW/Latte/Renderer/Metal/LatteToMtl.cpp | 2 +- .../HW/Latte/Renderer/Metal/MetalLayerHandle.cpp | 2 +- .../Renderer/Metal/MetalPipelineCompiler.cpp | 2 +- .../HW/Latte/Renderer/Metal/MetalRenderer.cpp | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Cafe/HW/Latte/Renderer/Metal/LatteToMtl.cpp b/src/Cafe/HW/Latte/Renderer/Metal/LatteToMtl.cpp index 436a421b..9de3bd1c 100644 --- a/src/Cafe/HW/Latte/Renderer/Metal/LatteToMtl.cpp +++ b/src/Cafe/HW/Latte/Renderer/Metal/LatteToMtl.cpp @@ -240,7 +240,7 @@ MTL::PrimitiveType GetMtlPrimitiveType(LattePrimitiveMode primitiveMode) case Latte::LATTE_VGT_PRIMITIVE_TYPE::E_PRIMITIVE_TYPE::LINE_LOOP: return MTL::PrimitiveTypeLineStrip; // line loops are emulated as line strips with an extra connecting strip at the end case Latte::LATTE_VGT_PRIMITIVE_TYPE::E_PRIMITIVE_TYPE::LINE_STRIP_ADJACENT: // Tropical Freeze level 3-6 - debug_printf("Metal doesn't support line strip adjacent primitive, using line strip instead\n"); + cemuLog_logOnce(LogType::Force, "Metal doesn't support line strip adjacent primitive, using line strip instead"); return MTL::PrimitiveTypeLineStrip; case Latte::LATTE_VGT_PRIMITIVE_TYPE::E_PRIMITIVE_TYPE::TRIANGLES: return MTL::PrimitiveTypeTriangle; diff --git a/src/Cafe/HW/Latte/Renderer/Metal/MetalLayerHandle.cpp b/src/Cafe/HW/Latte/Renderer/Metal/MetalLayerHandle.cpp index ad16b89a..1155c152 100644 --- a/src/Cafe/HW/Latte/Renderer/Metal/MetalLayerHandle.cpp +++ b/src/Cafe/HW/Latte/Renderer/Metal/MetalLayerHandle.cpp @@ -32,7 +32,7 @@ bool MetalLayerHandle::AcquireDrawable() m_drawable = m_layer->nextDrawable(); if (!m_drawable) { - debug_printf("layer %p failed to acquire next drawable\n", this); + cemuLog_log(LogType::Force, "layer {} failed to acquire next drawable", (void*)this); return false; } diff --git a/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCompiler.cpp b/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCompiler.cpp index 9d74e2d9..194498ec 100644 --- a/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCompiler.cpp +++ b/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCompiler.cpp @@ -468,7 +468,7 @@ void MetalPipelineCompiler::InitFromStateRender(const LatteFetchShader* fetchSha layout->setStepFunction(MTL::VertexStepFunctionPerInstance); else { - debug_printf("unimplemented vertex fetch type %u\n", (uint32)fetchType.value()); + cemuLog_log(LogType::Force, "unimplemented vertex fetch type {}", (uint32)fetchType.value()); cemu_assert(false); } } diff --git a/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp index f28b79b8..ef1c0d71 100644 --- a/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Metal/MetalRenderer.cpp @@ -123,7 +123,7 @@ MetalRenderer::MetalRenderer() MTL::Library* utilityLibrary = m_device->newLibrary(ToNSString(utilityShaderSource), nullptr, &error); if (error) { - debug_printf("failed to create utility library (error: %s)\n", error->localizedDescription()->utf8String()); + cemuLog_log(LogType::Force, "failed to create utility library (error: {})", error->localizedDescription()->utf8String()); error->release(); throw; return; @@ -454,7 +454,7 @@ void MetalRenderer::ImguiEnd() if (m_encoderType != MetalEncoderType::Render) { - debug_printf("no render command encoder, cannot draw ImGui\n"); + cemuLog_logOnce(LogType::Force, "no render command encoder, cannot draw ImGui"); return; } @@ -850,7 +850,7 @@ void MetalRenderer::draw_beginSequence() LatteSHRC_UpdateActiveShaders(); if (LatteGPUState.activeShaderHasError) { - debug_printf("Skipping drawcalls due to shader error\n"); + cemuLog_logOnce(LogType::Force, "Skipping drawcalls due to shader error\n"); m_state.m_skipDrawSequence = true; cemu_assert_debug(false); return; @@ -863,14 +863,14 @@ void MetalRenderer::draw_beginSequence() LatteGPUState.repeatTextureInitialization = false; if (!LatteMRT::UpdateCurrentFBO()) { - debug_printf("Rendertarget invalid\n"); + cemuLog_logOnce(LogType::Force, "Rendertarget invalid\n"); m_state.m_skipDrawSequence = true; return; // no render target } if (!hasValidFramebufferAttached && !streamoutEnable) { - debug_printf("Drawcall with no color buffer or depth buffer attached\n"); + cemuLog_logOnce(LogType::Force, "Drawcall with no color buffer or depth buffer attached\n"); m_state.m_skipDrawSequence = true; return; // no render target } @@ -1241,7 +1241,7 @@ void MetalRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32 verticesPerPrimitive = 3; break; default: - debug_printf("invalid primitive mode %u\n", (uint32)primitiveMode); + cemuLog_log(LogType::Force, "unimplemented geometry shader primitive mode {}", (uint32)primitiveMode); break; } @@ -1804,7 +1804,7 @@ void MetalRenderer::BindStageResources(MTL::RenderCommandEncoder* renderCommandE uint32 binding = shader->resourceMapping.getTextureBaseBindingPoint() + i; if (binding >= MAX_MTL_TEXTURES) { - debug_printf("invalid texture binding %u\n", binding); + cemuLog_logOnce(LogType::Force, "invalid texture binding {}", binding); continue; } @@ -1952,7 +1952,7 @@ void MetalRenderer::BindStageResources(MTL::RenderCommandEncoder* renderCommandE uint32 binding = shader->resourceMapping.uniformBuffersBindingPoint[i]; if (binding >= MAX_MTL_BUFFERS) { - debug_printf("invalid buffer binding%u\n", binding); + cemuLog_logOnce(LogType::Force, "invalid buffer binding {}", binding); continue; }