The Resource class is relatively small, and is the base class for all resources in Direct3D, so it may be a good idea to start this section with a list of each method, and what it's intended to be used for. You will never actually create or use the Resource class itself, since it is an abstract class, but you may find yourself using these methods on your other resource classes. See Table 8.1 for the methods on the resource class:
As you can see, the resource class deals mainly with enhancing managed resources performance. While not listed in the chart above, or the resource class, it's important to note that each resource in Direct3D will also have a usage, as well as a memory pool (defined in the Usage and Pool enumerations). These properties define how the resource is used, and where it is located in memory (be it system memory, video memory, or AGP memory). Resources all have a way to allow the CPU to access the data it stores, normally by a mechanism called Locking. In our examples thus far, we've filled our buffers with single "SetData" calls, and created our textures from files; however, it is possible to retrieve the data, or only set small subsections of that data, via locking these resources. We will discuss locking in this chapter briefly. Let's look at the first resource we were introduced to. |