texm3x2tex - ps

執行 3x2 矩陣乘法的最終資料列,並使用結果來執行紋理查閱。 texm3x2tex 必須與 texm3x2pad - ps 指令搭配使用。

Syntax

texm3x2tex dst, src

 

where

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

備註

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

 

指令會當做兩個指示之一使用,代表 3x2 矩陣乘法運算。 此指令必須搭配 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
                              // Perform first row of matrix multiply
texm3x2tex  t(m+1), t(n)      // Perform second row of matrix multiply 
                              // to get (u,v) to sample texture 
                              // associated with stage m+1

以下是如何完成 3x2 乘法的詳細資料。

texm3x2pad 指令會執行乘法的第一個資料列來尋找 u'

u' = t (n) RGB * TextureCoordinates (stage m) UVW

texm3x2tex 指令會執行乘以尋找 v'的第二個數據列。

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

texm3x2tex 指令會使用 (u',v') 在階段 (m+1) 取樣紋理,並將結果儲存在 t (m+1) 中。

t (m+1) RGB = TextureSample (stage m+1) RGB using (u', v' ) 作為座標

範例

以下是紋理貼圖和識別紋理階段的範例著色器。

ps_1_1
tex t0                // Bind texture in stage 0 to register t0
texm3x2pad  t1,  t0   // First row of matrix multiply
texm3x2tex  t2,  t0   // Second row of matrix multiply to get (u,v)
                      // with which to sample texture in stage 2
mov r0, t2            // Output result

此範例需要下列紋理階段中的下列紋理。

  • 階段 0 採用具有 (x,y,z) 翻轉資料的地圖。
  • 階段 1 保存紋理座標。 紋理階段中不需要紋理。
  • 階段 2 同時保留紋理座標,以及在該紋理階段設定的 2D 紋理。

圖元著色器指示