|
|
@@ -5602,7 +5602,7 @@ impl<'a> Lower<'a> {
|
|
|
return Ok(());
|
|
|
}
|
|
|
let (op, sample) = match name {
|
|
|
- "image_sample" => (60, true),
|
|
|
+ "image_sample" | "image_sample_o" => (60, true),
|
|
|
"image_sample_lz" | "image_sample_l" => (62, true),
|
|
|
"image_sample_b" => (61, true),
|
|
|
"image_sample_c_lz" => (65, true),
|
|
|
@@ -5747,6 +5747,25 @@ impl<'a> Lower<'a> {
|
|
|
args.extend(&cs);
|
|
|
match op {
|
|
|
60 => {
|
|
|
+ if offset_word {
|
|
|
+ // DXIL takes immediate offsets in -8..=7; the
|
|
|
+ // console's are 6-bit and may be computed.
|
|
|
+ let w = addr_val(self, 0)?;
|
|
|
+ let w = self
|
|
|
+ .s
|
|
|
+ .m
|
|
|
+ .int_value(w)
|
|
|
+ .ok_or("a sample offset that is not constant")?
|
|
|
+ as u32;
|
|
|
+ for (k, o) in os.iter_mut().enumerate().take(offsets) {
|
|
|
+ let x = (w >> (8 * k) & 0x3F) as i32;
|
|
|
+ let x = if x >= 32 { x - 64 } else { x };
|
|
|
+ if !(-8..=7).contains(&x) {
|
|
|
+ return Err("a sample offset past -8..7");
|
|
|
+ }
|
|
|
+ *o = self.s.m.i32(x as u32);
|
|
|
+ }
|
|
|
+ }
|
|
|
args.extend(&os);
|
|
|
args.push(fu);
|
|
|
self.s
|