From e5c8a75d40452b32537afd0e08a01ea37e8dbeea Mon Sep 17 00:00:00 2001 From: cutealien Date: Sun, 15 Oct 2023 21:38:06 +0000 Subject: [PATCH] Document deviant ITexture::lock behaviour for EDT_SOFTWARE drivers Software driver sometimes works with original image (in 2D) and sometimes with POT version of the image (in 3D). That is probably useful so it can draw the UI in best quality while having relative fast 3D. The problem is that lock() only returns one data - so it decided to return the original data and then in unlock it updates the other data. But lock() data usually depends on getSize() so using EDT_SOFTWARE like other drivers causes crashes. Not sure what the best solution here would be (maybe more flags or more lock functions?), so I just document the deviating behaviour and leave it as is. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6559 dfc29bdd-3216-0410-991c-e03cc46cb475 --- include/ITexture.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/ITexture.h b/include/ITexture.h index 9be26775..9fe7a7c6 100644 --- a/include/ITexture.h +++ b/include/ITexture.h @@ -195,13 +195,17 @@ public: //! Lock function. /** Locks the Texture and returns a pointer to access the pixels. After lock() has been called and all operations on the pixels - are done, you must call unlock(). - Locks are not accumulating, hence one unlock will do for an arbitrary - number of previous locks. You should avoid locking different levels without - unlocking in between, though, because only the last level locked will be - unlocked. + are done, you must call unlock(). Locks are not accumulating, hence one + unlock will do for an arbitrary number of previous locks. You should avoid + locking different levels without unlocking in between, because only the + last level locked will be unlocked. + The size of the i-th mipmap level is defined as max(getSize().Width>>i,1) - and max(getSize().Height>>i,1) + and max(getSize().Height>>i,1). + Except for textures of EDT_SOFTWARE driver which returns data for + getOriginalSize(). Reason: Both original sized and modified sized textures are used + in that driver depending on whether the texture is used in 2d or 3d. + \param mode Specifies what kind of changes to the locked texture are allowed. Unspecified behavior will arise if texture is written in read only mode or read from in write only mode.