Migrate force_log_printf to new logging (#714)

This commit is contained in:
why-keith 2023-04-12 15:31:34 +01:00 committed by GitHub
parent 072c18a6e3
commit 4be57f4896
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 401 additions and 399 deletions

View file

@ -52,7 +52,7 @@ VkSurfaceKHR CreateCocoaSurface(VkInstance instance, void* handle)
VkResult err;
if ((err = vkCreateMetalSurfaceEXT(instance, &surface, nullptr, &result)) != VK_SUCCESS)
{
forceLog_printf("Cannot create a Metal Vulkan surface: %d", (sint32)err);
cemuLog_log(LogType::Force, "Cannot create a Metal Vulkan surface: {}", (sint32)err);
throw std::runtime_error(fmt::format("Cannot create a Metal Vulkan surface: {}", err));
}

View file

@ -210,7 +210,7 @@ VkSampler LatteTextureViewVk::GetDefaultTextureSampler(bool useLinearTexFilter)
if (vkCreateSampler(m_device, &samplerInfo, nullptr, &sampler) != VK_SUCCESS)
{
forceLog_printf("Failed to create default sampler");
cemuLog_log(LogType::Force, "Failed to create default sampler");
throw std::runtime_error("failed to create texture sampler!");
}
@ -236,4 +236,4 @@ VkImageViewType LatteTextureViewVk::GetImageViewTypeFromGX2Dim(Latte::E_DIM dim)
cemu_assert_unimplemented();
}
return VK_IMAGE_VIEW_TYPE_2D;
}
}

View file

@ -239,7 +239,7 @@ void RendererShaderVk::CreateVkShaderModule(std::span<uint32> spirvBuffer)
VkResult result = vkCreateShaderModule(m_device, &createInfo, nullptr, &m_shader_module);
if (result != VK_SUCCESS)
{
forceLog_printf("Vulkan: Shader error");
cemuLog_log(LogType::Force, "Vulkan: Shader error");
throw std::runtime_error(fmt::format("Failed to create shader module: {}", result));
}
@ -450,4 +450,4 @@ void RendererShaderVk::ShaderCacheLoading_end()
{
// keep g_spirvCache open since we will write to it while the game is running
s_isLoadingShadersVk = false;
}
}

View file

