mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
nak: Implement load_sysval_nv as S2R
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
parent
fb96aaf3fa
commit
62f5e65c80
3 changed files with 17 additions and 0 deletions
|
|
@ -187,6 +187,11 @@ fn encode_alu(bs: &mut impl BitSetMut, instr: &Instr, opcode: u16) {
|
|||
bs.set_field(9..12, form);
|
||||
}
|
||||
|
||||
fn encode_s2r(bs: &mut impl BitSetMut, instr: &Instr, idx: u8) {
|
||||
encode_instr_base(bs, &instr, 0x919);
|
||||
bs.set_field(72..80, idx);
|
||||
}
|
||||
|
||||
fn encode_mov(bs: &mut impl BitSetMut, instr: &Instr) {
|
||||
encode_alu(bs, instr, 0x002);
|
||||
bs.set_field(72..76, 0xf_u32 /* TODO: Quad lanes */);
|
||||
|
|
@ -233,6 +238,7 @@ pub fn encode_instr(instr: &Instr) -> [u32; 4] {
|
|||
let mut enc = [0_u32; 4];
|
||||
let mut bs = BitSetMutView::new(&mut enc);
|
||||
match &instr.op {
|
||||
Opcode::S2R(i) => encode_s2r(&mut bs, instr, *i),
|
||||
Opcode::MOV => encode_mov(&mut bs, instr),
|
||||
Opcode::ALD(a) => encode_ald(&mut bs, instr, &a),
|
||||
Opcode::AST(a) => encode_ast(&mut bs, instr, &a),
|
||||
|
|
|
|||
|
|
@ -122,6 +122,11 @@ impl<'a> ShaderFromNir<'a> {
|
|||
let dst = self.get_dst(&intrin.def);
|
||||
self.instrs.push(Instr::new_ald(dst, addr, vtx, offset));
|
||||
}
|
||||
nir_intrinsic_load_sysval_nv => {
|
||||
let idx = u8::try_from(intrin.base()).unwrap();
|
||||
let dst = self.get_dst(&intrin.def);
|
||||
self.instrs.push(Instr::new_s2r(dst, idx));
|
||||
}
|
||||
nir_intrinsic_store_output => {
|
||||
if self.nir.info.stage() == MESA_SHADER_FRAGMENT {
|
||||
/* We assume these only ever happen in the last block.
|
||||
|
|
|
|||
|
|
@ -514,6 +514,10 @@ impl Instr {
|
|||
Instr::new(Opcode::FADD, slice::from_ref(&dst), &[x, y])
|
||||
}
|
||||
|
||||
pub fn new_s2r(dst: Dst, idx: u8) -> Instr {
|
||||
Instr::new(Opcode::S2R(idx), slice::from_ref(&dst), &[])
|
||||
}
|
||||
|
||||
pub fn new_mov(dst: Dst, src: Src) -> Instr {
|
||||
Instr::new(Opcode::MOV, slice::from_ref(&dst), &[Src::Zero, src])
|
||||
}
|
||||
|
|
@ -647,6 +651,7 @@ pub enum Opcode {
|
|||
FMNMX,
|
||||
FMUL,
|
||||
|
||||
S2R(u8),
|
||||
MOV,
|
||||
VEC,
|
||||
SPLIT,
|
||||
|
|
@ -668,6 +673,7 @@ impl fmt::Display for Opcode {
|
|||
Opcode::FFMA => write!(f, "FFMA"),
|
||||
Opcode::FMNMX => write!(f, "FMNMX"),
|
||||
Opcode::FMUL => write!(f, "FMUL"),
|
||||
Opcode::S2R(i) => write!(f, "S2R({})", i),
|
||||
Opcode::MOV => write!(f, "MOV"),
|
||||
Opcode::VEC => write!(f, "VEC"),
|
||||
Opcode::SPLIT => write!(f, "SPLIT"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue