將 DirectX 9 功能對應到 DirectX 11 APIMap DirectX 9 features to DirectX 11 APIs

了解 Direct3D 9 遊戲使用的功能如何轉譯到 Direct3D 11 與通用 Windows 平台 (UWP)。Understand how the features your Direct3D 9 game uses will translate to Direct3D 11 and the Universal Windows Platform (UWP).

另請參閱 規劃 DirectX 埠,以及 從 Direct3D 9 到 Direct3d 11 的重要變更Also see Plan your DirectX port, and Important changes from Direct3D 9 to Direct3D 11.

將 Direct3D 9 對應到 DirectX 11 APIMapping Direct3D 9 to DirectX 11 APIs

Direct3D 仍然是 DirectX 圖形的基礎,但從 DirectX 9 開始,API 已經有所變更:Direct3D is still the foundation of DirectX graphics, but the API has changed since DirectX 9:

  • Microsoft DirectX Graphics Infrastructure (DXGI) 用於設定圖形介面卡。Microsoft DirectX Graphics Infrastructure (DXGI) is used to set up graphics adapters. 使用 DXGI 來選取緩衝區格式、建立交換鏈結、呈現框架以及建立共用資源。Use DXGI to select buffer formats, create swap chains, present frames, and create shared resources. 請參閱 DXGI 概觀See DXGI Overview.
  • Direct3D 裝置內容是用於設定管線狀態和產生轉譯命令。A Direct3D device context is used to set pipeline state and generate rendering commands. 我們大部分的範例都使用即時內容直接轉譯到裝置;Direct3D 11 也支援多執行緒轉譯,這種情況下會使用延遲內容。Most of our samples use an immediate context to render directly to the device; Direct3D 11 also supports multithreaded rendering, in which case deferred contexts are used. 請參閱 Direct3D 11 中的裝置簡介See Introduction to a Device in Direct3D 11.
  • 某些功能已過時,其中最值得注意的是固定函式管線。Some features have been deprecated, most notably the fixed function pipeline. 請參閱過時的功能See Deprecated Features.

如需 Direct3D 11 功能的完整清單,請參閱 Direct3D 11 功能Direct3D 11 功能For a full list of Direct3D 11 features, see Direct3D 11 Features and Direct3D 11 Features.

從 Direct2D 9 移至 Direct2D 11Moving from Direct2D 9 to Direct2D 11

Direct2D (Windows) 仍然是 DirectX 圖形與 Windows 的重要部分。Direct2D (Windows) is still an important part of DirectX graphics and Windows. 您還是可以使用 Direct2D 繪製 2D 遊戲,並在 Direct3D 上繪製重疊 (HUD)。You can still use Direct2D to draw 2D games, and to draw overlays (HUDs) on top of Direct3D.

Direct2D 在 Direct3D 之上執行;可使用任一種 API 來實作 2D 遊戲。Direct2D runs on top of Direct3D; 2D games can be implemented using either API. 例如,使用 Direct3D 實作的 2D 遊戲可使用正視圖投影、設定 Z 值以控制基本型別的繪製順序,以及使用像素著色器新增特殊效果。For example, a 2D game implemented using Direct3D can use orthographic projection, set Z-values to control the drawing order of primitives, and use pixel shaders to add special effects.

因為 Direct2D 是以 Direct3D 為基礎,因此它也使用 DXGI 與裝置內容。Since Direct2D is based on Direct3D it also uses DXGI and device contexts. 請參閱 Direct2D API 概觀See Direct2D API Overview.

DirectWrite API 透過 Direct2D 新增對於格式化文字的支援。The DirectWrite API adds support for formatted text using Direct2D. 請參閱 DirectWrite 簡介See Introducing DirectWrite.

取代過時的協助程式程式庫Replace deprecated helper libraries

D3DX 與 DXUT 已過時,UWP 遊戲無法使用。D3DX and DXUT are deprecated and cannot be used by UWP games. 這些協助程式程式庫提供紋理載入與網格載入等工作的資源。These helper libraries provided resources for tasks such as texture loading and mesh loading.

將著色器程式從 FX 移到 HLSLMove shader programs from FX to HLSL

在 UWP,D3DX 公用程式庫 (D3DX 9、D3DX 10 與 D3DX 11),包含 Effects 在內都已過時。The D3DX utility library (D3DX 9, D3DX 10, and D3DX 11), including Effects, is deprecated for UWP. UWP 的所有 DirectX 遊戲都使用 HLSL 來驅動圖形管線,而不使用 Effects。All DirectX games for UWP drive the graphics pipeline using HLSL without Effects.

