?? 可編程流水線 (programmable pipeline).htm
字號:
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l2 level1 lfo1"><U><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">可編程數據流模型</SPAN></U><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l2 level1 lfo1"><U><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">頂點著色器</SPAN></U><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l2 level1 lfo1"><U><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">像素著色器</SPAN></U><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN>
</LI></UL>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">使用基于程序化的模塊來指定硬件的行為有許多好處。<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">首先,程序化的模型使得用更為通用的語句來指定常用的操作成為可能。與可編程<SPAN
lang=EN-US>API不同,固定功能API必須隨著所支持操作的增長,定義新的模式,標志,等等。此外,隨著硬件能力的加強——更多的顏色,更多的紋理,更多的頂點數據流,等等——由輸入數據導致操作符空間的增長也變得復雜。另一方面,可編程模型能夠以更為直接的方式進行甚至簡單的操作,例如把適當的顏色和紋理放到光照模塊中合適的地方。開發人員無需搜索所有可能的模式,只要學習計算機體系結構并指定想要執行的算法即可。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">例如,可編程流水線可以支持以下眾所周知的特性。<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<UL type=disc>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l4 level1 lfo2"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">基本幾何變換<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l4 level1 lfo2"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">簡單光照模型<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l4 level1 lfo2"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">表面蒙皮所需的頂點混合<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l4 level1 lfo2"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">頂點內插值(<SPAN
lang=EN-US>tweening)<o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l4 level1 lfo2"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">紋理變換<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l4 level1 lfo2"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">紋理生成<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l4 level1 lfo2"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">環境貼圖<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN> </LI></UL>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">其次,程序化的模型為開發新的操作提供了一個簡單的機制。當前<SPAN
lang=EN-US>API不支持許多開發人員需要的操作。大多數情況下,這并不是由于硬件能力的限制造成的,相反是由于API的限制造成的。一般情況下,比起試圖超越設計者的意圖,強制擴充固定功能API以實現相同功能來說,用程序化的模型執行這些操作會更簡單,速度也更快。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">開發人員普遍希望實現的新特性包括以下這些:<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<UL type=disc>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l6 level1 lfo3"><I><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">Matrix
Palette Skinning</SPAN></I><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">。用于每個<SPAN
lang=EN-US>mesh含8至10個骨架的角色動畫。<o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l6 level1 lfo3"><I><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">Anisotropic
Lighting(各向異性光照)</SPAN></I><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">。這種光照當前只能把紋理用作查找表實現。<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l6 level1 lfo3"><I><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">Membrane
Shaders</SPAN></I><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">。用于汽球、皮膚、等等<SPAN
lang=EN-US>(1/cos(eye DOT normal))的著色器。<o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l6 level1 lfo3"><I><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">Kubelka-Munk
Shaders。</SPAN></I><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN; mso-bidi-font-style: italic">對穿過表面的折射光線做了考慮的著色器。</SPAN><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN"><o:p></o:p></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l6 level1 lfo3"><I><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">Procedural
Geometry</SPAN></I><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">。把<SPAN
lang=EN-US>mesh與程序生成的幾何體(球體)合成,以模擬皮膚下肌肉的運動。<o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l6 level1 lfo3"><I><SPAN
lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">Displacement
Mapping(位移貼圖)</SPAN></I><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">。用波形樣式或可以拼接<SPAN
lang=EN-US>/重復的山脊對mesh進行修改。<o:p></o:p></SPAN></SPAN> </LI></UL>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">第三,程序化的模型提供了可擴充性和可發展性。硬件能力正在高速地發展,程序化的表示可以適應<SPAN
lang=EN-US>API,因為它們很容易擴充。通過以下手段,可以很容易地不斷地添加新的特性和能力。<o:p></o:p></SPAN></SPAN></P>
<UL type=disc>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l1 level1 lfo4"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">增加新的指令<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l1 level1 lfo4"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">增加新的數據輸入<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN>
<LI class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; tab-stops: list 36.0pt; mso-list: l1 level1 lfo4"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">給流水線的固定功能部分或可編程部分增加新的能力<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN> </LI></UL>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">在對復雜事物的描述方法中,代碼具有最好的擴充性。此外,對于添加到可編程著色器中的新特性,<SPAN
lang=EN-US>Direct3D內部所需改動的代碼量也非常小。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">第四,程序化的模型更容易被掌握。比起硬件,軟件開發人員更理解編程。一個真正能夠滿足軟件開發人員需要的<SPAN
lang=EN-US>API應該把硬件能力映射到代碼的形式。<o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">第五,程序化的模型跟隨了具有照片真實感的渲染領域所經歷的足跡。在具有照片真實感的高端渲染領域,使用可編程著色器的傳統已經有許多年了。一般來說,這個領域不受性能的影響,因此對渲染技術而言,可編程著色器代表了無妥協的最終目標。<SPAN
lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><SPAN
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">最后,程序化模型允許直接映射到硬件。當前大多數三維硬件,至少在頂點處理階段,實際應該是可編程的。<SPAN
lang=EN-US>API提供的可編程性使用應用程序的指令可以直接映射到這部分硬件。這使用開發人員可以根據需要管理硬件資源。要用有限數量的寄存器和可以運行的指令,去實現一個能啟用所有特性并且特性之間不相互影響的固定功能流水線是很難的。如果開發人員打開了太多特性,而這些特性需要共享同一資源,那么這些特性可能都會以意想不到的方式停止運作。通過讓應用程序開發人員與硬件直接對話,從而使此類限制對API變得透明,可編程API消除了這個問題,這也遵循了DirectX的傳統。<o:p></o:p></SPAN></SPAN></P>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><SPAN lang=EN-US
style="FONT-FAMILY: 宋體; mso-bidi-font-family: 宋體; mso-fareast-language: ZH-CN">
<HR align=center width="100%" SIZE=1>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -