Remove hacks skipping guest resource removal if they are bound

Fixes games running out of guest memory:
- Outrun 2
- Monster Garage
- probably many more

Removes "Skipping Release of..." test cases
This commit is contained in:
Silent 2020-11-17 20:33:34 +01:00
parent dc5f56222e
commit 74333af9c0
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
1 changed files with 12 additions and 48 deletions

View File

@ -8732,44 +8732,6 @@ __declspec(naked) void WINAPI xbox::EMUPATCH(D3D_BlockOnTime_4)( dword_xt Unknow
}
}
bool DestroyResource_Common(xbox::X_D3DResource* pResource)
{
if (pResource == g_pXbox_RenderTarget) {
LOG_TEST_CASE("Skipping Release of active Xbox Render Target");
return false;
}
if (pResource == g_pXbox_DepthStencil) {
LOG_TEST_CASE("Skipping Release of active Xbox Depth Stencil");
return false;
}
if (pResource == g_pXbox_BackBufferSurface) {
LOG_TEST_CASE("Skipping Release of active Xbox BackBuffer");
return false;
}
if (pResource == g_pXbox_DefaultDepthStencilSurface) {
LOG_TEST_CASE("Skipping Release of default Xbox Depth Stencil");
return false;
}
for (int i = 0; i < xbox::X_D3DTS_STAGECOUNT; i++) {
if (pResource == g_pXbox_SetTexture[i]) {
// This shouldn't happen, since texture resources that get destroyed,
// shouldn't be set to any stage anymore.
LOG_TEST_CASE("Skipping Release of active Xbox Texture");
return false;
}
}
// Release the host copy (if it exists!)
FreeHostResource(GetHostResourceKey(pResource));
return true;
}
// ******************************************************************
// * patch: D3D_DestroyResource
// ******************************************************************
@ -8777,10 +8739,11 @@ void WINAPI xbox::EMUPATCH(D3D_DestroyResource)(X_D3DResource* pResource)
{
LOG_FUNC_ONE_ARG(pResource);
if (DestroyResource_Common(pResource)) {
// Call the Xbox version of DestroyResource
XB_TRMP(D3D_DestroyResource)(pResource);
}
// Release the host copy (if it exists!)
FreeHostResource(GetHostResourceKey(pResource));
// Call the Xbox version of DestroyResource
XB_TRMP(D3D_DestroyResource)(pResource);
}
// ******************************************************************
@ -8793,12 +8756,13 @@ void WINAPI xbox::EMUPATCH(D3D_DestroyResource__LTCG)()
mov pResource, edi
}
if (DestroyResource_Common(pResource)) {
// Call the Xbox version of DestroyResource
__asm {
mov edi, pResource
call XB_TRMP(D3D_DestroyResource__LTCG)
}
// Release the host copy (if it exists!)
FreeHostResource(GetHostResourceKey(pResource));
// Call the Xbox version of DestroyResource
__asm {
mov edi, pResource
call XB_TRMP(D3D_DestroyResource__LTCG)
}
}