Visual Studio 仍然使用 FXC 編譯著色器物件。Visual Studio still uses FXC under the hood to compile shader objects. UWP 遊戲著色器會提前編譯。UWP game shaders are compiled ahead of time. 位元組程式碼於執行階段載入,然後在適當的轉譯階段, 將每個著色器資源繫結至圖形管線。The bytecode is loaded at runtime, then each shader resource is bound to the graphics pipeline during the appropriate rendering pass. 著色器應該移至各自的獨立 .HLSL 檔案,而且應該在您的 C++ 程式碼中實作轉譯技術。Shaders should be moved to their own separate .HLSL files and rendering techniques should be implemented in your C++ code.

若要快速瀏覽載入著色器資源,請參閱從 Direct3D 9 到 UWP 的簡易移植For a quick look at loading shader resources see Simple port from Direct3D 9 to UWP.

Direct3D 11 引進了著色器模型5,需要 Direct3D 功能等級 11 _ 0 (或以上的) 。Direct3D 11 introduced Shader Model 5, which requires Direct3D feature level 11_0 (or above). 請參閱 Direct3D 11 的 HLSL 著色器模型 5 功能See HLSL Shader Model 5 Features for Direct3D 11.

取代 XNAMath 與 D3DXMathReplace XNAMath and D3DXMath

使用 XNAMath (或 D3DXMath) 的程式碼應該移轉至 DirectXMathCode using XNAMath (or D3DXMath) should be migrated to DirectXMath. DirectXMath 包含可在 x86、x64 與 ARM 上進行移植的類型。DirectXMath includes types that are portable across x86, x64, and ARM. 請參閱從 XNA Math 程式庫移轉程式碼See Code Migration from the XNA Math Library.

請注意,DirectXMath 浮點數類型方便搭配著色器使用。Note that DirectXMath float types are convenient for use with shaders. 例如,XMFLOAT4XMFLOAT4X4 便於對齊常數緩衝區的資料。For example XMFLOAT4 and XMFLOAT4X4 conveniently align data for constant buffers.

將 DirectSound 取代為 XAudio2 (與背景音訊)Replace DirectSound with XAudio2 (and background audio)

UWP 不支援 DirectSound:DirectSound is not supported for UWP:

  • 使用 XAudio2 將音效新增至您的遊戲。Use XAudio2 to add sound effects to your game.

將 DirectInput 取代為 XInput 和 Windows 執行階段 ApiReplace DirectInput with XInput and Windows Runtime APIs

UWP 不支援 DirectInput:DirectInput is not supported for UWP:

  • 針對滑鼠、鍵盤與觸控輸入使用 CoreWindow 輸入事件回呼。Use CoreWindow input event callbacks for mouse, keyboard, and touch input.
  • 針對遊戲控制器支援 (與遊戲控制器耳機支援) 使用 XInput 1.4。Use XInput 1.4 for game controller support (and game controller headset support). 若您在桌面與 UWP 使用共用的程式碼基底,請參閱 XInput 版本,取得回溯相容性的詳細資訊。If you are using a shared code base for desktop and UWP, see XInput Versions for information on backwards compatibility.
  • 如果您的遊戲需要使用應用程式列,請登錄 EdgeGesture 事件。Register for EdgeGesture events if your game needs to use the app bar.

使用 Microsoft 媒體基礎代替 DirectShowUse Microsoft Media Foundation instead of DirectShow

DirectShow 不再是 DirectX API (或 Windows API) 的一部分。DirectShow is no longer part of the DirectX API (or the Windows API). Microsoft 媒體基礎為使用共用表面的 Direct3D 提供視訊內容。Microsoft Media Foundation provides video content to Direct3D using shared surfaces. 請參閱 Direct3D 11 視訊 APISee Direct3D 11 Video APIs.

將 DirectPlay 取代為網路程式碼Replace DirectPlay with networking code

Microsoft DirectPlay 已過時。Microsoft DirectPlay has been deprecated. 如果您的遊戲使用網路服務,您必須提供符合 UWP 需求的網路程式碼。If your game uses network services, you need to provide networking code that complies with UWP requirements. 請使用下列 API:Use the following APIs:

下列文章可協助您為 app 封裝資訊清單中的網路新增網路功能與宣告支援。The following articles help you add networking features and declare support for networking in your app's package manifest.

