diff --git a/src/modules/graphics/Texture.cpp b/src/modules/graphics/Texture.cpp index b320865b5..9b3a73698 100644 --- a/src/modules/graphics/Texture.cpp +++ b/src/modules/graphics/Texture.cpp @@ -421,7 +421,7 @@ void Texture::uploadImageData(love::image::ImageDataBase *d, int level, int slic lock.setLock(id->getMutex()); Rect rect = {x, y, d->getWidth(), d->getHeight()}; - uploadByteData(d->getFormat(), d->getData(), d->getSize(), level, slice, rect, d); + uploadByteData(d->getFormat(), d->getData(), d->getSize(), level, slice, rect); } void Texture::replacePixels(love::image::ImageDataBase *d, int slice, int mipmap, int x, int y, bool reloadmipmaps) @@ -487,7 +487,7 @@ void Texture::replacePixels(const void *data, size_t size, int slice, int mipmap Graphics::flushBatchedDrawsGlobal(); - uploadByteData(format, data, size, mipmap, slice, rect, nullptr); + uploadByteData(format, data, size, mipmap, slice, rect); if (reloadmipmaps && mipmap == 0 && getMipmapCount() > 1) generateMipmaps(); diff --git a/src/modules/graphics/Texture.h b/src/modules/graphics/Texture.h index 8c73e1d6c..c56ae6e12 100644 --- a/src/modules/graphics/Texture.h +++ b/src/modules/graphics/Texture.h @@ -296,7 +296,7 @@ protected: void setGraphicsMemorySize(int64 size); void uploadImageData(love::image::ImageDataBase *d, int level, int slice, int x, int y); - virtual void uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r, love::image::ImageDataBase *imgd = nullptr) = 0; + virtual void uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r) = 0; virtual void generateMipmapsInternal() = 0; virtual void readbackImageData(love::image::ImageData *imagedata, int slice, int mipmap, const Rect &rect) = 0; diff --git a/src/modules/graphics/opengl/Buffer.cpp b/src/modules/graphics/opengl/Buffer.cpp index e6ace77ad..30196a396 100644 --- a/src/modules/graphics/opengl/Buffer.cpp +++ b/src/modules/graphics/opengl/Buffer.cpp @@ -80,6 +80,10 @@ Buffer::Buffer(love::graphics::Graphics *gfx, const Settings &settings, const st mapType = BUFFERTYPE_INDEX; else if (typeFlags & TYPEFLAG_SHADER_STORAGE) mapType = BUFFERTYPE_SHADER_STORAGE; + else if (typeFlags & TYPEFLAG_COPY_SOURCE) + mapType = BUFFERTYPE_COPY_SOURCE; + else if (typeFlags & TYPEFLAG_COPY_DEST) + mapType = BUFFERTYPE_COPY_DEST; target = OpenGL::getGLBufferType(mapType); diff --git a/src/modules/graphics/opengl/Texture.cpp b/src/modules/graphics/opengl/Texture.cpp index bef283dde..00f30d640 100644 --- a/src/modules/graphics/opengl/Texture.cpp +++ b/src/modules/graphics/opengl/Texture.cpp @@ -251,7 +251,7 @@ void Texture::createTexture() int slices = texType == TEXTURE_CUBE ? 6 : 1; Rect rect = {0, 0, 2, 2}; for (int slice = 0; slice < slices; slice++) - uploadByteData(PIXELFORMAT_RGBA8_UNORM, px, sizeof(px), 0, slice, rect, nullptr); + uploadByteData(PIXELFORMAT_RGBA8_UNORM, px, sizeof(px), 0, slice, rect); return; } @@ -452,18 +452,8 @@ void Texture::unloadVolatile() setGraphicsMemorySize(0); } -void Texture::uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r, love::image::ImageDataBase *imgd) +void Texture::uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r) { - love::image::ImageDataBase *oldd = slices.get(slice, level); - - // We can only replace the internal Data (used when reloading due to setMode) - // if the dimensions match. - if (imgd != nullptr && oldd != nullptr && oldd->getWidth() == imgd->getWidth() - && oldd->getHeight() == imgd->getHeight()) - { - slices.set(slice, level, imgd); - } - OpenGL::TempDebugGroup debuggroup("Texture data upload"); gl.bindTextureToUnit(this, 0, false); diff --git a/src/modules/graphics/opengl/Texture.h b/src/modules/graphics/opengl/Texture.h index 9619a8a1c..40f9f26e9 100644 --- a/src/modules/graphics/opengl/Texture.h +++ b/src/modules/graphics/opengl/Texture.h @@ -58,7 +58,7 @@ private: void createTexture(); - void uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r, love::image::ImageDataBase *imgd = nullptr) override; + void uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r) override; void generateMipmapsInternal() override;