边看边写下来的,肯定翻译得不好,有要看的将就一下
D3DPOOL
Defines the memory class that holds the buffers for a resource.
这句不用翻译
typedef enum D3DPOOL
{
D3DPOOL_DEFAULT = 0,
D3DPOOL_MANAGED = 1,
D3DPOOL_SYSTEMMEM = 2,
D3DPOOL_SCRATCH = 3,
D3DPOOL_FORCE_DWORD = 0x7fffffff,
} D3DPOOL, *LPD3DPOOL;
Constants 常量
- D3DPOOL_DEFAULT
- Resources are placed in the memory pool most appropriate for the set of usages requested for the given resource. This is usually video memory, including both local video memory and AGP memory. The D3DPOOL_DEFAULT pool is separate from D3DPOOL_MANAGED and D3DPOOL_SYTEMMEM, and it specifies that the resource is placed in the preferred memory for device access. Note that D3DPOOL_DEFAULT never indicates that either D3DPOOL_MANAGED or D3DPOOL_SYSTEMMEM should be chosen as the memory pool type for this resource. Textures placed in the D3DPOOL_DEFAULT pool cannot be locked unless they are dynamic textures or they are private, FOURCC, driver formats. To access unlockable textures, you must use functions such as IDirect3DDevice9::UpdateSurface, IDirect3DDevice9::UpdateTexture, IDirect3DDevice9::GetFrontBufferData, and IDirect3DDevice9::GetRenderTargetData. D3DPOOL_MANAGED is probably a better choice than D3DPOOL_DEFAULT for most applications. Note that some textures created in driver-proprietary pixel formats, unknown to the Direct3D runtime, can be locked. Also note that - unlike textures - swap chain back buffers, render targets, vertex buffers, and index buffers can be locked. When a device is lost, resources created using D3DPOOL_DEFAULT must be released before calling IDirect3DDevice9::Reset. For more information, see Lost Devices.
When creating resources with D3DPOOL_DEFAULT, if video card memory is already committed, managed resources will be evicted to free enough memory to satisfy the request.
资源被放入内存池中多半是为了给被请求的资源腾出使用的空间。 通常是显存,包括显卡道内存中的AGP部分。D3DPOOL_DEFAULT 是从MANGED和SYSTEMMEM中分离出来的。它指明了被放入此中的资源是用来被设备访问。注意,D3DPOOL_DEFAULT 没有意味着MANAGED或SYSTEMMEM将会被选择用来存储资源,这是一个独立的部分。放入D3DPOOL_DEFAULT 中的纹理不可以被LOCK除非是动态纹理或是私有纹理。FOURCC,驱动格式,为了访问未锁定的纹理,我们必须用IDirect3DDevice9::UpdateSurface, IDirect3DDevice9::UpdateTexture, IDirect3DDevice9::GetFrontBufferData, and IDirect3DDevice9::GetRenderTargetData.函数。显然,对于许多应用程序来说,MANAGED是更好的选择。
注意,许多纹理是以私有的格式创建的。运行时D3D并不知道。是可以被加锁的。同时应该注意,不像纹理,交换链后台缓冲区,渲染目标,顶点缓冲,索引缓冲是可以被加锁的。当设备丢失的时候,使用D3DPOOL_DEFAULT 创建的资源必须要在调用Reset之前释放。可以参看D3D的LostDevice.
当使用D3DPOOL_DEFAULT 创建资源,并且显卡的内存有限的时候,MANAGED中的资源将会被清除以释放足够的内存来满足需求。
- D3DPOOL_MANAGED
- Resources are copied automatically to device-accessible memory as needed. Managed resources are backed by system memory and do not need to be recreated when a device is lost. See Managing Resources for more information. Managed resources can be locked. Only the system-memory copy is directly modified. Direct3D copies your changes to driver-accessible memory as needed.
- 在MANAGED中的当有需要的时候,会被自动复制到设备的可访问内存。MANAGED资源在系统内存中是有备份的,于是当设备丢失的时候,不需要重新创建。参见Managing Resources 。MANAGED资源可以被加锁,只有系统内存中的备份是直接被修改的。当有必要的时候,D3D复制你所修改的内容到系统可访问区
- D3DPOOL_SYSTEMMEM
- Resources are placed in memory that is not typically accessible by the Direct3D device. This memory allocation consumes system RAM but does not reduce pageable RAM. These resources do not need to be recreated when a device is lost. Resources in this pool can be locked and can be used as the source for a IDirect3DDevice9::UpdateSurface or IDirect3DDevice9::UpdateTexture operation to a memory resource created with D3DPOOL_DEFAULT.
- 被放置在SYSTMMEM中的资源是典型地不可被3D直接访问的。这种内存分配消耗系统的RAM但是不减少RAM的可用页。在设备丢失的时候,这些资源不需要再次创建。在这个内存池中的资源可以被加锁,可以被用来让IDirect3DDevice9::UpdateSurface or IDirect3DDevice9::UpdateTexture 去操作以D3DPOOL_DEFAULT. 方式创建的资源
- D3DPOOL_SCRATCH
- Resources are placed in system RAM and do not need to be recreated when a device is lost. These resources are not bound by device size or format restrictions. Because of this, these resources cannot be accessed by the Direct3D device nor set as textures or render targets. However, these resources can always be created, locked, and copied.
- 这种资源被放在系统的RAM中,设备丢失时候不用重新创建。这种资源不受设备大小和格式的限制。为此,这种资源不能被D3D访问,也不能设置为纹理或渲染目标。但是,这种资源总是可以被创建,加锁和复制。
- D3DPOOL_FORCE_DWORD
- Forces this enumeration to compile to 32 bits in size. Without this value, some compilers would allow this enumeration to compile to a size other than 32 bits. This value is not used.
- 强制编译器使用32位来编译这个枚举量。若没有这个值,一些编译器将允许这个枚举以非32位的方式编译。这个值未被使用。
Remarks 评论
All pool types are valid with all resources. This includes: vertex buffers, index buffers, textures, and surfaces.
所有的内存池类型对所有的资源有效。包括:顶点缓冲,索引缓冲,纹理,表面。
剩下的一些内容就是各种类型的资源对各种渲染目标的效性。参见SDK
以下为FancyBit对D3DUSAGE的翻译,由于和D3DPOOL关联较强,故贴在此里,十分感谢FancyBit
他的主页是:http://hi.baidu.com/148332727 希望大家多多交流,共同进步