請注意,所有 UWP App (包含遊戲) 都使用特定的背景工作類型,以維持 App 暫停時的連線功能。Note that all UWP apps (including games) use specific types of background tasks to maintain connectivity while the app is suspended. 如果您的遊戲需要在暫停時維持連線狀態,請參閱網路功能基本知識If your game needs to maintain connection state while suspended see Networking basics.

函式對應Function mapping

使用下表協助將程式碼從 Direct3D 9 轉換至 Direct3D 11。Use the following table to help convert code from Direct3D 9 to Direct3D 11. 這也可幫助您區別裝置與裝置內容。This can also help distinguish between the device and device context.

Direct3D9Direct3D9 Direct3D 11 對等項目Direct3D 11 Equivalent

IDirect3DDevice9IDirect3DDevice9

ID3D11Device2ID3D11Device2

ID3D11DeviceContext2ID3D11DeviceContext2

圖形管線中會說明圖形管線階段。The graphics pipeline stages are described in Graphics Pipeline.

IDirect3D9IDirect3D9

IDXGIFactory2IDXGIFactory2

IDXGIAdapter2IDXGIAdapter2

IDXGIDevice3IDXGIDevice3

IDirect3DDevice9::PresentIDirect3DDevice9::Present

IDXGISwapChain1::Present1IDXGISwapChain1::Present1

IDirect3DDevice9::TestCooperativeLevelIDirect3DDevice9::TestCooperativeLevel

使用 DXGI_PRESENT_TEST 旗標組呼叫 IDXGISwapChain1::Present1Call IDXGISwapChain1::Present1 with the DXGI_PRESENT_TEST flag set.

IDirect3DBaseTexture9IDirect3DBaseTexture9

IDirect3DTexture9IDirect3DTexture9

IDirect3DCubeTexture9IDirect3DCubeTexture9

IDirect3DVolumeTexture9IDirect3DVolumeTexture9

IDirect3DIndexBuffer9IDirect3DIndexBuffer9

IDirect3DVertexBuffer9IDirect3DVertexBuffer9

ID3D11BufferID3D11Buffer

ID3D11Texture1DID3D11Texture1D

ID3D11Texture2DID3D11Texture2D

ID3D11Texture3DID3D11Texture3D

ID3D11ShaderResourceViewID3D11ShaderResourceView

ID3D11RenderTargetViewID3D11RenderTargetView

ID3D11DepthStencilViewID3D11DepthStencilView

IDirect3DVertexShader9IDirect3DVertexShader9

IDirect3DPixelShader9IDirect3DPixelShader9

ID3D11VertexShaderID3D11VertexShader

ID3D11PixelShaderID3D11PixelShader

IDirect3DVertexDeclaration9IDirect3DVertexDeclaration9

ID3D11InputLayoutID3D11InputLayout

IDirect3DDevice9::SetRenderStateIDirect3DDevice9::SetRenderState

IDirect3DDevice9::SetSamplerStateIDirect3DDevice9::SetSamplerState

ID3D11BlendState1ID3D11BlendState1

ID3D11DepthStencilStateID3D11DepthStencilState

ID3D11RasterizerState1ID3D11RasterizerState1

ID3D11SamplerStateID3D11SamplerState

IDirect3DDevice9::DrawIndexedPrimitiveIDirect3DDevice9::DrawIndexedPrimitive

IDirect3DDevice9::DrawPrimitiveIDirect3DDevice9::DrawPrimitive

ID3D11DeviceContext::DrawID3D11DeviceContext::Draw

ID3D11DeviceContext::DrawIndexedID3D11DeviceContext::DrawIndexed

ID3D11DeviceContext::DrawIndexedInstancedID3D11DeviceContext::DrawIndexedInstanced

ID3D11DeviceContext::DrawInstancedID3D11DeviceContext::DrawInstanced

ID3D11DeviceContext::IASetPrimitiveTopologyID3D11DeviceContext::IASetPrimitiveTopology

ID3D11DeviceContext::DrawAutoID3D11DeviceContext::DrawAuto

IDirect3DDevice9::BeginSceneIDirect3DDevice9::BeginScene

IDirect3DDevice9::EndSceneIDirect3DDevice9::EndScene

IDirect3DDevice9::DrawPrimitiveUPIDirect3DDevice9::DrawPrimitiveUP

IDirect3DDevice9::DrawIndexedPrimitiveUPIDirect3DDevice9::DrawIndexedPrimitiveUP

沒有直接的對等項目No direct equivalent

