Skip to content

Commit

Permalink
Do not delete surface buffers after Unlock.
Browse files Browse the repository at this point in the history
Fixes race conditions during texture upload.
See issue #28
  • Loading branch information
rdoeffinger committed Sep 8, 2021
1 parent 6053b3e commit 0db680e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
14 changes: 0 additions & 14 deletions impl11/ddraw/MipmapSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,20 +747,6 @@ HRESULT MipmapSurface::Unlock(
if (this->_mipmapCount == 1)
{
this->_surface->_d3dTexture->Load(this->_surface->_d3dTexture);

if (this->_surface->_buffer != nullptr)
{
delete[] this->_surface->_buffer;
this->_surface->_buffer = nullptr;
this->_surface->_bufferSize = 0;
this->_surface->_width = 0;
this->_surface->_height = 0;

this->_buffer = nullptr;
this->_bufferSize = 0;
this->_width = 0;
this->_height = 0;
}
}

return DD_OK;
Expand Down
9 changes: 0 additions & 9 deletions impl11/ddraw/TextureSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,15 +803,6 @@ HRESULT TextureSurface::Unlock(
if (this->_pixelFormat.dwRGBBitCount == 32 && this->_mipmapCount == 1)
{
this->_d3dTexture->Load(this->_d3dTexture);

if (this->_buffer != nullptr)
{
delete[] this->_buffer;
this->_buffer = nullptr;
this->_bufferSize = 0;
this->_width = 0;
this->_height = 0;
}
}

return DD_OK;
Expand Down

0 comments on commit 0db680e

Please sign in to comment.