Remove PUBLIC_RELEASE flag and tie asserts to debug config (#287)

Removes the -DPUBLIC_RELEASE flag. Cemu's debug asserts are now only enabled if the build configuration is Debug. Similarly, on Windows the console is only shown for Debug builds.
This commit is contained in:
Exzap 2022-09-24 08:43:27 +02:00 committed by GitHub
parent b720d17a97
commit 3bceb39966
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 154 additions and 186 deletions

View file

@ -505,7 +505,7 @@ LatteFetchShader* LatteFetchShader::FindByGPUState()
lookupInfo->programSize = _getFSProgramSize();
lookupInfo->lastFrameAccessed = LatteGPUState.frameCounter;
g_fetchShaderLookupCache.store(fsPhysAddr24, lookupInfo);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
cemu_assert_debug(g_fetchShaderLookupCache.lookup(fsPhysAddr24) == lookupInfo);
#endif
}

View file

@ -87,7 +87,7 @@ public:
return; // do nothing if added range is already covered
rangeBegin = (std::min)(rangeBegin, (*itr).first.rangeBegin);
// DEBUG - make sure this is the start point of the merge process (the first entry that starts below minValue)
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (itr != m_map.cbegin())
{
// check previous result

View file

@ -136,7 +136,7 @@ uint32 LatteCP_readU32Deprc()
}
v = *(uint32*)gxRingBufferReadPtr;
gxRingBufferReadPtr += 4;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (v == 0xcdcdcdcd)
assert_dbg();
#endif
@ -299,7 +299,7 @@ LatteCMDPtr LatteCP_itSetRegistersGeneric(LatteCMDPtr cmd, uint32 nWords)
uint32 registerIndex = TRegisterBase + registerOffset;
uint32 registerStartIndex = registerIndex;
uint32 registerEndIndex = registerStartIndex + nWords;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
cemu_assert_debug((registerIndex + nWords) <= LATTE_MAX_REGISTER);
#endif
uint32* outputReg = (uint32*)(LatteGPUState.contextRegister + registerIndex);
@ -340,7 +340,7 @@ LatteCMDPtr LatteCP_itSetRegistersGeneric(LatteCMDPtr cmd, uint32 nWords, TRegRa
uint32 registerIndex = TRegisterBase + registerOffset;
uint32 registerStartIndex = registerIndex;
uint32 registerEndIndex = registerStartIndex + nWords;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
cemu_assert_debug((registerIndex + nWords) <= LATTE_MAX_REGISTER);
#endif
cbRegRange(registerStartIndex, registerEndIndex);
@ -1069,7 +1069,7 @@ void LatteCP_processCommandBuffer(uint8* cmdBuffer, sint32 cmdSize, DrawPassCont
{
uint32 itCode = (itHeader >> 8) & 0xFF;
uint32 nWords = ((itHeader >> 16) & 0x3FFF) + 1;
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
LatteCMDPtr expectedPostCmd = cmd + nWords;
#endif
switch (itCode)
@ -1126,7 +1126,7 @@ void LatteCP_processCommandBuffer(uint8* cmdBuffer, sint32 cmdSize, DrawPassCont
return;
cemu_assert_debug(!drawPassCtx.isWithinDrawPass());
}
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
expectedPostCmd = cmd;
#endif
}
@ -1156,7 +1156,7 @@ void LatteCP_processCommandBuffer(uint8* cmdBuffer, sint32 cmdSize, DrawPassCont
cmd = LatteCP_itDrawIndex2(cmd, nWords, drawPassCtx);
cmd = LatteCP_processCommandBuffer_continuousDrawPass(cmd, cmdStart, cmdEnd, drawPassCtx);
cemu_assert_debug(cmd == cmdEnd || drawPassCtx.isWithinDrawPass() == false); // draw sequence should have ended if we didn't reach the end of the command buffer
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
expectedPostCmd = cmd;
#endif
}
@ -1167,7 +1167,7 @@ void LatteCP_processCommandBuffer(uint8* cmdBuffer, sint32 cmdSize, DrawPassCont
cmd = LatteCP_itDrawIndexAuto(cmd, nWords, drawPassCtx);
cmd = LatteCP_processCommandBuffer_continuousDrawPass(cmd, cmdStart, cmdEnd, drawPassCtx);
cemu_assert_debug(cmd == cmdEnd || drawPassCtx.isWithinDrawPass() == false); // draw sequence should have ended if we didn't reach the end of the command buffer
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
expectedPostCmd = cmd;
#endif
#ifdef FAST_DRAW_LOGGING
@ -1313,7 +1313,7 @@ void LatteCP_processCommandBuffer(uint8* cmdBuffer, sint32 cmdSize, DrawPassCont
cemu_assert_debug(false);
LatteSkipCMD(nWords);
}
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if(cmd != expectedPostCmd)
debug_printf("cmd %016p expectedPostCmd %016p\n", cmd, expectedPostCmd);
cemu_assert_debug(cmd == expectedPostCmd);

View file

@ -402,7 +402,7 @@ void LatteOverlay_RenderNotifications(ImVec2& position, ImVec2& pivot, sint32 di
ImRotateEnd(0.001f * ticks.time_since_epoch().count());
ImGui::SameLine();
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
uint64 totalTime = g_compiling_pipelines_syncTimeSum / 1000000ull;
if (s_pipeline_count_async > 0)
{

View file

@ -506,7 +506,7 @@ bool LatteMRT::UpdateCurrentFBO()
}
else if (rtEffectiveSize->width != effectiveWidth && rtEffectiveSize->height != effectiveHeight)
{
#ifndef PUBLIC_RELEASE
#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);
#endif
}

View file

@ -11,7 +11,7 @@ LatteRingBuffer_t* LatteRingBuffer_create(uint8* data, uint32 size)
uint8* LatteRingBuffer_allocate(LatteRingBuffer_t* rb, sint32 size, sint32 alignment)
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
cemu_assert_debug(size < rb->size);
#endif
// align

View file

@ -236,7 +236,7 @@ void LatteShader_UpdatePSInputs(uint32* contextRegisters)
}
// semantic imports from vertex shader
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
uint8 semanticMask[256 / 8] = { 0 };
#endif
cemu_assert_debug(numPSInputs <= GPU7_PS_MAX_INPUTS);
@ -273,7 +273,7 @@ void LatteShader_UpdatePSInputs(uint32* contextRegisters)
}
else
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (semanticMask[psSemanticId >> 3] & (1 << (psSemanticId & 7)))
{
forceLogDebug_printf("SemanticId already used");

View file

@ -252,7 +252,7 @@ float LatteSoftware_omod(uint32 omod, float f)
return 0.0f;
}
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
#define _clamp(__v) if(destClamp != 0) cemu_assert_unimplemented()
#else
#define _clamp(__v) // todo

View file

@ -100,7 +100,7 @@ void LatteStreamout_PrepareDrawcall(uint32 count, uint32 instanceCount)
uint32 streamoutWriteMask = 0;
if (geometryShader)
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
cemu_assert_debug(vertexShader->streamoutBufferWriteMask2.any() == false);
#endif
for (sint32 i = 0; i < LATTE_NUM_STREAMOUT_BUFFER; i++)

View file

@ -1089,7 +1089,7 @@ LatteTextureView* LatteTexture_CreateMapping(MPTR physAddr, MPTR physMipAddr, si
// for accesses to mips/slices using a physAddress offset we manually need to create a new view lookup
// by default views only create a lookup for the base texture physAddress
view->CreateLookupForSubTexture(relativeMipIndex, relativeSliceIndex);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
LatteTextureView* testView = LatteTextureViewLookupCache::lookup(physAddr, width, height, depth, pitch, firstMip, numMip, firstSlice, numSlice, format, dimView);
cemu_assert(testView);
#endif

View file

@ -275,7 +275,7 @@ void LatteTexture_updateTexturesForStage(LatteDecompilerShader* shaderContext, u
// check for changes
if (LatteTC_HasTextureChanged(textureView->baseTexture) || swizzleChanged)
{
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
debug_printf("Reload texture 0x%08x res %dx%d memRange %08x-%08x SwizzleChange: %s\n", textureView->baseTexture->physAddress, textureView->baseTexture->width, textureView->baseTexture->height, textureView->baseTexture->texDataPtrLow, textureView->baseTexture->texDataPtrHigh, swizzleChanged ? "yes" : "no");
#endif
// update swizzle / changed mip address

View file

@ -736,7 +736,7 @@ void LatteTextureLoader_writeReadbackTextureToMemory(LatteTextureDefinition* tex
LatteTextureLoaderCtx textureLoader = { 0 };
LatteTextureLoader_begin(&textureLoader, sliceIndex, mipIndex, textureData->physAddress, textureData->physMipAddress, textureData->format, textureData->dim, textureData->width, textureData->height, textureData->depth, textureData->mipLevels, textureData->pitch, textureData->tileMode, textureData->swizzle);
#ifndef PUBLIC_RELEASE
#ifdef CEMU_DEBUG_ASSERT
if (textureData->depth != 1)
forceLog_printf("_writeReadbackTextureToMemory(): Texture has multiple slices (not supported)");
#endif