IDirect3DDevice9::ShowCursorIDirect3DDevice9::ShowCursor

IDirect3DDevice9::SetCursorPositionIDirect3DDevice9::SetCursorPosition

IDirect3DDevice9::SetCursorPropertiesIDirect3DDevice9::SetCursorProperties

使用標準游標 API。Use standard cursor APIs.

IDirect3DDevice9::ResetIDirect3DDevice9::Reset

LOST 裝置與 POOL_MANAGED 已不存在。LOST device and POOL_MANAGED no longer exist. IDXGISwapChain1::Present1 可能會因 DXGI_ERROR_DEVICE_REMOVED 傳回值。IDXGISwapChain1::Present1 can fail with a DXGI_ERROR_DEVICE_REMOVED return value.

IDirect3DDevice9:DrawRectPatchIDirect3DDevice9:DrawRectPatch

IDirect3DDevice9:DrawTriPatchIDirect3DDevice9:DrawTriPatch

IDirect3DDevice9: LightEnableIDirect3DDevice9:LightEnable

IDirect3DDevice9:MultiplyTransformIDirect3DDevice9:MultiplyTransform

IDirect3DDevice9:SetLightIDirect3DDevice9:SetLight

IDirect3DDevice9:SetMaterialIDirect3DDevice9:SetMaterial

IDirect3DDevice9:SetNPatchModeIDirect3DDevice9:SetNPatchMode

IDirect3DDevice9:SetTransformIDirect3DDevice9:SetTransform

IDirect3DDevice9:SetFVFIDirect3DDevice9:SetFVF

IDirect3DDevice9:SetTextureStageStateIDirect3DDevice9:SetTextureStageState

固定函式管線已過時。The fixed-function pipeline has been deprecated.

IDirect3DDevice9:CheckDepthStencilMatchIDirect3DDevice9:CheckDepthStencilMatch

IDirect3DDevice9:CheckDeviceFormatIDirect3DDevice9:CheckDeviceFormat

IDirect3DDevice9:GetDeviceCapsIDirect3DDevice9:GetDeviceCaps

IDirect3DDevice9:ValidateDeviceIDirect3DDevice9:ValidateDevice

功能層級會由功能層級取代。Capability bits are replaced by feature levels. 針對任何指定的功能層級,只有少數格式與功能用法案例是選用的。Only a few format and feature usage cases are optional for any given feature level. 這些可以 ID3D11Device::CheckFeatureSupportID3D11Device::CheckFormatSupport 進行檢查。These can be checked with ID3D11Device::CheckFeatureSupport and ID3D11Device::CheckFormatSupport.

表面格式對應Surface format mapping

使用下表將 Direct3D 9 格式轉換為 DXGI 格式。Use the following table to convert Direct3D 9 formats into DXGI formats.

Direct3D 9 格式Direct3D 9 Format Direct3D 11 格式Direct3D 11 Format

D3DFMT_UNKNOWND3DFMT_UNKNOWN

DXGI_FORMAT_UNKNOWNDXGI_FORMAT_UNKNOWN

D3DFMT_R8G8B8D3DFMT_R8G8B8

尚未提供Not available

D3DFMT_A8R8G8B8D3DFMT_A8R8G8B8

DXGI_FORMAT_B8G8R8A8_UNORMDXGI_FORMAT_B8G8R8A8_UNORM

DXGI_FORMAT_B8G8R8A8_UNORM_SRGBDXGI_FORMAT_B8G8R8A8_UNORM_SRGB

D3DFMT_X8R8G8B8D3DFMT_X8R8G8B8

DXGI_FORMAT_B8G8R8X8_UNORMDXGI_FORMAT_B8G8R8X8_UNORM

DXGI_FORMAT_B8G8R8X8_UNORM_SRGBDXGI_FORMAT_B8G8R8X8_UNORM_SRGB

D3DFMT_R5G6B5D3DFMT_R5G6B5

DXGI_FORMAT_B5G6R5_UNORMDXGI_FORMAT_B5G6R5_UNORM

D3DFMT_X1R5G5B5D3DFMT_X1R5G5B5

尚未提供Not available

D3DFMT_A1R5G5B5D3DFMT_A1R5G5B5

DXGI_FORMAT_B5G5R5A1_UNORMDXGI_FORMAT_B5G5R5A1_UNORM

D3DFMT_A4R4G4B4D3DFMT_A4R4G4B4

DXGI_FORMAT_B4G4R4A4_UNORMDXGI_FORMAT_B4G4R4A4_UNORM

