Skip to content

Commit

Permalink
Shift the whole vec instead of every element
Browse files Browse the repository at this point in the history
  • Loading branch information
VlaDexa committed Apr 12, 2024
1 parent b0967e7 commit e7831c8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions naga/src/back/hlsl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2891,13 +2891,13 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> {
}
write!(self.out, "int4(")?;
self.write_expr(module, arg, func_ctx)?;
write!(self.out, " << 24, ")?;
write!(self.out, ", ")?;
self.write_expr(module, arg, func_ctx)?;
write!(self.out, " >> 8 << 24, ")?;
write!(self.out, " >> 8, ")?;
self.write_expr(module, arg, func_ctx)?;
write!(self.out, " >> 16 << 24, ")?;
write!(self.out, " >> 16, ")?;
self.write_expr(module, arg, func_ctx)?;
write!(self.out, " >> 24 << 24) >> 24")?;
write!(self.out, " >> 24) << 24 >> 24")?;
}
Function::Regular(fun_name) => {
write!(self.out, "{fun_name}(")?;
Expand Down
8 changes: 4 additions & 4 deletions naga/src/back/msl/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2024,13 +2024,13 @@ impl<W: Write> Writer<W> {
}
write!(self.out, "int4(")?;
self.put_expression(arg, context, true)?;
write!(self.out, " << 24, ")?;
write!(self.out, ", ")?;
self.put_expression(arg, context, true)?;
write!(self.out, " >> 8 << 24, ")?;
write!(self.out, " >> 8, ")?;
self.put_expression(arg, context, true)?;
write!(self.out, " >> 16 << 24, ")?;
write!(self.out, " >> 16, ")?;
self.put_expression(arg, context, true)?;
write!(self.out, " >> 24 << 24) >> 24")?;
write!(self.out, " >> 24) << 24 >> 24")?;
}
_ => {
write!(self.out, "{NAMESPACE}::{fun_name}")?;
Expand Down
4 changes: 2 additions & 2 deletions naga/tests/out/hlsl/bits.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ void main()
uint _expr50 = u;
f2_ = float2(f16tof32(_expr50), f16tof32((_expr50) >> 16));
uint _expr52 = u;
i4_ = int4(_expr52 << 24, _expr52 >> 8 << 24, _expr52 >> 16 << 24, _expr52 >> 24 << 24) >> 24;
i4_ = int4(_expr52, _expr52 >> 8, _expr52 >> 16, _expr52 >> 24) << 24 >> 24;
uint _expr54 = u;
u4_ = uint4(_expr54 << 24, _expr54 >> 8 << 24, _expr54 >> 16 << 24, _expr54 >> 24 << 24) >> 24;
u4_ = uint4(_expr54, _expr54 >> 8, _expr54 >> 16, _expr54 >> 24) << 24 >> 24;
int _expr56 = i;
int _expr57 = i;
i = naga_insertBits(_expr56, _expr57, 5u, 10u);
Expand Down
4 changes: 2 additions & 2 deletions naga/tests/out/msl/bits.msl
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ kernel void main_(
uint _e50 = u;
f2_ = float2(as_type<half2>(_e50));
uint _e52 = u;
i4_ = int4(_e52 << 24, _e52 >> 8 << 24, _e52 >> 16 << 24, _e52 >> 24 << 24) >> 24;
i4_ = int4(_e52, _e52 >> 8, _e52 >> 16, _e52 >> 24) << 24 >> 24;
uint _e54 = u;
u4_ = uint4(_e54 << 24, _e54 >> 8 << 24, _e54 >> 16 << 24, _e54 >> 24 << 24) >> 24;
u4_ = uint4(_e54, _e54 >> 8, _e54 >> 16, _e54 >> 24) << 24 >> 24;
int _e56 = i;
int _e57 = i;
i = metal::insert_bits(_e56, _e57, metal::min(5u, 32u), metal::min(10u, 32u - metal::min(5u, 32u)));
Expand Down

0 comments on commit e7831c8

Please sign in to comment.