@ -226,8 +226,8 @@ bool SwapchainInfoVk::AcquireImage(uint64 timeout)
void SwapchainInfoVk::UnrecoverableError(const char* errMsg)
{
forceLog_printf("Unrecoverable error in Vulkan swapchain");
forceLog_printf("Msg: %s", errMsg);
cemuLog_log(LogType::Force, "Unrecoverable error in Vulkan swapchain");
cemuLog_log(LogType::Force, "Msg: {}", errMsg);
throw std::runtime_error(errMsg);
}
@ -269,7 +269,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport(
if (result != VK_SUCCESS)
{
if (result != VK_ERROR_SURFACE_LOST_KHR)
forceLog_printf("vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed. Error %d", (sint32)result);
cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed. Error {}", (sint32)result);
throw std::runtime_error(fmt::format("Unable to retrieve physical device surface capabilities: {}", result));
}
@ -277,7 +277,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport(
result = vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, nullptr);
if (result != VK_SUCCESS)
{
forceLog_printf("vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error %d", (sint32)result);
cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error {}", (sint32)result);
throw std::runtime_error(fmt::format("Unable to retrieve the number of formats for a surface on a physical device: {}", result));
}
@ -287,7 +287,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport(
result = vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, details.formats.data());
if (result != VK_SUCCESS)
{
forceLog_printf("vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error %d", (sint32)result);
cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error {}", (sint32)result);
throw std::runtime_error(fmt::format("Unable to retrieve the formats for a surface on a physical device: {}", result));
}
}
@ -296,7 +296,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport(
result = vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &presentModeCount, nullptr);
if (result != VK_SUCCESS)
{
forceLog_printf("vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error %d", (sint32)result);
cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error {}", (sint32)result);
throw std::runtime_error(fmt::format("Unable to retrieve the count of present modes for a surface on a physical device: {}", result));
}
@ -306,7 +306,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport(
result = vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &presentModeCount, details.presentModes.data());
if (result != VK_SUCCESS)
{
forceLog_printf("vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error %d", (sint32)result);
cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error {}", (sint32)result);
throw std::runtime_error(fmt::format("Unable to retrieve the present modes for a surface on a physical device: {}", result));
}
}
@ -357,14 +357,14 @@ VkPresentModeKHR SwapchainInfoVk::ChoosePresentMode(const std::vector<VkPresentM
if (std::find(modes.cbegin(), modes.cend(), VK_PRESENT_MODE_MAILBOX_KHR) != modes.cend())
return VK_PRESENT_MODE_MAILBOX_KHR;
forceLog_printf("Vulkan: Can't find mailbox present mode");
cemuLog_log(LogType::Force, "Vulkan: Can't find mailbox present mode");
}
else if (vsyncState == VSync::Immediate)
{
if (std::find(modes.cbegin(), modes.cend(), VK_PRESENT_MODE_IMMEDIATE_KHR) != modes.cend())
return VK_PRESENT_MODE_IMMEDIATE_KHR;
forceLog_printf("Vulkan: Can't find immediate present mode");
cemuLog_log(LogType::Force, "Vulkan: Can't find immediate present mode");
}
else if (vsyncState == VSync::SYNC_AND_LIMIT)
{
@ -373,7 +373,7 @@ VkPresentModeKHR SwapchainInfoVk::ChoosePresentMode(const std::vector<VkPresentM
//if (std::find(modes.cbegin(), modes.cend(), VK_PRESENT_MODE_IMMEDIATE_KHR) != modes.cend())
// return VK_PRESENT_MODE_IMMEDIATE_KHR;
//else
// forceLog_printf("Vulkan: Present mode 'immediate' not available. Vsync might not behave as intended");
// cemuLog_log(LogType::Force, "Vulkan: Present mode 'immediate' not available. Vsync might not behave as intended");
return VK_PRESENT_MODE_FIFO_KHR;
}

View file

@ -81,7 +81,7 @@ uint32 LatteTextureReadbackInfoVk::GetImageSize(LatteTextureView* textureView)
}
else
{
forceLog_printf("Unsupported texture readback format %04x\n", (uint32)textureView->format);
cemuLog_log(LogType::Force, "Unsupported texture readback format {:04x}", (uint32)textureView->format);
cemu_assert_debug(false);
return 0;
}

View file

@ -231,9 +231,9 @@ uint32 VkTextureChunkedHeap::allocateNewChunk(uint32 chunkIndex, uint32 minimumA
allocationSize /= 2;
if (allocationSize < minimumAllocationSize)
break;
forceLog_printf("Failed to allocate texture memory chunk with size %dMB. Trying again with smaller allocation size\n", allocationSize / 1024 / 1024);
cemuLog_log(LogType::Force, "Failed to allocate texture memory chunk with size {}MB. Trying again with smaller allocation size", allocationSize / 1024 / 1024);
}
forceLog_printf("Unable to allocate image memory chunk (%d heaps)", deviceLocalMemoryTypeIndices.size());
cemuLog_log(LogType::Force, "Unable to allocate image memory chunk ({} heaps)", deviceLocalMemoryTypeIndices.size());
throw std::runtime_error("failed to allocate image memory!");
return 0;
}
@ -299,7 +299,7 @@ size_t VKRMemoryManager::GetTotalMemoryForBufferType(VkBufferUsageFlags usage, V
bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
if (vkCreateBuffer(logicalDevice, &bufferInfo, nullptr, &temporaryBuffer) != VK_SUCCESS)
{
forceLog_printf("Vulkan: GetTotalMemoryForBufferType() failed to create temporary buffer");
cemuLog_log(LogType::Force, "Vulkan: GetTotalMemoryForBufferType() failed to create temporary buffer");
return 0;
}
@ -513,7 +513,7 @@ void VKRMemoryManager::imageMemoryFree(VkImageMemAllocation* imageMemAllocation)
auto heapItr = map_textureHeap.find(imageMemAllocation->typeFilter);
if (heapItr == map_textureHeap.end())
{
forceLog_printf("Internal texture heap error");
cemuLog_log(LogType::Force, "Internal texture heap error");
return;
}
heapItr->second->freeMem(imageMemAllocation->mem);

View file

@ -33,7 +33,7 @@ public:
if ((alignment & (alignment - 1)) != 0)
{
// not a power of two
forceLog_printf("VkTextureChunkedHeap: Invalid alignment %d", alignment);
cemuLog_log(LogType::Force, "VkTextureChunkedHeap: Invalid alignment {}", alignment);
}
return this->alloc(size, alignment);
}

