texm3x2depth - ps

計算要用於此圖元深度測試的深度值。

Syntax

texm3x2depth dst, src

 

where

  • dst 是目的地暫存器。
  • src 是來源暫存器。

備註

圖元著色器版本 1_1 1_2 1_3 1_4 2_0 2_x 2_sw 3_0 3_sw
texm3x2depth x

 

此指令必須搭配 texm3x2pad - ps 指令使用。

使用這兩個指示時,紋理暫存器必須使用下列序列。

 
tex t(n)                     // Define tn as a standard 3-vector.(tn must be 
                             // defined in some way before it is used
texm3x2pad   t(m),   t(n)    // Where m > n
                             // Calculate z value
texm3x2depth t(m+1), t(n)    // Calculate w value; use both z and w to
                             // find depth

使用點產品作業尋找 z 和 w 之後,就會完成深度計算。 以下是如何完成深度計算的詳細資料。

texm3x2pad 指令會計算 z。

z = TextureCoordinates (stage m) UVW * t (n) RGB

texm3x2depth 指令計算 w.

w = TextureCoordinates (stage m+1) UVW * t (n) RGB

計算深度並將結果儲存在 t (m+1) 。

 
if (w == 0)
  t(m+1) = 1.0
else
  t(m+1) = z/w

計算深度會標記為用於圖元的深度測試,取代圖元的現有深度測試值。

請務必將 z/w 固定在 (0-1) 的範圍內。 如果 z/w 超出此範圍,則儲存在深度緩衝區中的結果將會未定義。

執行 texm3x2depth 之後,註冊 t (m+1) 已不再可用於著色器。

多重取樣時,使用此指令可消除較高解析度深度緩衝區的大部分優點。 因為圖元著色器會針對每個圖元執行一次,所以 texm3x2depth 或 texdepth - ps 的單一深度值會用於每個子圖元深度比較測試。

圖元著色器指示