tex
Direct3D 8 - Pixel Shader - Instructions - tex
Last edited 2026-02-20
The tex instruction fetches a texture sample and stores it in the destination register. Used in versions ps.1.0, ps.1.1, ps.1.2 and ps.1.3. (Replaced by texld in ps.1.4.)
The tex syntax looks like this:
tex t#;
t#: This is the target register (e.g., t0, t1, t2) into which the texture vertex data (red, green, blue, alpha) will be written.
Example code:
texture T_Image; // <- Main texture
technique tech_main
{
pass P0
{
Texture[0] = <T_Image>;
PixelShader = asm
{
ps.1.1; // <- Pixel shader version
tex t0; // <- Load the T_Image texture
mov r0, t0; // <- Assign the result from the Texture register (t0) to the result register (r0)
};
}
}
This example requires the following in the .XML file:
- Flag <dx8>yes</dx8>
(More information about .XML files can be found here)
Details table:
|
Type |
Instruction |
Description |
Instruction slots |
ps.1.0 |
ps.1.1 |
ps.1.2 |
ps.1.3 |
ps.1.4 |
Note |
|
asm |
Sample a texture |
1 |
Yes |
Yes |
Yes |
Yes |
No |
Assigns texture to texture register. |
Created with the Personal Edition of HelpNDoc: Streamline your documentation process with HelpNDoc's WinHelp HLP to CHM conversion feature