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
This commit is contained in:
cutealien 2023-10-15 21:38:06 +00:00
parent f06347c8b7
commit e5c8a75d40

View File

@ -195,13 +195,17 @@ public:
//! Lock function. //! Lock function.
/** Locks the Texture and returns a pointer to access the /** Locks the Texture and returns a pointer to access the
pixels. After lock() has been called and all operations on the pixels pixels. After lock() has been called and all operations on the pixels
are done, you must call unlock(). are done, you must call unlock(). Locks are not accumulating, hence one
Locks are not accumulating, hence one unlock will do for an arbitrary unlock will do for an arbitrary number of previous locks. You should avoid
number of previous locks. You should avoid locking different levels without locking different levels without unlocking in between, because only the
unlocking in between, though, because only the last level locked will be last level locked will be unlocked.
unlocked.
The size of the i-th mipmap level is defined as max(getSize().Width>>i,1) 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 \param mode Specifies what kind of changes to the locked texture are
allowed. Unspecified behavior will arise if texture is written in read allowed. Unspecified behavior will arise if texture is written in read
only mode or read from in write only mode. only mode or read from in write only mode.