翻譯 D3DPOOL
邊看邊寫下來的,肯定翻譯得不好,有要看的將就一下
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 希望大家多多交流,共同進步
posted on 2009-08-11 00:34 麒麟子 閱讀(1976) 評論(4) 編輯 收藏 引用 所屬分類: DirectX
D3DUSAGE_RENDERTARGET 此紋理或表面作為一個渲染目標被創建,只能分配在D3DPOOL_DEFAULT的顯卡內存中
D3DUSAGE_AUTOGENMIPMAP 資源會自動生成多精度(多層次細節)紋理(mipmap)(Direct3D 9). 不支持volume textures 和深度表面/深度紋理(凹凸貼圖). 這個usage 不支持系統內存中的資源(用D3DPOOL_SYSTEMMEM參數創建的資源).
D3DUSAGE_DEPTHSTENCIL 此資源將會是一個深度緩沖,只能用D3DPOOL_DEFAULT分配.
D3DUSAGE_DMAP The resource will be a displacement map. ???
D3DUSAGE_DONOTCLIP 頂點緩沖區內容不需要裁減. 當被渲染的緩沖區設置此位時,D3DRS_CLIPPING 渲染器狀態必須設置為false.
D3DUSAGE_DYNAMIC 設置此位表示頂點緩沖需要動態的內存使用。這對驅動程序很有用因為它使得驅動程序可以決定把緩沖區放在哪里。一般的,靜態頂端緩沖放置在顯存兒動態緩沖防止在AGP內存中。注意如果你沒有指定該標志位,那么頂點緩沖默認就是靜態的。
D3DUSAGE_DYNAMIC會被強制設置,當D3DLOCK_DISCARD 和 D3DLOCK_NOOVERWRITE 鎖標志一起使用. 因此, D3DLOCK_DISCARD and D3DLOCK_NOOVERWRITE 只對使用 D3DUSAGE_DYNAMIC創建的頂點緩沖有用.更多參見Managing Resources (Direct3D 9).
更多關于動態頂點緩沖的信息,參見Performance Optimizations (Direct3D 9).
D3DUSAGE_DYNAMIC 和 D3DPOOL_MANAGED不兼容. See D3DPOOL.
紋理也可以使用D3DUSAGE_DYNAMIC.當然, 托管的紋理不能使用 D3DUSAGE_DYNAMIC. 關于動態紋理的信息,參見 Using Dynamic Textures.
D3DUSAGE_WRITEONLY
用于頂點緩沖和索引緩沖
通知系統程序只想頂點和索引緩沖中寫入數據。使用這個標記可以讓驅動程序選擇讓寫入和渲染操作效率最佳的內存分配方式。啟用此特性后嘗試從內存緩沖中讀取數據的操作會失敗。只對使用D3DPOOL_DEFAULT分配在顯存中的數據有效。
D3DUSAGE_RTPATCHES Set to indicate that the vertex buffer is to be used for drawing high-order primitives. ???
D3DUSAGE_NONSECURE 允許創建的表面被另一個程序用一個無安全性的共享句柄打開,只在D3D9EX使用
D3DUSAGE_TEXTAPI D3D9EX專用 略
用于:
IDirect3DDevice9::CreateCubeTexture
IDirect3DDevice9::CreateDepthStencilSurface
IDirect3DDevice9::CreateIndexBuffer
IDirect3DDevice9::CreateOffscreenPlainSurface
IDirect3DDevice9::CreateRenderTarget
IDirect3DDevice9::CreateTexture
IDirect3DDevice9::CreateVertexBuffer
IDirect3DDevice9::CreateVolumeTexture
D3DXCreatexxx texturing functions