virtual bool Map(ImageData* pdata, unsigned mipLevel = 0, unsigned levelCount = 0);
Map maps the texture data planes into the process address space so they can be accessed directly; should be called only from the rendering thread.
Map/Unmap may only be allowed in single threaded mode.
Typically, the mapping is done by the Update packet. On success, image plane data is stored into the provided ImageData structure.
- All of the data planes for the specified mip-level are mapped simultaneously, it is not possible to map an individual plane.
- For single data-plane images with mipmaps, top mipmap level index is 0, with subsequent mipmap having an index of 1 and so on.
- HW-specific formats are always mapped as a single plane, with Pitch reported as 0. It is expected that full DataSize amount of data will be written into the texture.
- Default levelCount value of 0 means that all levels should be mapped.
- Typically called on render thread (legal if ImageUse_MapSimThread was specified); back end may allow calling from simulation thread id ImageUse_MapSimThread is provided.
- A render texture can be used as a rendering source while it is Mapped on the external API level (CPU modification of it may have undefined effect until it is unmapped). This is allowed for efficient support of multi-threaded rendering and DrawableImage implementation. Texture can NOT be used as a render target while it is mapped.
Parameters |
Description |
ImageData* pdata |
The destination image that receives the texture data. |
unsigned mipLevel = 0 |
An unsigned integer specifying which mip level should be used. For single data plane images with mipmaps, the top level is 0. |
unsigned levelCount = 0 |
An unsigned integer specifying which levels should be mapped (0 means all levels). |
Returns true if the texture contents are mapped; false otherwise.