邊看邊寫下來的,肯定翻譯得不好,有要看的將就一下
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.
資源被放入內(nèi)存池中多半是為了給被請求的資源騰出使用的空間。 通常是顯存,包括顯卡道內(nèi)存中的AGP部分。D3DPOOL_DEFAULT 是從MANGED和SYSTEMMEM中分離出來的。它指明了被放入此中的資源是用來被設(shè)備訪問。注意,D3DPOOL_DEFAULT 沒有意味著MANAGED或SYSTEMMEM將會被選擇用來存儲資源,這是一個獨立的部分。放入D3DPOOL_DEFAULT 中的紋理不可以被LOCK除非是動態(tài)紋理或是私有紋理。FOURCC,驅(qū)動格式,為了訪問未鎖定的紋理,我們必須用IDirect3DDevice9::UpdateSurface, IDirect3DDevice9::UpdateTexture, IDirect3DDevice9::GetFrontBufferData, and IDirect3DDevice9::GetRenderTargetData.函數(shù)。顯然,對于許多應(yīng)用程序來說,MANAGED是更好的選擇。
注意,許多紋理是以私有的格式創(chuàng)建的。運行時D3D并不知道。是可以被加鎖的。同時應(yīng)該注意,不像紋理,交換鏈后臺緩沖區(qū),渲染目標,頂點緩沖,索引緩沖是可以被加鎖的。當設(shè)備丟失的時候,使用D3DPOOL_DEFAULT 創(chuàng)建的資源必須要在調(diào)用Reset之前釋放。可以參看D3D的LostDevice.
當使用D3DPOOL_DEFAULT 創(chuàng)建資源,并且顯卡的內(nèi)存有限的時候,MANAGED中的資源將會被清除以釋放足夠的內(nèi)存來滿足需求。
- 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中的當有需要的時候,會被自動復制到設(shè)備的可訪問內(nèi)存。MANAGED資源在系統(tǒng)內(nèi)存中是有備份的,于是當設(shè)備丟失的時候,不需要重新創(chuàng)建。參見Managing Resources 。MANAGED資源可以被加鎖,只有系統(tǒng)內(nèi)存中的備份是直接被修改的。當有必要的時候,D3D復制你所修改的內(nèi)容到系統(tǒng)可訪問區(qū)
- 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直接訪問的。這種內(nèi)存分配消耗系統(tǒng)的RAM但是不減少RAM的可用頁。在設(shè)備丟失的時候,這些資源不需要再次創(chuàng)建。在這個內(nèi)存池中的資源可以被加鎖,可以被用來讓IDirect3DDevice9::UpdateSurface or IDirect3DDevice9::UpdateTexture 去操作以D3DPOOL_DEFAULT. 方式創(chuàng)建的資源
- 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.
- 這種資源被放在系統(tǒng)的RAM中,設(shè)備丟失時候不用重新創(chuàng)建。這種資源不受設(shè)備大小和格式的限制。為此,這種資源不能被D3D訪問,也不能設(shè)置為紋理或渲染目標。但是,這種資源總是可以被創(chuàng)建,加鎖和復制。
- 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.
所有的內(nèi)存池類型對所有的資源有效。包括:頂點緩沖,索引緩沖,紋理,表面。
剩下的一些內(nèi)容就是各種類型的資源對各種渲染目標的效性。參見SDK
以下為FancyBit對D3DUSAGE的翻譯,由于和D3DPOOL關(guān)聯(lián)較強,故貼在此里,十分感謝FancyBit
他的主頁是:http://hi.baidu.com/148332727 希望大家多多交流,共同進步