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

@ -515,7 +515,7 @@ void PPCInterpreter_MTFSF(PPCInterpreter_t* hCPU, uint32 Opcode)
static bool logFPSCRWriteOnce = false;
if( logFPSCRWriteOnce == false )
{
forceLog_printf("Unsupported write to FPSCR\n");
cemuLog_log(LogType::Force, "Unsupported write to FPSCR");
logFPSCRWriteOnce = true;
}
PPCInterpreter_nextInstruction(hCPU);
@ -697,4 +697,4 @@ void PPCInterpreter_FCMPU(PPCInterpreter_t* hCPU, uint32 Opcode)
fcmpu_espresso(hCPU, crfD, hCPU->fpr[frA].fp0, hCPU->fpr[frB].fp0);
PPCInterpreter_nextInstruction(hCPU);
}
}

View file

@ -60,12 +60,12 @@ uint64 PPCTimer_estimateRDTSCFrequency()
uint64 tsc_freq = muldiv64(tsc_diff, hrtFreq, hrtDiff);
// uint64 freqMultiplier = tsc_freq / hrtFreq;
//forceLog_printf("RDTSC measurement test:");
//forceLog_printf("TSC-diff: 0x%016llx", tsc_diff);
//forceLog_printf("TSC-freq: 0x%016llx", tsc_freq);
//forceLog_printf("HPC-diff: 0x%016llx", qpc_diff);
//forceLog_printf("HPC-freq: 0x%016llx", (uint64)qpc_freq.QuadPart);
//forceLog_printf("Multiplier: 0x%016llx", freqMultiplier);
//cemuLog_log(LogType::Force, "RDTSC measurement test:");
//cemuLog_log(LogType::Force, "TSC-diff: 0x{:016x}", tsc_diff);
//cemuLog_log(LogType::Force, "TSC-freq: 0x{:016x}", tsc_freq);
//cemuLog_log(LogType::Force, "HPC-diff: 0x{:016x}", qpc_diff);
//cemuLog_log(LogType::Force, "HPC-freq: 0x{:016x}", (uint64)qpc_freq.QuadPart);
//cemuLog_log(LogType::Force, "Multiplier: 0x{:016x}", freqMultiplier);
return tsc_freq;
}

View file

@ -82,7 +82,7 @@ void PPCRecompiler_enter(PPCInterpreter_t* hCPU, PPCREC_JUMP_ENTRY funcPtr)
{
auto t = std::chrono::high_resolution_clock::now();
auto dur = std::chrono::duration_cast<std::chrono::microseconds>(t.time_since_epoch()).count();
forceLog_printf("Recompiler exit: 0x%08x LR: 0x%08x Timestamp %lld.%04lld", hCPU->instructionPointer, hCPU->spr.LR, dur / 1000LL, (dur % 1000LL));
cemuLog_log(LogType::Force, "Recompiler exit: 0x{:08x} LR: 0x{:08x} Timestamp {}.{:04}", hCPU->instructionPointer, hCPU->spr.LR, dur / 1000LL, (dur % 1000LL));
}
#endif
#else
@ -341,7 +341,7 @@ void PPCRecompiler_reserveLookupTableBlock(uint32 offset)
void* p3 = MemMapper::AllocateMemory(&(ppcRecompilerInstanceData->ppcRecompilerDirectJumpTable[offset/4]), (PPC_REC_ALLOC_BLOCK_SIZE/4)*sizeof(void*), MemMapper::PAGE_PERMISSION::P_RW, true);
if( !p1 || !p3 )
{
forceLog_printf("Failed to allocate memory for recompiler (0x%08x)", offset);
cemuLog_log(LogType::Force, "Failed to allocate memory for recompiler (0x{:08x})", offset);
cemu_assert(false);
return;
}
@ -584,7 +584,7 @@ void PPCRecompiler_init()
PPCRecompiler_initPlatform();
forceLog_printf("Recompiler initialized");
cemuLog_log(LogType::Force, "Recompiler initialized");
ppcRecompilerEnabled = true;

View file