D3DFMT_R3G3B2D3DFMT_R3G3B2

尚未提供Not available

D3DFMT_A8D3DFMT_A8

DXGI_FORMAT_A8_UNORMDXGI_FORMAT_A8_UNORM

D3DFMT_A8R3G3B2D3DFMT_A8R3G3B2

尚未提供Not available

D3DFMT_X4R4G4B4D3DFMT_X4R4G4B4

尚未提供Not available

D3DFMT_A2B10G10R10D3DFMT_A2B10G10R10

DXGI_FORMAT_R10G10B10A2DXGI_FORMAT_R10G10B10A2

D3DFMT_A8B8G8R8D3DFMT_A8B8G8R8

DXGI_FORMAT_R8G8B8A8_UNORMDXGI_FORMAT_R8G8B8A8_UNORM

DXGI_FORMAT_R8G8B8A8_UNORM_SRGBDXGI_FORMAT_R8G8B8A8_UNORM_SRGB

D3DFMT_X8B8G8R8D3DFMT_X8B8G8R8

尚未提供Not available

D3DFMT_G16R16D3DFMT_G16R16

DXGI_FORMAT_R16G16_UNORMDXGI_FORMAT_R16G16_UNORM

D3DFMT_A2R10G10B10D3DFMT_A2R10G10B10

尚未提供Not available

D3DFMT_A16B16G16R16D3DFMT_A16B16G16R16

DXGI_FORMAT_R16G16B16A16_UNORMDXGI_FORMAT_R16G16B16A16_UNORM

D3DFMT_A8P8D3DFMT_A8P8

尚未提供Not available

D3DFMT_P8D3DFMT_P8

尚未提供Not available

D3DFMT_L8D3DFMT_L8

DXGI_FORMAT_R8_UNORMDXGI_FORMAT_R8_UNORM

注意   使用著色器中的 r swizzle,將紅色複製到其他元件,以取得 Direct3D 9 行為。 Note   Use .r swizzle in shader to duplicate red to other components to get Direct3D 9 behavior.
 

D3DFMT_A8L8D3DFMT_A8L8

DXGI_FORMAT_R8G8_UNORMDXGI_FORMAT_R8G8_UNORM

注意   使用著色器中的 swizzle rrrg 複製紅色,並將綠色移至 Alpha 元件以取得 Direct3D 9 行為。 Note   Use swizzle .rrrg in shader to duplicate red and move green to the alpha components to get Direct3D 9 behavior.
 

D3DFMT_A4L4D3DFMT_A4L4

尚未提供Not available

D3DFMT_V8U8D3DFMT_V8U8

DXGI_FORMAT_R8G8_SNORMDXGI_FORMAT_R8G8_SNORM

D3DFMT_L6V5U5D3DFMT_L6V5U5

尚未提供Not available

D3DFMT_X8L8V8U8D3DFMT_X8L8V8U8

尚未提供Not available

D3DFMT_Q8W8V8U8D3DFMT_Q8W8V8U8

DXGI_FORMAT_R8G8B8A8_SNORMDXGI_FORMAT_R8G8B8A8_SNORM

D3DFMT_V16U16D3DFMT_V16U16

DXGI_FORMAT_R16G16_SNORMDXGI_FORMAT_R16G16_SNORM

D3DFMT_W11V11U10D3DFMT_W11V11U10

尚未提供Not available

D3DFMT_A2W10V10U10D3DFMT_A2W10V10U10

尚未提供Not available

D3DFMT_UYVYD3DFMT_UYVY

尚未提供Not available

D3DFMT_R8G8_B8G8D3DFMT_R8G8_B8G8

DXGI_FORMAT_G8R8_G8B8_UNORMDXGI_FORMAT_G8R8_G8B8_UNORM

注意   在 Direct3D 9 中,資料是由 255.0 f 進行調整,但這可以在著色器中處理。 Note   In Direct3D 9 the data was scaled up by 255.0f, but this can be handled in the shader.
 

D3DFMT_YUY2D3DFMT_YUY2

尚未提供Not available

D3DFMT_G8R8_G8B8D3DFMT_G8R8_G8B8

DXGI_FORMAT_R8G8_B8G8_UNORMDXGI_FORMAT_R8G8_B8G8_UNORM

注意   在 Direct3D 9 中,資料是由 255.0 f 進行調整,但這可以在著色器中處理。 Note   In Direct3D 9 the data was scaled up by 255.0f, but this can be handled in the shader.
 

