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