View file

@ -129,7 +129,7 @@ private:
NTSTATUS r = pfnD3DKMTWaitForVerticalBlankEvent(&arg);
if (r != 0)
{
//forceLog_printf("Wait for VerticalBlank failed\n");
//cemuLog_log(LogType::Force, "Wait for VerticalBlank failed");
Sleep(1000 / 60);
failCount++;
if (failCount >= 10)
@ -214,4 +214,4 @@ void VsyncDriver_notifyWindowPosChanged()
}
#endif
#endif

View file

@ -19,7 +19,7 @@ bool InitializeGlobalVulkan()
if (hmodule == nullptr)
{
forceLog_printf("Vulkan loader not available. Outdated graphics driver or Vulkan runtime not installed?");
cemuLog_log(LogType::Force, "Vulkan loader not available. Outdated graphics driver or Vulkan runtime not installed?");
return false;
}
@ -28,7 +28,7 @@ bool InitializeGlobalVulkan()
if(!vkEnumerateInstanceVersion)
{
forceLog_printf("vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?");
cemuLog_log(LogType::Force, "vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?");
FreeLibrary(hmodule);
return false;
}
@ -84,7 +84,7 @@ bool InitializeGlobalVulkan()
if (!vulkan_so)
{
forceLog_printf("Vulkan loader not available.");
cemuLog_log(LogType::Force, "Vulkan loader not available.");
return false;
}
@ -93,7 +93,7 @@ bool InitializeGlobalVulkan()
if(!vkEnumerateInstanceVersion)
{
forceLog_printf("vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?");
cemuLog_log(LogType::Force, "vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?");
return false;
}
@ -125,4 +125,4 @@ bool InitializeDeviceVulkan(VkDevice device)
return true;
}
#endif
#endif

View file

@ -225,7 +225,7 @@ VkFormat PipelineCompiler::GetVertexFormat(uint8 format)
case FMT_2_10_10_10:
return VK_FORMAT_R32_UINT; // verified to match OpenGL
default:
forceLog_printf("Unsupported vertex format: %02x", format);
cemuLog_log(LogType::Force, "Unsupported vertex format: {:02x}", format);
assert_dbg();
return VK_FORMAT_UNDEFINED;
}
@ -398,7 +398,7 @@ bool PipelineCompiler::InitShaderStages(VulkanRenderer* vkRenderer, RendererShad
(vkGeometryShader && vkGeometryShader->GetShaderModule() == VK_NULL_HANDLE) ||
(vkPixelShader && vkPixelShader->GetShaderModule() == VK_NULL_HANDLE))
{
forceLog_printf("Vulkan-Info: Pipeline creation failed due to invalid shader(s)");
cemuLog_log(LogType::Force, "Vulkan-Info: Pipeline creation failed due to invalid shader(s)");
return false;
}
@ -921,7 +921,7 @@ bool PipelineCompiler::InitFromCurrentGPUState(PipelineInfo* pipelineInfo, const
VkResult result = vkCreatePipelineLayout(vkRenderer->m_logicalDevice, &pipelineLayoutInfo, nullptr, &m_pipeline_layout);
if (result != VK_SUCCESS)
{
forceLog_printf("%s", fmt::format("Failed to create pipeline layout: {}", result).c_str());
cemuLog_log(LogType::Force, "Failed to create pipeline layout: {}", result);
s_nvidiaWorkaround.unlock();
return false;
}
@ -1041,7 +1041,7 @@ bool PipelineCompiler::Compile(bool forceCompile, bool isRenderThread, bool show
}
else
{
forceLog_printf("Failed to create graphics pipeline. Error %d", (sint32)result);
cemuLog_log(LogType::Force, "Failed to create graphics pipeline. Error {}", (sint32)result);
cemu_assert_debug(false);
return true; // true indicates that caller should no longer attempt to compile this pipeline again
}

View file

@ -112,7 +112,7 @@ uint32 LatteQueryObjectVk::acquireQueryIndex()
{
if (m_rendererVk->m_occlusionQueries.list_availableQueryIndices.empty())
{
forceLog_printf("Vulkan-Error: Exhausted query pool");
cemuLog_log(LogType::Force, "Vulkan-Error: Exhausted query pool");
assert_dbg();
}
uint32 queryIndex = m_rendererVk->m_occlusionQueries.list_availableQueryIndices.back();
@ -152,7 +152,7 @@ LatteQueryObject* VulkanRenderer::occlusionQuery_create()
auto r = vkCreateQueryPool(m_logicalDevice, &queryPoolCreateInfo, nullptr, &m_occlusionQueries.queryPool);
if (r != VK_SUCCESS)
{
forceLog_printf("Vulkan-Error: Failed to create query pool with error %d", (sint32)r);
cemuLog_log(LogType::Force, "Vulkan-Error: Failed to create query pool with error {}", (sint32)r);
return nullptr;
}
}
@ -209,4 +209,4 @@ void VulkanRenderer::occlusionQuery_notifyBeginCommandBuffer()
for (auto& it : m_occlusionQueries.list_currentlyActiveQueries)
if (it->m_hasActiveQuery)
it->beginFragment();
}
}