D3DFMT_DXT1D3DFMT_DXT1

DXGI_FORMAT_BC1_UNORM 與 DXGI_FORMAT_BC1_UNORM_SRGBDXGI_FORMAT_BC1_UNORM & DXGI_FORMAT_BC1_UNORM_SRGB

D3DFMT_DXT2D3DFMT_DXT2

DXGI_FORMAT_BC1_UNORM 與 DXGI_FORMAT_BC1_UNORM_SRGBDXGI_FORMAT_BC1_UNORM & DXGI_FORMAT_BC1_UNORM_SRGB

注意   DXT1 和 DXT2 與 API/硬體的觀點相同。 Note   DXT1 and DXT2 are the same from an API/hardware perspective. 唯一的差異在於是否使用已預乘的 alpha,這可由應用程式追蹤,不需要個別格式。The only difference is whether premultiplied alpha is used, which can be tracked by an application and doesn't need a separate format.
 

D3DFMT_DXT3D3DFMT_DXT3

DXGI_FORMAT_BC2_UNORM 與 DXGI_FORMAT_BC2_UNORM_SRGBDXGI_FORMAT_BC2_UNORM & DXGI_FORMAT_BC2_UNORM_SRGB

D3DFMT_DXT4D3DFMT_DXT4

DXGI_FORMAT_BC2_UNORM 與 DXGI_FORMAT_BC2_UNORM_SRGBDXGI_FORMAT_BC2_UNORM & DXGI_FORMAT_BC2_UNORM_SRGB

注意   DXT3 和 DXT4 與 API/硬體的觀點相同。 Note   DXT3 and DXT4 are the same from an API/hardware perspective. 唯一的差異在於是否使用已預乘的 alpha,這可由應用程式追蹤,不需要個別格式。The only difference is whether premultiplied alpha is used, which can be tracked by an application and doesn't need a separate format.
 

D3DFMT_DXT5D3DFMT_DXT5

DXGI_FORMAT_BC3_UNORM 與 DXGI_FORMAT_BC3_UNORM_SRGBDXGI_FORMAT_BC3_UNORM & DXGI_FORMAT_BC3_UNORM_SRGB

D3DFMT_D16 與 D3DFMT_D16_LOCKABLED3DFMT_D16 & D3DFMT_D16_LOCKABLE

DXGI_FORMAT_D16_UNORMDXGI_FORMAT_D16_UNORM

D3DFMT_D32D3DFMT_D32

尚未提供Not available

D3DFMT_D15S1D3DFMT_D15S1

尚未提供Not available

D3DFMT_D24S8D3DFMT_D24S8

尚未提供Not available

D3DFMT_D24X8D3DFMT_D24X8

尚未提供Not available

D3DFMT_D24X4S4D3DFMT_D24X4S4

尚未提供Not available

D3DFMT_D16D3DFMT_D16

DXGI_FORMAT_D16_UNORMDXGI_FORMAT_D16_UNORM

D3DFMT_D32F_LOCKABLED3DFMT_D32F_LOCKABLE

DXGI_FORMAT_D32_FLOATDXGI_FORMAT_D32_FLOAT

D3DFMT_D24FS8D3DFMT_D24FS8

尚未提供Not available

D3DFMT_S1D15D3DFMT_S1D15

尚未提供Not available

D3DFMT_S8D24D3DFMT_S8D24

DXGI_FORMAT_D24_UNORM_S8_UINTDXGI_FORMAT_D24_UNORM_S8_UINT

D3DFMT_X8D24D3DFMT_X8D24

尚未提供Not available

D3DFMT_X4S4D24D3DFMT_X4S4D24

尚未提供Not available

D3DFMT_L16D3DFMT_L16

DXGI_FORMAT_R16_UNORMDXGI_FORMAT_R16_UNORM

注意   使用著色器中的 r swizzle,將紅色複製到其他元件,以取得 D3D9 行為。 Note   Use .r swizzle in shader to duplicate red to other components to get D3D9 behavior.
 

D3DFMT_INDEX16D3DFMT_INDEX16

DXGI_FORMAT_R16_UINTDXGI_FORMAT_R16_UINT

D3DFMT_INDEX32D3DFMT_INDEX32

DXGI_FORMAT_R32_UINTDXGI_FORMAT_R32_UINT

D3DFMT_Q16W16V16U16D3DFMT_Q16W16V16U16

DXGI_FORMAT_R16G16B16A16_SNORMDXGI_FORMAT_R16G16B16A16_SNORM

