Skip to content

Commit

Permalink
Don't restore texture after Preset or Reset
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Dec 6, 2024
1 parent d3daa21 commit d260b59
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7359
#define BUILD_NUMBER 7360
20 changes: 0 additions & 20 deletions ddraw/IDirect3DDeviceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4385,23 +4385,6 @@ HRESULT m_IDirect3DDeviceX::BackupStates()
return D3D_OK;
}

HRESULT m_IDirect3DDeviceX::RestoreTextures()
{
if (!d3d9Device || !*d3d9Device)
{
Logging::Log() << __FUNCTION__ " Error: Failed to get the device state!";
return DDERR_GENERIC;
}

// Restore textures
for (UINT y = 0; y < MaxTextureStages; y++)
{
SetTexture(y, AttachedTexture[y]);
}

return DD_OK;
}

HRESULT m_IDirect3DDeviceX::RestoreStates()
{
if (!d3d9Device || !*d3d9Device)
Expand Down Expand Up @@ -4454,9 +4437,6 @@ HRESULT m_IDirect3DDeviceX::RestoreStates()
}
}

// Restore textures
RestoreTextures();

// Restore viewport
D3DVIEWPORT9 viewport = {};
(*d3d9Device)->GetViewport(&viewport);
Expand Down
4 changes: 2 additions & 2 deletions ddraw/IDirect3DDeviceX.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,9 @@ class m_IDirect3DDeviceX : public IUnknown, public AddressLookupTableDdrawObject
if (lpCurrentRenderTargetX == lpSurfaceX)
{
lpCurrentRenderTargetX = nullptr;
LOG_LIMIT(100, __FUNCTION__ << " Warning: clearing current render target!");
}
for (UINT x = 1; x < MaxTextureStages; x++)
for (UINT x = 0; x < MaxTextureStages; x++)
{
if (CurrentTextureSurfaceX[x] == lpSurfaceX)
{
Expand All @@ -341,7 +342,6 @@ class m_IDirect3DDeviceX : public IUnknown, public AddressLookupTableDdrawObject
}
void ClearDdraw();
void BeforeResetDevice();
HRESULT RestoreTextures();
void AfterResetDevice();
void ReleaseAllStateBlocks();
};
1 change: 1 addition & 0 deletions ddraw/IDirectDrawSurfaceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5484,6 +5484,7 @@ void m_IDirectDrawSurfaceX::ReleaseD9Surface(bool BackupData, bool ResetSurface)
}
IsLocking = false;
LockedWithID = 0;
LastLock.LockedRect = {};
IsInBlt = false;
IsInBltBatch = false;

Expand Down

0 comments on commit d260b59

Please sign in to comment.