View file

@ -210,11 +210,11 @@ void VulkanRenderer::DetermineVendor()
if(driverId == VK_DRIVER_ID_MESA_RADV || driverId == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA)
m_vendor = GfxVendor::Mesa;
forceLog_printf("Using GPU: %s", properties.properties.deviceName);
cemuLog_log(LogType::Force, "Using GPU: {}", properties.properties.deviceName);
if (m_featureControl.deviceExtensions.driver_properties)
{
forceLog_printf("Driver version: %s", driverProperties.driverInfo);
cemuLog_log(LogType::Force, "Driver version: {}", driverProperties.driverInfo);
if(m_vendor == GfxVendor::Nvidia)
{
@ -225,7 +225,7 @@ void VulkanRenderer::DetermineVendor()
else
{
forceLog_printf("Driver version (as stored in device info): %08X", properties.properties.driverVersion);
cemuLog_log(LogType::Force, "Driver version (as stored in device info): {:08}", properties.properties.driverVersion);
if(m_vendor == GfxVendor::Nvidia)
{
@ -291,11 +291,11 @@ void VulkanRenderer::GetDeviceFeatures()
{
if (m_featureControl.deviceExtensions.custom_border_color)
{
forceLog_printf("VK_EXT_custom_border_color is present but only with limited support. Cannot emulate arbitrary border color");
cemuLog_log(LogType::Force, "VK_EXT_custom_border_color is present but only with limited support. Cannot emulate arbitrary border color");
}
else
{
forceLog_printf("VK_EXT_custom_border_color not supported. Cannot emulate arbitrary border color");
cemuLog_log(LogType::Force, "VK_EXT_custom_border_color not supported. Cannot emulate arbitrary border color");
}
}
@ -309,11 +309,11 @@ VulkanRenderer::VulkanRenderer()
{
glslang::InitializeProcess();
forceLog_printf("------- Init Vulkan graphics backend -------");
cemuLog_log(LogType::Force, "------- Init Vulkan graphics backend -------");
const bool useValidationLayer = cafeLog_isLoggingFlagEnabled(LOG_TYPE_VULKAN_VALIDATION);
if (useValidationLayer)
forceLog_printf("Validation layer is enabled");
cemuLog_log(LogType::Force, "Validation layer is enabled");
VkResult err;
@ -397,19 +397,19 @@ VulkanRenderer::VulkanRenderer()
if (m_physicalDevice == VK_NULL_HANDLE && fallbackDevice != VK_NULL_HANDLE)
{
forceLog_printf("The selected GPU could not be found or is not suitable. Falling back to first available device instead");
cemuLog_log(LogType::Force, "The selected GPU could not be found or is not suitable. Falling back to first available device instead");
m_physicalDevice = fallbackDevice;
config.graphic_device_uuid = {}; // resetting device selection
}
else if (m_physicalDevice == VK_NULL_HANDLE)
{
forceLog_printf("No physical GPU could be found with the required extensions and swap chain support.");
cemuLog_log(LogType::Force, "No physical GPU could be found with the required extensions and swap chain support.");
throw std::runtime_error("No physical GPU could be found with the required extensions and swap chain support.");
}
CheckDeviceExtensionSupport(m_physicalDevice, m_featureControl); // todo - merge this with GetDeviceFeatures and separate from IsDeviceSuitable?
if (m_featureControl.debugMarkersSupported)
forceLog_printf("Debug: Frame debugger attached, will use vkDebugMarkerSetObjectNameEXT");
cemuLog_log(LogType::Force, "Debug: Frame debugger attached, will use vkDebugMarkerSetObjectNameEXT");
DetermineVendor();
GetDeviceFeatures();
@ -430,7 +430,7 @@ VulkanRenderer::VulkanRenderer()
}
catch (const std::exception& ex)
{
forceLog_printf("can't create dxgi wrapper: %s", ex.what());
cemuLog_log(LogType::Force, "can't create dxgi wrapper: {}", ex.what());
}
// create logical device
@ -452,7 +452,7 @@ VulkanRenderer::VulkanRenderer()
if (m_vendor == GfxVendor::AMD)
{
deviceFeatures.robustBufferAccess = VK_TRUE;
forceLog_printf("Enable robust buffer access");
cemuLog_log(LogType::Force, "Enable robust buffer access");
}
if (m_featureControl.mode.useTFEmulationViaSSBO)
{
@ -487,7 +487,7 @@ VulkanRenderer::VulkanRenderer()
VkResult result = vkCreateDevice(m_physicalDevice, &createInfo, nullptr, &m_logicalDevice);
if (result != VK_SUCCESS)
{
forceLog_printf("Vulkan: Unable to create a logical device. Error %d", (sint32)result);
cemuLog_log(LogType::Force, "Vulkan: Unable to create a logical device. Error {}", (sint32)result);
throw std::runtime_error(fmt::format("Unable to create a logical device: {}", result));
}
@ -514,7 +514,7 @@ VulkanRenderer::VulkanRenderer()
}
if (m_featureControl.instanceExtensions.debug_utils)
forceLog_printf("Using available debug function: vkCreateDebugUtilsMessengerEXT()");
cemuLog_log(LogType::Force, "Using available debug function: vkCreateDebugUtilsMessengerEXT()");
// set initial viewport and scissor box size
m_state.currentViewport.width = 4;
@ -578,11 +578,11 @@ VulkanRenderer::VulkanRenderer()
if (m_featureControl.mode.useBufferSurfaceCopies)
{
//forceLog_printf("Enable surface copies via buffer");
//cemuLog_log(LogType::Force, "Enable surface copies via buffer");
}
else
{
//forceLog_printf("Disable surface copies via buffer (Requires 2GB. Has only %lluMB available)", availableSurfaceCopyBufferMem / 1024ull / 1024ull);
//cemuLog_log(LogType::Force, "Disable surface copies via buffer (Requires 2GB. Has only {}MB available)", availableSurfaceCopyBufferMem / 1024ull / 1024ull);
}
}
@ -1212,11 +1212,11 @@ std::vector<const char*> VulkanRenderer::CheckInstanceExtensionSupport(FeatureCo
}
if (!requiredInstanceExtensions.empty())
{
forceLog_printf("The following required Vulkan instance extensions are not supported:");
cemuLog_log(LogType::Force, "The following required Vulkan instance extensions are not supported:");
std::stringstream ss;
for (const auto& extension : requiredInstanceExtensions)
forceLog_printf("%s", extension);
cemuLog_log(LogType::Force, "{}", extension);
cemuLog_waitForFlush();
throw std::runtime_error(ss.str());
}
@ -1262,7 +1262,7 @@ VkSurfaceKHR VulkanRenderer::CreateWinSurface(VkInstance instance, HWND hwindow)
VkResult err;
if ((err = vkCreateWin32SurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS)
{
forceLog_printf("Cannot create a Win32 Vulkan surface: %d", (sint32)err);
cemuLog_log(LogType::Force, "Cannot create a Win32 Vulkan surface: {}", (sint32)err);
throw std::runtime_error(fmt::format("Cannot create a Win32 Vulkan surface: {}", err));
}
@ -1283,7 +1283,7 @@ VkSurfaceKHR VulkanRenderer::CreateXlibSurface(VkInstance instance, Display* dpy
VkResult err;
if ((err = vkCreateXlibSurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS)
{
forceLog_printf("Cannot create a X11 Vulkan surface: %d", (sint32)err);
cemuLog_log(LogType::Force, "Cannot create a X11 Vulkan surface: {}", (sint32)err);
throw std::runtime_error(fmt::format("Cannot create a X11 Vulkan surface: {}", err));
}
@ -1302,7 +1302,7 @@ VkSurfaceKHR VulkanRenderer::CreateXcbSurface(VkInstance instance, xcb_connectio
VkResult err;
if ((err = vkCreateXcbSurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS)
{
forceLog_printf("Cannot create a XCB Vulkan surface: %d", (sint32)err);
cemuLog_log(LogType::Force, "Cannot create a XCB Vulkan surface: {}", (sint32)err);
throw std::runtime_error(fmt::format("Cannot create a XCB Vulkan surface: {}", err));
}
@ -1321,7 +1321,7 @@ VkSurfaceKHR VulkanRenderer::CreateWaylandSurface(VkInstance instance, wl_displa
VkResult err;
if ((err = vkCreateWaylandSurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS)
{
forceLog_printf("Cannot create a Wayland Vulkan surface: %d", (sint32)err);
cemuLog_log(LogType::Force, "Cannot create a Wayland Vulkan surface: {}", (sint32)err);
throw std::runtime_error(fmt::format("Cannot create a Wayland Vulkan surface: {}", err));
}
@ -1382,7 +1382,7 @@ void VulkanRenderer::CreateCommandBuffers()
const VkResult result = vkAllocateCommandBuffers(m_logicalDevice, &allocInfo, m_commandBuffers.data());
if (result != VK_SUCCESS)
{
forceLog_printf("Failed to allocate command buffers: %d", result);
cemuLog_log(LogType::Force, "Failed to allocate command buffers: {}", result);
throw std::runtime_error(fmt::format("Failed to allocate command buffers: {}", result));
}
@ -1561,8 +1561,8 @@ void VulkanRenderer::Shutdown()
void VulkanRenderer::UnrecoverableError(const char* errMsg) const
{
forceLog_printf("Unrecoverable error in Vulkan renderer");
forceLog_printf("Msg: %s", errMsg);
cemuLog_log(LogType::Force, "Unrecoverable error in Vulkan renderer");
cemuLog_log(LogType::Force, "Msg: {}", errMsg);
throw std::runtime_error(errMsg);
}
@ -1632,14 +1632,14 @@ void VulkanRenderer::QueryMemoryInfo()
{
VkPhysicalDeviceMemoryProperties memProperties;
vkGetPhysicalDeviceMemoryProperties(m_physicalDevice, &memProperties);
forceLog_printf("Vulkan device memory info:");
cemuLog_log(LogType::Force, "Vulkan device memory info:");
for (uint32 i = 0; i < memProperties.memoryHeapCount; i++)
{
forceLog_printf("Heap %d - Size %dMB Flags 0x%08x", i, (sint32)(memProperties.memoryHeaps[i].size / 1024ll / 1024ll), (uint32)memProperties.memoryHeaps[i].flags);
cemuLog_log(LogType::Force, "Heap {} - Size {}MB Flags 0x{:08x}", i, (sint32)(memProperties.memoryHeaps[i].size / 1024ll / 1024ll), (uint32)memProperties.memoryHeaps[i].flags);
}
for (uint32 i = 0; i < memProperties.memoryTypeCount; i++)
{
forceLog_printf("Memory %d - HeapIndex %d Flags 0x%08x", i, (sint32)memProperties.memoryTypes[i].heapIndex, (uint32)memProperties.memoryTypes[i].propertyFlags);
cemuLog_log(LogType::Force, "Memory {} - HeapIndex {} Flags 0x{:08x}", i, (sint32)memProperties.memoryTypes[i].heapIndex, (uint32)memProperties.memoryTypes[i].propertyFlags);
}
}
@ -1700,7 +1700,7 @@ void VulkanRenderer::QueryAvailableFormats()
if (fmtProp.optimalTilingFeatures == 0)
{
forceLog_printf("%s not supported", it.name);
cemuLog_log(LogType::Force, "{} not supported", it.name);
}
else if ((fmtProp.optimalTilingFeatures & requestedBits) != requestedBits)
{
@ -1716,7 +1716,7 @@ void VulkanRenderer::QueryAvailableFormats()
// missingStr.append(" TRANSFER_DST");
//if (!(fmtProp.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
// missingStr.append(" SAMPLED_IMAGE");
//forceLog_printf("%s", missingStr.c_str());
//cemuLog_log(LogType::Force, "{}", missingStr.c_str());
}
}
}
@ -1765,7 +1765,7 @@ ImTextureID VulkanRenderer::GenerateTexture(const std::vector<uint8>& data, cons
}
catch (const std::exception& ex)
{
forceLog_printf("can't generate imgui texture: %s", ex.what());
cemuLog_log(LogType::Force, "can't generate imgui texture: {}", ex.what());
return nullptr;
}
}
@ -1888,7 +1888,7 @@ void VulkanRenderer::ProcessFinishedCommandBuffers()
// not signaled
break;
}
forceLog_printf("vkGetFenceStatus returned unexpected error %d", (sint32)fenceStatus);
cemuLog_log(LogType::Force, "vkGetFenceStatus returned unexpected error {}", (sint32)fenceStatus);
cemu_assert_debug(false);
}
if (finishedCmdBuffers)
@ -1904,11 +1904,11 @@ void VulkanRenderer::WaitForNextFinishedCommandBuffer()
VkResult result = vkWaitForFences(m_logicalDevice, 1, &m_cmd_buffer_fences[m_commandBufferSyncIndex], true, UINT64_MAX);
if (result == VK_TIMEOUT)
{
forceLog_printf("vkWaitForFences: Returned VK_TIMEOUT on infinite fence");
cemuLog_log(LogType::Force, "vkWaitForFences: Returned VK_TIMEOUT on infinite fence");
}
else if (result != VK_SUCCESS)
{
forceLog_printf("vkWaitForFences: Returned unhandled error %d", (sint32)result);
cemuLog_log(LogType::Force, "vkWaitForFences: Returned unhandled error {}", (sint32)result);
}
// process
ProcessFinishedCommandBuffers();
@ -2040,7 +2040,7 @@ void VulkanRenderer::PipelineCacheSaveThread(size_t cache_size)
}
catch (const std::exception& ex)
{
forceLog_printf("can't create vulkan pipeline cache directory \"%s\": %s", dir.generic_string().c_str(), ex.what());
cemuLog_log(LogType::Force, "can't create vulkan pipeline cache directory \"{}\": {}", _pathToUtf8(dir), ex.what());
return;
}
}
@ -2089,12 +2089,12 @@ void VulkanRenderer::PipelineCacheSaveThread(size_t cache_size)
}
else
{
forceLog_printf("can't write pipeline cache to disk");
cemuLog_log(LogType::Force, "can't write pipeline cache to disk");
}
}
else
{
forceLog_printf("can't retrieve pipeline cache data: 0x%x", res);
cemuLog_log(LogType::Force, "can't retrieve pipeline cache data: 0x{:x}", res);
}
}
else
@ -2205,7 +2205,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD
formatInfoOut->decoder = TextureDecoder_D32_S8_UINT_X24::getInstance();
break;
default:
forceLog_printf("Unsupported depth texture format %04x", (uint32)format);
cemuLog_log(LogType::Force, "Unsupported depth texture format {:04x}", (uint32)format);
// default to placeholder format
formatInfoOut->vkImageFormat = VK_FORMAT_D16_UNORM;
formatInfoOut->vkImageAspect = VK_IMAGE_ASPECT_DEPTH_BIT;
@ -2458,7 +2458,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD
formatInfoOut->vkImageFormat = VK_FORMAT_R8G8B8A8_UINT; // todo - should we use ABGR format?
formatInfoOut->decoder = TextureDecoder_X24_G8_UINT::getInstance(); // todo - verify
default:
forceLog_printf("Unsupported color texture format %04x\n", (uint32)format);
cemuLog_log(LogType::Force, "Unsupported color texture format {:04x}", (uint32)format);
cemu_assert_debug(false);
}
}
@ -2581,7 +2581,7 @@ VkPipeline VulkanRenderer::backbufferBlit_createGraphicsPipeline(VkDescriptorSet
result = vkCreateGraphicsPipelines(m_logicalDevice, m_pipeline_cache, 1, &pipelineInfo, nullptr, &pipeline);
if (result != VK_SUCCESS)
{
forceLog_printf("Failed to create graphics pipeline. Error %d", result);
cemuLog_log(LogType::Force, "Failed to create graphics pipeline. Error {}", result);
throw std::runtime_error(fmt::format("Failed to create graphics pipeline: {}", result));
}
@ -3882,7 +3882,7 @@ VKRObjectRenderPass::VKRObjectRenderPass(AttachmentInfo_t& attachmentInfo, sint3
if (vkCreateRenderPass(VulkanRenderer::GetInstance()->GetLogicalDevice(), &renderPassInfo, nullptr, &m_renderPass) != VK_SUCCESS)
{
forceLog_printf("Vulkan-Error: Failed to create render pass");
cemuLog_log(LogType::Force, "Vulkan-Error: Failed to create render pass");
throw std::runtime_error("failed to create render pass!");
}

View file

@ -677,7 +677,7 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo*
info.imageView = nullTexture1D.view;
info.sampler = nullTexture1D.sampler;
textureArray.emplace_back(info);
// forceLog_printf("Vulkan-Info: Shader 0x%016llx uses 1D texture but bound texture has mismatching type (dim: 0x%02x)", shader->baseHash, textureView->gx2Dim);
// cemuLog_log(LogType::Force, "Vulkan-Info: Shader 0x{:016x} uses 1D texture but bound texture has mismatching type (dim: 0x{:02x})", shader->baseHash, textureView->gx2Dim);
continue;
}
else if (textureDim == Latte::E_DIM::DIM_2D && (textureView->dim != Latte::E_DIM::DIM_2D && textureView->dim != Latte::E_DIM::DIM_2D_MSAA))
@ -688,7 +688,7 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo*
info.imageView = nullTexture2D.view;
info.sampler = nullTexture2D.sampler;
textureArray.emplace_back(info);
// forceLog_printf("Vulkan-Info: Shader 0x%016llx uses 2D texture but bound texture has mismatching type (dim: 0x%02x)", shader->baseHash, textureView->gx2Dim);
// cemuLog_log(LogType::Force, "Vulkan-Info: Shader 0x{:016x} uses 2D texture but bound texture has mismatching type (dim: 0x{:02x})", shader->baseHash, textureView->gx2Dim);
continue;
}