D3DFMT_MULTI2_ARGB8D3DFMT_MULTI2_ARGB8

尚未提供Not available

D3DFMT_R16FD3DFMT_R16F

DXGI_FORMAT_R16_FLOATDXGI_FORMAT_R16_FLOAT

D3DFMT_G16R16FD3DFMT_G16R16F

DXGI_FORMAT_R16G16_FLOATDXGI_FORMAT_R16G16_FLOAT

D3DFMT_A16B16G16R16FD3DFMT_A16B16G16R16F

DXGI_FORMAT_R16G16B16A16_FLOATDXGI_FORMAT_R16G16B16A16_FLOAT

D3DFMT_R32FD3DFMT_R32F

DXGI_FORMAT_R32_FLOATDXGI_FORMAT_R32_FLOAT

D3DFMT_G32R32FD3DFMT_G32R32F

DXGI_FORMAT_R32G32_FLOATDXGI_FORMAT_R32G32_FLOAT

D3DFMT_A32B32G32R32FD3DFMT_A32B32G32R32F

DXGI_FORMAT_R32G32B32A32_FLOATDXGI_FORMAT_R32G32B32A32_FLOAT

D3DFMT_CxV8U8D3DFMT_CxV8U8

尚未提供Not available

D3DDECLTYPE_FLOAT1D3DDECLTYPE_FLOAT1

DXGI_FORMAT_R32_FLOATDXGI_FORMAT_R32_FLOAT

D3DDECLTYPE_FLOAT2D3DDECLTYPE_FLOAT2

DXGI_FORMAT_R32G32_FLOATDXGI_FORMAT_R32G32_FLOAT

D3DDECLTYPE_FLOAT3D3DDECLTYPE_FLOAT3

DXGI_FORMAT_R32G32B32_FLOATDXGI_FORMAT_R32G32B32_FLOAT

D3DDECLTYPE_FLOAT4D3DDECLTYPE_FLOAT4

DXGI_FORMAT_R32G32B32A32_FLOATDXGI_FORMAT_R32G32B32A32_FLOAT

D3DDECLTYPED3DCOLORD3DDECLTYPED3DCOLOR

尚未提供Not available

D3DDECLTYPE_UBYTE4D3DDECLTYPE_UBYTE4

DXGI_FORMAT_R8G8B8A8_UINTDXGI_FORMAT_R8G8B8A8_UINT

注意   著色器會取得 UINT 值,但如果需要 Direct3D 9 樣式的整數浮點數 (0.0 f,1.0 f .。。) ,UINT 只可以轉換成著色器中的 float32。 Note   The shader gets UINT values, but if Direct3D 9 style integral floats are needed (0.0f, 1.0f... 255.f), UINT can just be converted to float32 in the shader.
 

D3DDECLTYPE_SHORT2D3DDECLTYPE_SHORT2

DXGI_FORMAT_R16G16_SINTDXGI_FORMAT_R16G16_SINT

注意   著色器會取得聖值,但如果需要 Direct3D 9 樣式整數浮點數,則可以直接將聖值轉換成著色器中的 float32。 Note   The shader gets SINT values, but if Direct3D 9 style integral floats are needed, SINT can just be converted to float32 in the shader.
 

D3DDECLTYPE_SHORT4D3DDECLTYPE_SHORT4

DXGI_FORMAT_R16G16B16A16_SINTDXGI_FORMAT_R16G16B16A16_SINT

注意   著色器會取得聖值,但如果需要 Direct3D 9 樣式整數浮點數,則可以直接將聖值轉換成著色器中的 float32。 Note   The shader gets SINT values, but if Direct3D 9 style integral floats are needed, SINT can just be converted to float32 in the shader.
 

D3DDECLTYPE_UBYTE4ND3DDECLTYPE_UBYTE4N

DXGI_FORMAT_R8G8B8A8_UNORMDXGI_FORMAT_R8G8B8A8_UNORM

D3DDECLTYPE_SHORT2ND3DDECLTYPE_SHORT2N

DXGI_FORMAT_R16G16_SNORMDXGI_FORMAT_R16G16_SNORM

D3DDECLTYPE_SHORT4ND3DDECLTYPE_SHORT4N

DXGI_FORMAT_R16G16B16A16_SNORMDXGI_FORMAT_R16G16B16A16_SNORM

D3DDECLTYPE_USHORT2ND3DDECLTYPE_USHORT2N

