Skip to main content

Opcode

Enum Opcode 

Source
#[repr(u8)]
pub enum Opcode {
Show 62 variants NOP = 0, MOV = 1, MUL = 2, ADD = 3, MAD = 4, DP3 = 5, DP4 = 6, DST = 7, MIN = 8, MAX = 9, SLT = 10, SGE = 11, SLE = 12, SGT = 13, SNE = 14, SEQ = 15, FRC = 16, FLR = 17, KIL = 18, PK4 = 19, UP4 = 20, DDX = 21, DDY = 22, TEX = 23, TXP = 24, TXD = 25, RCP = 26, RSQ = 27, EX2 = 28, LG2 = 29, LIT = 30, LRP = 31, STR = 32, SFL = 33, COS = 34, SIN = 35, PK2 = 36, UP2 = 37, POW = 38, PKB = 39, UPB = 40, PK16 = 41, UP16 = 42, PKG = 44, UPG = 45, DP2A = 46, TXL = 47, TXB = 49, REFL = 54, DP2 = 56, NRM = 57, DIV = 58, DIVSQ = 59, LIF = 60, FENCT = 61, FENCB = 62, BRK = 64, CAL = 65, IFE = 66, LOOP = 67, REP = 68, RET = 69,
}
Expand description

A fragment instruction’s opcode.

Variants§

§

NOP = 0

NOP, opcode 0x00, with 0 sources.

§

MOV = 1

MOV, opcode 0x01, with 1 sources.

§

MUL = 2

MUL, opcode 0x02, with 2 sources.

§

ADD = 3

ADD, opcode 0x03, with 2 sources.

§

MAD = 4

MAD, opcode 0x04, with 3 sources.

§

DP3 = 5

DP3, opcode 0x05, with 2 sources.

§

DP4 = 6

DP4, opcode 0x06, with 2 sources.

§

DST = 7

DST, opcode 0x07, with 2 sources.

§

MIN = 8

MIN, opcode 0x08, with 2 sources.

§

MAX = 9

MAX, opcode 0x09, with 2 sources.

§

SLT = 10

SLT, opcode 0x0a, with 2 sources.

§

SGE = 11

SGE, opcode 0x0b, with 2 sources.

§

SLE = 12

SLE, opcode 0x0c, with 2 sources.

§

SGT = 13

SGT, opcode 0x0d, with 2 sources.

§

SNE = 14

SNE, opcode 0x0e, with 2 sources.

§

SEQ = 15

SEQ, opcode 0x0f, with 2 sources.

§

FRC = 16

FRC, opcode 0x10, with 1 sources.

§

FLR = 17

FLR, opcode 0x11, with 1 sources.

§

KIL = 18

KIL, opcode 0x12, with 0 sources.

§

PK4 = 19

PK4, opcode 0x13, with 1 sources.

§

UP4 = 20

UP4, opcode 0x14, with 1 sources.

§

DDX = 21

DDX, opcode 0x15, with 1 sources.

§

DDY = 22

DDY, opcode 0x16, with 1 sources.

§

TEX = 23

TEX, opcode 0x17, with 1 sources.

§

TXP = 24

TXP, opcode 0x18, with 1 sources.

§

TXD = 25

TXD, opcode 0x19, with 3 sources.

§

RCP = 26

RCP, opcode 0x1a, with 1 sources.

§

RSQ = 27

RSQ, opcode 0x1b, with 1 sources.

§

EX2 = 28

EX2, opcode 0x1c, with 1 sources.

§

LG2 = 29

LG2, opcode 0x1d, with 1 sources.

§

LIT = 30

LIT, opcode 0x1e, with 1 sources.

§

LRP = 31

LRP, opcode 0x1f, with 3 sources.

§

STR = 32

STR, opcode 0x20, with 0 sources.

§

SFL = 33

SFL, opcode 0x21, with 0 sources.

§

COS = 34

COS, opcode 0x22, with 1 sources.

§

SIN = 35

SIN, opcode 0x23, with 1 sources.

§

PK2 = 36

PK2, opcode 0x24, with 1 sources.

§

UP2 = 37

UP2, opcode 0x25, with 1 sources.

§

POW = 38

POW, opcode 0x26, with 2 sources.

§

PKB = 39

PKB, opcode 0x27, with 1 sources.

§

UPB = 40

UPB, opcode 0x28, with 1 sources.

§

PK16 = 41

PK16, opcode 0x29, with 1 sources.

§

UP16 = 42

UP16, opcode 0x2a, with 1 sources.

§

PKG = 44

PKG, opcode 0x2c, with 1 sources.

§

UPG = 45

UPG, opcode 0x2d, with 1 sources.

§

DP2A = 46

DP2A, opcode 0x2e, with 3 sources.

§

TXL = 47

TXL, opcode 0x2f, with 2 sources.

§

TXB = 49

TXB, opcode 0x31, with 2 sources.

§

REFL = 54

REFL, opcode 0x36, with 2 sources.

§

DP2 = 56

DP2, opcode 0x38, with 2 sources.

§

NRM = 57

NRM, opcode 0x39, with 1 sources.

§

DIV = 58

DIV, opcode 0x3a, with 2 sources.

§

DIVSQ = 59

DIVSQ, opcode 0x3b, with 2 sources.

§

LIF = 60

LIF, opcode 0x3c, with 1 sources.

§

FENCT = 61

FENCT, opcode 0x3d, with 0 sources.

§

FENCB = 62

FENCB, opcode 0x3e, with 0 sources.

§

BRK = 64

BRK, opcode 0x40, with 0 sources.

§

CAL = 65

CAL, opcode 0x41, with 0 sources.

§

IFE = 66

IFE, opcode 0x42, with 0 sources.

§

LOOP = 67

LOOP, opcode 0x43, with 0 sources.

§

REP = 68

REP, opcode 0x44, with 0 sources.

§

RET = 69

RET, opcode 0x45, with 0 sources.

Implementations§

Source§

impl Opcode

Source

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

The opcode’s name in upper case (MOV, TEX, …).

Source

pub fn source_count(self) -> usize

How many sources the instruction reads.

Source§

impl Opcode

Source

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

The opcode with this number (the 7-bit value of the instruction’s opcode field), if the reader has an entry for it.

Source

pub fn mesa_name(self) -> Option<&'static str>

The name Mesa’s nouveau driver gives the opcode number, where its nvfx_shader.h defines one; None for the numbers it does not (PKG, UPG, DP2, NRM, DIVSQ and the two fences). Opcode::mnemonic is the name RPCS3’s declarations use. The two agree except for PK4/PK4B, UP4/UP4B, PK2/PK2H, UP2/UP2H, PKB/PK4UB, UPB/UP4UB, PK16/PK2US, UP16/UP2US, REFL/RFL, LIF/LITEX2 and IFE/IF.

Source

pub fn samples_texture(self) -> bool

Whether the instruction samples a texture.

Source

pub fn writes_destination(self) -> bool

Whether the instruction writes a destination register or condition code.

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 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 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.