texbeml - ps

使用亮度修正套用假的凸凸環境對應轉換。 這可藉由修改目的地暫存器紋理位址資料、使用位址調整資料 (du、dv) 、2D 凸凸環境矩陣和亮度來完成。

Syntax

texbeml dst, src

 

where

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

備註

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

 

src 暫存器中的紅色和綠色色彩資料會解譯為 du,dv) 的反轉資料 (。 src 暫存器中的藍色色彩資料會解譯為亮度資料。

此指令會使用 2D 凸凸環境對應矩陣,轉換來源暫存器中的紅色和綠色元件。 結果會新增至對應至目的地暫存器編號的紋理座標集。 使用亮度值和偏差紋理階段值來套用亮度校正。 結果用來取樣目前的紋理階段。

這可用於以位址變化為基礎的各種技術,例如假的個別圖元環境對應。

這項作業一律會將 du 和 dv 解譯為已簽署的數量。 對於 1_0 和 1_1 版,輸入引數不允許 來源暫存器帶正 負號調整輸入修飾詞 (_bx2) 。

當輸入紋理包含混合格式資料時,此指令會產生已定義的結果。 如需介面格式的詳細資訊,請參閱 D3DFORMAT

// When using this instruction, texture registers must follow 
//   the following sequence:
// The texture assigned to stage tn contains the (du,dv) data
// The texture assigned to stage t(m) is sampled
tex     t(n)                    
texbeml t(m),  t(n)      where m > n

此範例顯示指令內完成的計算。

// 1. New values for texture addresses (u',v') are calculated
// 2. Sample the texture using (u',v')
// 3. Luminance correction is applied

u' = TextureCoordinates (stage m) u +

D3DTSS_BUMPENVMAT00 (階段 m) *t (n) R +

D3DTSS_BUMPENVMAT10 (階段 m) *t (n) G

v' = textureCoordinates (stage m) v +

D3DTSS_BUMPENVMAT01 (階段 m) *t (n) R +

D3DTSS_BUMPENVMAT11 (階段 m) *t (n) G

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

t (m) RGBA = t (m) RGBA *

[ (t (n) B * D3DTSS_BUMPENVLSCALE (階段 m) ) +

D3DTSS_BUMPENVLOFFSET (階段 m) ]

註冊已由 texbem 或 texbeml 指令讀取的資料,稍後無法讀取,但另一個 texbem 或 texbeml 除外。

// This example demonstrates the validation error caused by 
//   t0 being reread
ps_1_1
tex t0
texbem t1, t0
add r0, t1, t0

(Instruction Error) (Statement 4) Register data that has been read by 
texbem or texbeml instruction cannot be read by other instructions

範例

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

ps_1_1
tex t0              ; Define t0 to get a 2-tuple DuDv
texbeml t1, t0      ; Compute (u',v')
                    ; Apply luminance correction                    
                    ; Sample t1 using (u',v')
mov r0, t1          ; Output result

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

  • 階段 0 會指派具有 (du、dv) 翻轉資料的凸凸地圖。
  • 階段 1 會指派具有色彩資料的紋理貼圖。
  • texbeml 會在取樣的紋理階段上設定矩陣資料。 這與固定函式管線的功能不同,其中探查資料和矩陣佔用相同的紋理階段。

圖元著色器指示