@ -643,7 +643,7 @@ bool PPCRecompilerImlGen_B(ppcImlGenContext_t* ppcImlGenContext, uint32 opcode)
{
// generate NOP iml instead of BL macro (this assures that segment PPC range remains intact)
PPCRecompilerImlGen_generateNewInstruction_noOp(ppcImlGenContext, NULL);
//forceLog_printf("Inline func 0x%08x at %08x", jumpAddressDest, ppcImlGenContext->ppcAddressOfCurrentInstruction);
//cemuLog_log(LogType::Force, "Inline func 0x{:08x} at {:08x}", jumpAddressDest, ppcImlGenContext->ppcAddressOfCurrentInstruction);
uint32* prevInstructionPtr = ppcImlGenContext->currentInstruction;
ppcImlGenContext->currentInstruction = (uint32*)memory_getPointerFromVirtualOffset(jumpAddressDest);
PPCRecompiler_generateInlinedCode(ppcImlGenContext, jumpAddressDest, inlineFuncInstructionCount);

View file

@ -871,11 +871,11 @@ public:
// retry allocation
if (!newRange->allocateCacheMemory())
{
forceLog_printf("Out-of-memory in GPU buffer (trying to allocate: %dKB) Cleaning up cache...", (rangeEnd - rangeBegin + 1023) / 1024);
cemuLog_log(LogType::Force, "Out-of-memory in GPU buffer (trying to allocate: {}KB) Cleaning up cache...", (rangeEnd - rangeBegin + 1023) / 1024);
CleanupCacheAggressive(rangeBegin, rangeEnd);
if (!newRange->allocateCacheMemory())
{
forceLog_printf("Failed to free enough memory in GPU buffer");
cemuLog_log(LogType::Force, "Failed to free enough memory in GPU buffer");
cemu_assert(false);
}
}
@ -907,7 +907,7 @@ public:
// todo - add support for splitting BufferCacheNode memory allocations, then we dont need to do a separate allocation
if (!newRange->allocateCacheMemory())
{
forceLog_printf("Out-of-memory in GPU buffer during split operation");
cemuLog_log(LogType::Force, "Out-of-memory in GPU buffer during split operation");
cemu_assert(false);
}
newRange->syncFromNode(nodeObject);

View file

@ -222,7 +222,7 @@ LatteParsedGSCopyShader* LatteGSCopyShaderParser_parse(uint8* programData, uint3
}
else
{
forceLog_printf("Copyshader: Unknown 23_7 clause 0x%x found\n", cf_inst23_7);
cemuLog_log(LogType::Force, "Copyshader: Unknown 23_7 clause 0x{:x} found", cf_inst23_7);
cemu_assert_debug(false);
}
if( isEndOfProgram )

View file

@ -507,7 +507,7 @@ bool LatteMRT::UpdateCurrentFBO()
else if (rtEffectiveSize->width != effectiveWidth && rtEffectiveSize->height != effectiveHeight)
{
#ifdef CEMU_DEBUG_ASSERT
forceLog_printf("Color buffer size mismatch (%dx%d). Effective size: %dx%d Real size: %dx%d Mismatching texture: %08x %dx%d fmt %04x", rtEffectiveSize->width, rtEffectiveSize->height, effectiveWidth, effectiveHeight, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, colorAttachmentView->baseTexture->physAddress, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, (uint32)colorAttachmentView->baseTexture->format);
cemuLog_log(LogType::Force, "Color buffer size mismatch ({}x{}). Effective size: {}x{} Real size: {}x{} Mismatching texture: {:08x} {}x{} fmt {:04x}", rtEffectiveSize->width, rtEffectiveSize->height, effectiveWidth, effectiveHeight, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, colorAttachmentView->baseTexture->physAddress, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, (uint32)colorAttachmentView->baseTexture->format);
#endif
}
// currently the first color attachment defines the size of the current render target

View file

@ -301,7 +301,7 @@ void LatteShader_CreateRendererShader(LatteDecompilerShader* shader, bool compil
{
if (shader->hasError )
{
forceLog_printf("Unable to compile shader %" PRIx64, shader->baseHash);
cemuLog_log(LogType::Force, "Unable to compile shader {:016x}", shader->baseHash);
return;
}

View file

@ -319,7 +319,7 @@ void LatteShaderCache_load()
if (LatteShaderCache_readSeparableShader(fileData.data(), fileData.size()) == false)
{
// something is wrong with the stored shader, remove entry from shader cache files
forceLog_printf("Shader cache entry %d invalid, deleting...", loadIndex);
cemuLog_log(LogType::Force, "Shader cache entry {} invalid, deleting...", loadIndex);
fc_shaderCacheGeneric->DeleteFile({ name1, name2 });
}
numLoadedShaders++;
@ -338,7 +338,7 @@ void LatteShaderCache_load()
GetProcessMemoryInfo(GetCurrentProcess(), &pmc2, sizeof(PROCESS_MEMORY_COUNTERS));
LONGLONG totalMem2 = pmc2.PagefileUsage;
LONGLONG memCommited = totalMem2 - totalMem1;
forceLog_printf("Shader cache loaded with %d shaders. Commited mem %dMB. Took %dms", numLoadedShaders, (sint32)(memCommited/1024/1024), timeLoad);
cemuLog_log(LogType::Force, "Shader cache loaded with {} shaders. Commited mem {}MB. Took {}ms", numLoadedShaders, (sint32)(memCommited/1024/1024), timeLoad);
#endif
LatteShaderCache_finish();
// if Vulkan then also load pipeline cache

View file

@ -19,7 +19,7 @@ bool gxShader_checkIfSuccessfullyLinked(GLuint glProgram)
tempLength = sizeof(infoLog)-1;
glGetProgramInfoLog(glProgram, std::min(tempLength, infoLogLength), (GLsizei*)&tempLength, (GLcharARB*)infoLog);
infoLog[tempLength] = '\0';
forceLog_printf("Link error in raw shader");
cemuLog_log(LogType::Force, "Link error in raw shader");
cemuLog_log(LogType::Force, infoLog);
return false;
}
@ -83,8 +83,8 @@ GLuint gpu7ShaderGLDepr_compileShader(const std::string& source, uint32_t type)
char log[2048]{};
GLsizei log_size;
glGetShaderInfoLog(shader_object, std::min(log_length, (GLint)sizeof(log) - 1), &log_size, log);
forceLog_printf("Error/Warning in vertex shader:");
forceLog_printf("%s", log);
cemuLog_log(LogType::Force, "Error/Warning in vertex shader:");
cemuLog_log(LogType::Force, log);
}
return shader_object;
@ -112,8 +112,8 @@ GLuint gpu7ShaderGLDepr_compileVertexShader(const char* shaderSource, sint32 sha
{
char messageLog[2048]{};
glGetShaderInfoLog(shaderObject, std::min<uint32>(shaderLogLengthInfo, sizeof(messageLog) - 1), (GLsizei*)&shaderLogLen, (GLcharARB*)messageLog);
forceLog_printf("Error/Warning in vertex shader:");
forceLog_printf("%s", messageLog);
cemuLog_log(LogType::Force, "Error/Warning in vertex shader:");
cemuLog_log(LogType::Force, messageLog);
}
return shaderObject;
}
@ -132,8 +132,8 @@ GLuint gpu7ShaderGLDepr_compileFragmentShader(const char* shaderSource, sint32 s
{
memset(messageLog, 0, sizeof(messageLog));
glGetShaderInfoLog(shaderObject, std::min<uint32>(shaderLogLengthInfo, sizeof(messageLog) - 1), (GLsizei*)&shaderLogLen, (GLcharARB*)messageLog);
forceLog_printf("Error/Warning in fragment shader:");
forceLog_printf("%s", messageLog);
cemuLog_log(LogType::Force, "Error/Warning in fragment shader:");
cemuLog_log(LogType::Force, messageLog);
}
return shaderObject;
}

View file

@ -376,13 +376,13 @@ void LatteTexture_CopySlice(LatteTexture* srcTexture, sint32 srcSlice, sint32 sr
sint32 effectiveHeight_dst = dstTexture->overwriteInfo.hasResolutionOverwrite ? dstTexture->overwriteInfo.height : dstTexture->height;
if (cafeLog_isLoggingFlagEnabled(LOG_TYPE_TEXTURE_CACHE))
{
forceLog_printf("_copySlice(): Unable to sync textures with mismatching scale ratio (due to texture rule)");
cemuLog_log(LogType::Force, "_copySlice(): Unable to sync textures with mismatching scale ratio (due to texture rule)");
float ratioWidth_src = (float)effectiveWidth_src / (float)srcTexture->width;
float ratioHeight_src = (float)effectiveHeight_src / (float)srcTexture->height;
float ratioWidth_dst = (float)effectiveWidth_dst / (float)dstTexture->width;
float ratioHeight_dst = (float)effectiveHeight_dst / (float)dstTexture->height;
forceLog_printf("Source: %08x origResolution %4d/%4d effectiveResolution %4d/%4d fmt %04x mipIndex %d ratioW/H: %.4f/%.4f", srcTexture->physAddress, srcTexture->width, srcTexture->height, effectiveWidth_src, effectiveHeight_src, (uint32)srcTexture->format, srcMip, ratioWidth_src, ratioHeight_src);
forceLog_printf("Destination: %08x origResolution %4d/%4d effectiveResolution %4d/%4d fmt %04x mipIndex %d ratioW/H: %.4f/%.4f", dstTexture->physAddress, dstTexture->width, dstTexture->height, effectiveWidth_dst, effectiveHeight_dst, (uint32)dstTexture->format, dstMip, ratioWidth_dst, ratioHeight_dst);
cemuLog_log(LogType::Force, "Source: {:08x} origResolution {:4}/{:4} effectiveResolution {:4}/{:4} fmt {:04x} mipIndex {} ratioW/H: {:.4}/{:.4}", srcTexture->physAddress, srcTexture->width, srcTexture->height, effectiveWidth_src, effectiveHeight_src, (uint32)srcTexture->format, srcMip, ratioWidth_src, ratioHeight_src);
cemuLog_log(LogType::Force, "Destination: {:08x} origResolution {:4}/{:4} effectiveResolution {:4}/{:4} fmt {:04x} mipIndex {} ratioW/H: {:.4}/{:.4}", dstTexture->physAddress, dstTexture->width, dstTexture->height, effectiveWidth_dst, effectiveHeight_dst, (uint32)dstTexture->format, dstMip, ratioWidth_dst, ratioHeight_dst);
}
//forceLogDebug_printf("If these textures are not meant to share data you can ignore this");
return;

View file

@ -661,7 +661,7 @@ void LatteTextureLoader_UpdateTextureSliceData(LatteTexture* tex, sint32 texture
uint64 benchmarkResultMicroSeconds = (benchmark_end.QuadPart - benchmark_begin.QuadPart) * 1000000ULL / benchmark_freq.QuadPart;
textureDecodeBenchmark_perFormatSum[(int)tex->format & 0x3F] += benchmarkResultMicroSeconds;
textureDecodeBenchmark_totalSum += benchmarkResultMicroSeconds;
forceLog_printf("TexDecode %04dx%04dx%04d Fmt %04x Dim %d TileMode %02x Took %03d.%03dms Sum(format) %06dms Sum(total) %06dms", textureLoader.width, textureLoader.height, textureLoader.surfaceInfoDepth, (int)tex->format, (int)tex->dim, textureLoader.tileMode, (uint32)(benchmarkResultMicroSeconds / 1000ULL), (uint32)(benchmarkResultMicroSeconds % 1000ULL), (uint32)(textureDecodeBenchmark_perFormatSum[tex->gx2Format & 0x3F] / 1000ULL), (uint32)(textureDecodeBenchmark_totalSum / 1000ULL));
cemuLog_log(LogType::Force, "TexDecode {:04}x{:04}x{:04} Fmt {:04x} Dim {} TileMode {:02x} Took {:03}.{:03}ms Sum(format) {:06}ms Sum(total) {:06}ms", textureLoader.width, textureLoader.height, textureLoader.surfaceInfoDepth, (int)tex->format, (int)tex->dim, textureLoader.tileMode, (uint32)(benchmarkResultMicroSeconds / 1000ULL), (uint32)(benchmarkResultMicroSeconds % 1000ULL), (uint32)(textureDecodeBenchmark_perFormatSum[tex->gx2Format & 0x3F] / 1000ULL), (uint32)(textureDecodeBenchmark_totalSum / 1000ULL));
#endif
// convert texture to RGBA when dumping is enabled
@ -738,11 +738,11 @@ void LatteTextureLoader_writeReadbackTextureToMemory(LatteTextureDefinition* tex
#ifdef CEMU_DEBUG_ASSERT
if (textureData->depth != 1)
forceLog_printf("_writeReadbackTextureToMemory(): Texture has multiple slices (not supported)");
cemuLog_log(LogType::Force, "_writeReadbackTextureToMemory(): Texture has multiple slices (not supported)");
#endif
if (textureLoader.physAddress == MPTR_NULL)
{
forceLog_printf("_writeReadbackTextureToMemory(): Texture has invalid address");
cemuLog_log(LogType::Force, "_writeReadbackTextureToMemory(): Texture has invalid address");
return;
}

View file

@ -76,7 +76,7 @@ void LatteTextureReadback_Initate(LatteTextureView* textureView)
// currently we don't support readback for resized textures
if (textureView->baseTexture->overwriteInfo.hasResolutionOverwrite)
{
forceLog_printf("_initate(): Readback is not supported for textures with modified resolution");
cemuLog_log(LogType::Force, "_initate(): Readback is not supported for textures with modified resolution");
return;
}
// check if texture isn't already queued for transfer
@ -128,7 +128,7 @@ void LatteTextureReadback_UpdateFinishedTransfers(bool forceFinish)
HRTick currentTick = HighResolutionTimer().now().getTick();
double elapsedSecondsTransfer = HighResolutionTimer::getTimeDiff(readbackInfo->transferStartTime, currentTick);
double elapsedSecondsWaiting = HighResolutionTimer::getTimeDiff(readbackInfo->waitStartTime, currentTick);
forceLog_printf("[Texture-Readback] %08x Res %4d/%4d TM %d FMT %04x ReadbackLatency: %6.3lfms WaitTime: %6.3lfms ForcedWait %s", readbackInfo->hostTextureCopy.physAddress, readbackInfo->hostTextureCopy.width, readbackInfo->hostTextureCopy.height, readbackInfo->hostTextureCopy.tileMode, (uint32)readbackInfo->hostTextureCopy.format, elapsedSecondsTransfer * 1000.0, elapsedSecondsWaiting * 1000.0, forceFinish?"yes":"no");
cemuLog_log(LogType::Force, "[Texture-Readback] {:08x} Res {:4}/{:4} TM {} FMT {:04x} ReadbackLatency: {:6.3}ms WaitTime: {:6.3}ms ForcedWait {}", readbackInfo->hostTextureCopy.physAddress, readbackInfo->hostTextureCopy.width, readbackInfo->hostTextureCopy.height, readbackInfo->hostTextureCopy.tileMode, (uint32)readbackInfo->hostTextureCopy.format, elapsedSecondsTransfer * 1000.0, elapsedSecondsWaiting * 1000.0, forceFinish?"yes":"no");
#endif
uint8* pixelData = readbackInfo->GetData();
LatteTextureLoader_writeReadbackTextureToMemory(&readbackInfo->hostTextureCopy, 0, 0, pixelData);

View file

@ -125,7 +125,7 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
return;
}
// unsupported depth format
forceLog_printf("OpenGL: Unsupported texture depth format 0x%04x", (uint32)format);
cemuLog_log(LogType::Force, "OpenGL: Unsupported texture depth format 0x{:04x}", (uint32)format);
// use placeholder format
formatInfoOut->setDepthFormat(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, false);
formatInfoOut->markAsAlternativeFormat();
@ -499,7 +499,7 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
}
else
{
forceLog_printf("OpenGL: Unsupported texture format 0x%04x", (uint32)format);
cemuLog_log(LogType::Force, "OpenGL: Unsupported texture format 0x{:04x}", (uint32)format);
cemu_assert_unimplemented();
}
formatInfoOut->glInternalFormat = glInternalFormat;

View file

@ -89,7 +89,7 @@ OpenGLRenderer::OpenGLRenderer()
void* buffer = glMapNamedBufferRange(glRendererState.uploadBuffer, 0, TEXBUFFER_SIZE, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT);
if (buffer == nullptr)
{
forceLog_printf("Failed to allocate GL texture upload buffer. Using traditional API instead");
cemuLog_log(LogType::Force, "Failed to allocate GL texture upload buffer. Using traditional API instead");
cemu_assert_debug(false);
}
glRendererState.uploadBufferPtr = buffer;
@ -104,7 +104,7 @@ OpenGLRenderer::OpenGLRenderer()
}
catch (const std::exception& ex)
{
forceLog_printf("Unable to create dxgi wrapper: %s (VRAM overlay stat won't be available)", ex.what());
cemuLog_log(LogType::Force, "Unable to create dxgi wrapper: {} (VRAM overlay stat won't be available)", ex.what());
}
#endif
}
@ -254,7 +254,7 @@ void OpenGLRenderer::Initialize()
{
Renderer::Initialize();
auto lock = cafeLog_acquire();
forceLog_printf("------- Init OpenGL graphics backend -------");
cemuLog_log(LogType::Force, "------- Init OpenGL graphics backend -------");
GLCanvas_MakeCurrent(false);
LoadOpenGLImports();
@ -268,12 +268,12 @@ void OpenGLRenderer::Initialize()
if (glMaxShaderCompilerThreadsARB)
glMaxShaderCompilerThreadsARB(0xFFFFFFFF);
forceLog_printf("OpenGL extensions:");
forceLog_printf("ARB_clip_control: %s", glClipControl ? "available" : "not supported");
forceLog_printf("ARB_get_program_binary: %s", (glGetProgramBinary != NULL && glProgramBinary != NULL) ? "available" : "not supported");
forceLog_printf("ARB_clear_texture: %s", (glClearTexImage != NULL) ? "available" : "not supported");
forceLog_printf("ARB_copy_image: %s", (glCopyImageSubData != NULL) ? "available" : "not supported");
forceLog_printf("NV_depth_buffer_float: %s", (glDepthRangedNV != NULL) ? "available" : "not supported");
cemuLog_log(LogType::Force, "OpenGL extensions:");
cemuLog_log(LogType::Force, "ARB_clip_control: {}", glClipControl ? "available" : "not supported");
cemuLog_log(LogType::Force, "ARB_get_program_binary: {}", (glGetProgramBinary != NULL && glProgramBinary != NULL) ? "available" : "not supported");
cemuLog_log(LogType::Force, "ARB_clear_texture: {}", (glClearTexImage != NULL) ? "available" : "not supported");
cemuLog_log(LogType::Force, "ARB_copy_image: {}", (glCopyImageSubData != NULL) ? "available" : "not supported");
cemuLog_log(LogType::Force, "NV_depth_buffer_float: {}", (glDepthRangedNV != NULL) ? "available" : "not supported");
// generate default frame buffer
glGenFramebuffers(1, &m_defaultFramebufferId);
@ -376,9 +376,9 @@ void OpenGLRenderer::GetVendorInformation()
char* glRendererString = (char*)glGetString(GL_RENDERER);
char* glVersionString = (char*)glGetString(GL_VERSION);
forceLog_printf("GL_VENDOR: %s", glVendorString ? glVendorString : "unknown");
forceLog_printf("GL_RENDERER: %s", glRendererString ? glRendererString : "unknown");
forceLog_printf("GL_VERSION: %s", glVersionString ? glVersionString : "unknown");
cemuLog_log(LogType::Force, "GL_VENDOR: {}", glVendorString ? glVendorString : "unknown");
cemuLog_log(LogType::Force, "GL_RENDERER: {}", glRendererString ? glRendererString : "unknown");
cemuLog_log(LogType::Force, "GL_VERSION: {}", glVersionString ? glVersionString : "unknown");
if(boost::icontains(glVersionString, "Mesa"))
{
@ -424,7 +424,7 @@ void _glDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GL
if (LatteGPUState.glVendor == GLVENDOR_NVIDIA && strstr(message, "does not have a defined base level"))
return;
forceLog_printf("GLDEBUG: %s", message);
cemuLog_log(LogType::Force, "GLDEBUG: {}", message);
cemu_assert_debug(false);
}

View file

@ -494,7 +494,7 @@ void LatteDrawGL_prepareIndicesWithGPUCache(MPTR indexDataMPTR, _INDEX_TYPE inde
break;
if (indexDataCacheFirst == nullptr)
{
forceLog_printf("Unable to allocate entry in index cache");
cemuLog_log(LogType::Force, "Unable to allocate entry in index cache");
assert_dbg();
}
}
@ -1601,4 +1601,4 @@ void OpenGLRenderer::renderstate_updateTextureSettingsGL(LatteDecompilerShader*
}
catchOpenGLError();
}
}
}

