naga-pixelbender: Stub out Opcode::Loop

Some experimentation with Pixel Bender Studio shows
that Opcode::Loop has a 23-byte payload. I haven't tried to
figure out how to interpet the payload yet, but we can now
skip over the opcode instead of bailing out entirely.
This commit is contained in:
Aaron Hill 2023-08-27 14:03:21 -04:00
parent 7bef26d993
commit ccf42c3614
4 changed files with 16 additions and 1 deletions

1
Cargo.lock generated
View File

@ -2901,6 +2901,7 @@ dependencies = [
"naga",
"naga_oil",
"ruffle_render",
"tracing",
]
[[package]]

View File

@ -11,6 +11,7 @@ version.workspace = true
ruffle_render = { path = "../" }
naga = { workspace = true }
naga_oil = { workspace = true }
tracing = { workspace = true }
anyhow = "1.0.75"
bitflags = "2.4.0"

View File

@ -1484,7 +1484,10 @@ impl<'a> ShaderBuilder<'a> {
}
}
}
_ => unimplemented!("Operation {op:?} not yet implemented"),
Operation::Loop { unknown } => {
tracing::warn!("Unimplemented Loop opcode with data: {unknown:?}")
}
Operation::Nop => {}
}
}
Ok(())

View File

@ -244,6 +244,9 @@ pub enum Operation {
},
Else,
EndIf,
Loop {
unknown: Box<[u8]>,
},
}
#[derive(Debug, Clone)]
@ -564,6 +567,13 @@ fn read_op<R: Read>(
_ => unreachable!(),
}
}
Opcode::Loop => {
let mut unknown = vec![0u8; 23];
data.read_exact(&mut unknown)?;
shader.operations.push(Operation::Loop {
unknown: unknown.into(),
});
}
_ => {
let dst = data.read_u16::<LittleEndian>()?;
let mut mask = data.read_u8()?;