Private Surface Data |
Any kind of application-specific data can be stored with a surface. For example, a surface that represents a map in a game might contain information about terrain.
A surface can have more than one private data buffer. Each buffer is identified by a globally unique identifier (GUID) that you supply when attaching the data to the surface.
To store private surface data, use Surface.SetPrivateData (inherited from the Resource class), passing an application-defined GUID for the data, and a Byte array that contains the private data to associate with the surface. Data is passed by value, and multiple sets can be associated with a single resource.
The SetPrivateData method allocates an internal buffer for the data and copies it. Once this is done, it is safe to free the source buffer or object. The internal buffer is released when FreePrivateData is called. This occurs automatically when the surface is freed.
To retrieve private data for a surface, declare a Byte array and then call the Surface.GetPrivateData method (also inherited from the Resource class), passing the GUID that was assigned to the data to populate the array.
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center