View file

@ -41,7 +41,7 @@ void OpenGLRenderer::bufferCache_copyStreamoutToMainBuffer(uint32 srcOffset, uin
if (glCopyNamedBufferSubData)
glCopyNamedBufferSubData(glStreamoutCacheRingBuffer, glAttributeCacheAB, srcOffset, dstOffset, size);
else
forceLog_printf("glCopyNamedBufferSubData() not supported");
cemuLog_log(LogType::Force, "glCopyNamedBufferSubData() not supported");
}
void OpenGLRenderer::streamout_rendererFinishDrawcall()
@ -55,4 +55,4 @@ void OpenGLRenderer::streamout_rendererFinishDrawcall()
m_isXfbActive = false;
}
}
}

View file

@ -119,8 +119,8 @@ RendererShaderGL::RendererShaderGL(ShaderType type, uint64 baseHash, uint64 auxH
char log[2048]{};
GLsizei log_size;
glGetShaderInfoLog(m_shader_object, std::min<uint32>(log_length, sizeof(log) - 1), &log_size, log);
forceLog_printf("Error/Warning in shader:");
forceLog_printf("%s", log);
cemuLog_log(LogType::Force, "Error/Warning in shader:");
cemuLog_log(LogType::Force, log);
}
// set debug name
@ -192,7 +192,7 @@ bool RendererShaderGL::WaitForCompiled()
tempLength = sizeof(infoLog) - 1;
glGetShaderInfoLog(m_shader_object, std::min(infoLogLength, tempLength), (GLsizei*)&tempLength, (GLcharARB*)infoLog);
infoLog[tempLength] = '\0';
forceLog_printf("Compile error in shader. Log:", infoLog);
cemuLog_log(LogType::Force, "Compile error in shader. Log:");
cemuLog_log(LogType::Force, infoLog);
}
if (m_shader_object != 0)
@ -212,7 +212,7 @@ bool RendererShaderGL::WaitForCompiled()
tempLength = sizeof(infoLog) - 1;
glGetProgramInfoLog(m_program, std::min(infoLogLength, tempLength), (GLsizei*)&tempLength, (GLcharARB*)infoLog);
infoLog[tempLength] = '\0';
forceLog_printf("Link error in shader. Log:", infoLog);
cemuLog_log(LogType::Force, "Link error in shader. Log:");
cemuLog_log(LogType::Force, infoLog);
}
m_isCompiled = true;
@ -273,7 +273,7 @@ void RendererShaderGL::ShaderCacheLoading_begin(uint64 cacheTitleId)
UNREACHABLE;
}
forceLog_printf("Using precompiled shaders: %s", usePrecompiled ? "true" : "false");
cemuLog_log(LogType::Force, "Using precompiled shaders: {}", usePrecompiled ? "true" : "false");
if (usePrecompiled)
{
@ -292,4 +292,4 @@ void RendererShaderGL::ShaderCacheLoading_end()
s_isLoadingShaders = false;
}
FileCache* RendererShaderGL::g_programBinaryCache{};
FileCache* RendererShaderGL::g_programBinaryCache{};

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;
}
}