Direct3D 8 - Pixel Shader - Instructions - mov

Last edited 2026-02-20


The mov instruction allows you to assign values (move, copy)


The mov syntax looks like this:

mov x, y;


(This instruction returns a value from the given mathematical function: x = y)


x: Value to which the value will be assigned

y: Value to which the value to be assigned will be retrieved


Example code:


texture T_Image;                            // <- Main texture


technique tech_main

{

    pass P0

    {

        Texture[0] = <T_Image>;

        PixelShader = asm

        {

            ps.1.1;                         // <- Pixel shader version


            def c0, 1.0f, 0.0f, 0.0f, 0.0f  // <- Declaration of a constant, we treat it as a color (r, g, b, a)


            tex t0;                         // <- Load the T_Image texture

            

            mov r0, c0;                     // <- The color from the constant will be assigned from result

            mov r0.a, t0.a;

        };

    }

}


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

mov

Move

1

Yes

Yes

Yes

Yes

Yes

Assigns the given value to the target.

Created with the Personal Edition of HelpNDoc: Create iPhone web-based documentation