ImageData: remove automatic mutex locks.

This commit is contained in:
Sasha Szpakowski
2024-02-18 17:06:40 -04:00
parent d880c48502
commit 007090af14
9 changed files with 25 additions and 123 deletions
@@ -192,6 +192,7 @@ GraphicsReadback::Status GraphicsReadback::readbackBuffer(Buffer *buffer, size_t
if (imageData.get())
{
// Always lock the mutex since the user can't know when to do it.
love::thread::Lock lock(imageData->getMutex());
if (imageData->getWidth() != rect.w)
-6
View File
@@ -451,12 +451,6 @@ void Texture::drawLayer(Graphics *gfx, int layer, Quad *q, const Matrix4 &m)
void Texture::uploadImageData(love::image::ImageDataBase *d, int level, int slice, int x, int y)
{
love::image::ImageData *id = dynamic_cast<love::image::ImageData *>(d);
love::thread::EmptyLock lock;
if (id != nullptr)
lock.setLock(id->getMutex());
Rect rect = {x, y, d->getWidth(), d->getHeight()};
uploadByteData(d->getData(), d->getSize(), level, slice, rect);
}
@@ -68,8 +68,6 @@ GraphicsReadback::GraphicsReadback(love::graphics::Graphics *gfx, ReadbackMethod
{
void *dest = prepareReadbackDest(size);
love::thread::Lock lock(imageData->getMutex());
// Direct readback without copying avoids the need for a staging buffer,
// and lowers the system requirements of immediate RT readback.
Texture *t = (Texture *) texture;