DXGI_FORMAT_R16G16_UNORMDXGI_FORMAT_R16G16_UNORM

D3DDECLTYPE_USHORT4ND3DDECLTYPE_USHORT4N

DXGI_FORMAT_R16G16B16A16_UNORMDXGI_FORMAT_R16G16B16A16_UNORM

D3DDECLTYPE_UDEC3D3DDECLTYPE_UDEC3

尚未提供Not available

D3DDECLTYPE_DEC3ND3DDECLTYPE_DEC3N

尚未提供Not available

D3DDECLTYPE_FLOAT16_2D3DDECLTYPE_FLOAT16_2

DXGI_FORMAT_R16G16_FLOATDXGI_FORMAT_R16G16_FLOAT

D3DDECLTYPE_FLOAT16_4D3DDECLTYPE_FLOAT16_4

DXGI_FORMAT_R16G16B16A16_FLOATDXGI_FORMAT_R16G16B16A16_FLOAT

FourCC 'ATI1'FourCC 'ATI1'

DXGI_FORMAT_BC4_UNORMDXGI_FORMAT_BC4_UNORM

注意   需要功能等級10.0 或更新版本 Note   Requires Feature Level 10.0 or later
 

FourCC 'ATI2'FourCC 'ATI2'

DXGI_FORMAT_BC5_UNORMDXGI_FORMAT_BC5_UNORM

注意   需要功能等級10.0 或更新版本 Note   Requires Feature Level 10.0 or later
 

其他對應資訊Additional mapping info

透過 IDirect3DDevice9:: SetGammaRamp ,以 IDXGIOutput:: SetGammaControl來控制視訊卡的硬體 gamma 滑軌。Control of the video card's hardware gamma ramp through IDirect3DDevice9::SetGammaRamp is replaced by IDXGIOutput::SetGammaControl. 請參閱 使用 gamma 修正See Using gamma correction.

IDirect3DDevice9::P rocessvertices 由幾何著色器的資料流程輸出功能所取代。IDirect3DDevice9::ProcessVertices is replaced by the Stream-Output functionality of Geometry Shaders. 請參閱 資料流程輸出階段使用者入門。See Getting started with the Stream-Output Stage.

設定使用者剪輯平面的方法 IDirect3DDevice9:: SetClipPlane 已由 HLSL SV_ClipDistance 頂點著色器輸出語義所取代 (請參閱 VS_4_0 和更新版本中可用的 語義) ,或新的 HLSL clipplanes 函數屬性 (查看 功能等級9硬體) 上的使用者剪輯平面The method IDirect3DDevice9::SetClipPlane to set user clip-planes was replaced by either the HLSL SV_ClipDistance vertex shader output semantic (see Semantics), available in VS_4_0 and up, or the new HLSL clipplanes function attribute (see User clip planes on feature level 9 hardware).

IDirect3DDevice9:: SetPaletteEntriesIDirect3DDevice9:: SetCurrentTexturePalette 已被取代。IDirect3DDevice9::SetPaletteEntries and IDirect3DDevice9::SetCurrentTexturePalette are deprecated. 將這些取代為以 256x1 R8G8B8A8 材質來查閱色彩的圖元著色器。Replace these with a pixel shader that looks up colors in a 256x1 R8G8B8A8 texture instead.

固定函式鑲嵌函式(例如 DrawRectPatchDrawTriPatchSetNPatchModeDeletePatch )已被取代。Fixed-function tessellation functions like DrawRectPatch, DrawTriPatch, SetNPatchMode, and DeletePatch are deprecated. 如果硬體支援鑲嵌式著色器) ,請使用可程式化的 SM 5.0 鑲嵌著色器 (取代這些。Replace these with programmable-pipeline SM5.0 Tessellation shaders (if hardware supports tessellation shaders).

不再支援IDirect3DDevice9:: SetFVF和 FVF 碼。IDirect3DDevice9::SetFVF, and FVF codes, are no longer supported. 您應該先從 D3D8/D3D9 FVF 碼移植到 D3D9 頂點宣告,再移植到 D3D11 輸入版面配置。You should port from D3D8/D3D9 FVF codes to D3D9 Vertex Declarations before porting to D3D11 Input Layouts.

所有不直接支援的 D3DDECLTYPE 類型都可以在 VS_4_0 和更新的端點著色器開始時,以非常有效率的方式模擬。All of the D3DDECLTYPE types that are not directly supported can be emulated fairly efficiently with a small number of bitwise operations at the beginning of a vertex shader in VS_4_0 and up.