View file

@ -353,7 +353,7 @@ CopySurfacePipelineInfo* VulkanRenderer::copySurface_getOrCreateGraphicsPipeline
VkResult result = vkCreatePipelineLayout(m_logicalDevice, &pipelineLayoutInfo, nullptr, &vkObjPipeline->pipeline_layout);
if (result != VK_SUCCESS)
{
forceLog_printf("%s", fmt::format("Failed to create pipeline layout: {}", result).c_str());
cemuLog_log(LogType::Force, "Failed to create pipeline layout: {}", result);
vkObjPipeline->pipeline = VK_NULL_HANDLE;
return copyPipeline;
}
@ -413,7 +413,7 @@ CopySurfacePipelineInfo* VulkanRenderer::copySurface_getOrCreateGraphicsPipeline
result = vkCreateGraphicsPipelines(m_logicalDevice, m_pipeline_cache, 1, &pipelineInfo, nullptr, &copyPipeline->vkObjPipeline->pipeline);
if (result != VK_SUCCESS)
{
forceLog_printf("Failed to create graphics pipeline for surface copy. Error %d Info:", (sint32)result);
cemuLog_log(LogType::Force, "Failed to create graphics pipeline for surface copy. Error {} Info:", (sint32)result);
cemu_assert_debug(false);
copyPipeline->vkObjPipeline->pipeline = VK_NULL_HANDLE;
}
@ -806,7 +806,7 @@ void VulkanRenderer::surfaceCopy_viaBuffer(LatteTextureVk* srcTextureVk, sint32
memoryManager->CreateBuffer(m_surfaceCopyBufferSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, m_surfaceCopyBuffer, m_surfaceCopyBufferMemory);
if (m_surfaceCopyBuffer == VK_NULL_HANDLE)
{
forceLog_printf("Vulkan: Failed to allocate surface copy buffer with size %llu", allocSize);
cemuLog_log(LogType::Force, "Vulkan: Failed to allocate surface copy buffer with size {}", allocSize);
return;
}
}