Skip to main content

Opcode

Enum Opcode 

Source
pub enum Opcode {
Show 82 variants Nop, Mov, Add, Sub, Mad, Mul, Rcp, Rsq, Dp3, Dp4, Min, Max, Slt, Sge, Exp, Log, Lit, Dst, Lrp, Frc, M4x4, M4x3, M3x4, M3x3, M3x2, Call, CallNz, Loop, Ret, EndLoop, Label, Dcl, Pow, Crs, Sgn, Abs, Nrm, SinCos, Rep, EndRep, If, IfC, Else, EndIf, Break, BreakC, Mova, DefB, DefI, TexCoord, TexKill, Tex, TexBem, TexBemL, TexReg2Ar, TexReg2Gb, TexM3x2Pad, TexM3x2Tex, TexM3x3Pad, TexM3x3Tex, TexM3x3Spec, TexM3x3VSpec, ExpP, LogP, Cnd, Def, TexReg2Rgb, TexDp3Tex, TexM3x2Depth, TexDp3, TexM3x3, TexDepth, Cmp, Bem, Dp2Add, Dsx, Dsy, TexLdd, SetP, TexLdl, BreakP, Phase,
}
Expand description

An instruction opcode: the low 16 bits of an instruction token. The variants carry the token value (Opcode::code) and the assembler’s name (Opcode::name); declarations (dcl), definitions (def, defi, defb), comments and end are opcodes of the stream as well but are read into their own records.

Variants§

§

Nop

nop (0).

§

Mov

mov (1).

§

Add

add (2).

§

Sub

sub (3).

§

Mad

mad (4).

§

Mul

mul (5).

§

Rcp

rcp (6).

§

Rsq

rsq (7).

§

Dp3

dp3 (8).

§

Dp4

dp4 (9).

§

Min

min (10).

§

Max

max (11).

§

Slt

slt (12).

§

Sge

sge (13).

§

Exp

exp (14).

§

Log

log (15).

§

Lit

lit (16).

§

Dst

dst (17).

§

Lrp

lrp (18).

§

Frc

frc (19).

§

M4x4

m4x4 (20).

§

M4x3

m4x3 (21).

§

M3x4

m3x4 (22).

§

M3x3

m3x3 (23).

§

M3x2

m3x2 (24).

§

Call

call (25): its source is the label lN.

§

CallNz

callnz (26): a label, then the boolean constant bN or the predicate p0 it tests.

§

Loop

loop (27): the loop counter aL, then the integer constant iN of its start, count and step.

§

Ret

ret (28).

§

EndLoop

endloop (29).

§

Label

label (30): its source is the label lN.

§

Dcl

dcl (31), read into a crate::Declaration.

§

Pow

pow (32).

§

Crs

crs (33).

§

Sgn

sgn (34): three sources in Shader Model 2, one in 3.

§

Abs

abs (35).

§

Nrm

nrm (36).

§

SinCos

sincos (37): three sources in Shader Model 2 (the angle and the two D3DSINCOSCONST registers), one in 3.

§

Rep

rep (38): its source is the integer constant iN whose x lane is the count.

§

EndRep

endrep (39).

§

If

if (40): its source is the boolean constant bN or the predicate p0.

§

IfC

if_comp (41): two sources compared as crate::Instruction::comparison says.

§

Else

else (42).

§

EndIf

endif (43).

§

Break

break (44).

§

BreakC

break_comp (45): two sources compared as crate::Instruction::comparison says.

§

Mova

mova (46).

§

DefB

defb (47), read into a crate::Definition.

§

DefI

defi (48), read into a crate::Definition.

§

TexCoord

texcoord (64) before pixel 1.4, texcrd in 1.4.

§

TexKill

texkill (65): its destination token names the register tested.

§

Tex

tex (66) before pixel 1.4, texld from 1.4 on (texldp and texldb by crate::Instruction::control).

§

TexBem

texbem (67).

§

TexBemL

texbeml (68).

§

TexReg2Ar

texreg2ar (69).

§

TexReg2Gb

texreg2gb (70).

§

TexM3x2Pad

texm3x2pad (71).

§

TexM3x2Tex

texm3x2tex (72).

§

TexM3x3Pad

texm3x3pad (73).

§

TexM3x3Tex

texm3x3tex (74).

§

TexM3x3Spec

texm3x3spec (76).

§

TexM3x3VSpec

texm3x3vspec (77).

§

ExpP

expp (78).

§

LogP

logp (79).

§

Cnd

cnd (80).

§

Def

def (81), read into a crate::Definition.

§

TexReg2Rgb

texreg2rgb (82).

§

TexDp3Tex

texdp3tex (83).

§

TexM3x2Depth

texm3x2depth (84).

§

TexDp3

texdp3 (85).

§

TexM3x3

texm3x3 (86).

§

TexDepth

texdepth (87).

§

Cmp

cmp (88).

§

Bem

bem (89).

§

Dp2Add

dp2add (90).

§

Dsx

dsx (91).

§

Dsy

dsy (92).

§

TexLdd

texldd (93).

§

SetP

setp_comp (94): its destination is the predicate p0, its two sources compared as crate::Instruction::comparison says.

§

TexLdl

texldl (95).

§

BreakP

breakp (96): its source is the predicate p0.

§

Phase

phase (0xfffd): the boundary between the two phases of a pixel 1.4 program.

Implementations§

Source§

impl Opcode

Source

pub fn code(self) -> u16

The opcode’s token value (bits 0 to 15 of the instruction token).

Source

pub fn name(self) -> &'static str

The assembler’s name of the opcode, as d3d9types.h names it in lower case (if_comp for IFC, setp_comp for SETP; tex and texcoord whatever the version, which the assembler spells texld and texcrd from pixel 1.4 on).

Source

pub fn from_code(code: u16) -> Option<Self>

The opcode of a token value, None for a value Direct3D 9 does not define (75, the reserved texm3x3diff, among them).

Source

pub fn in_version(self, version: Version) -> bool

True when the opcode is an instruction of version.

Trait Implementations§

Source§

impl Clone for Opcode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Opcode

Source§

impl Debug for Opcode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Opcode

Source§

impl Hash for Opcode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Opcode

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Opcode

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Opcode

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Opcode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.