mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 05:40:39 +02:00
nak: Add a UniformBuilder
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
This commit is contained in:
parent
ab8a4d1940
commit
3dfd92888a
1 changed files with 32 additions and 0 deletions
|
|
@ -800,3 +800,35 @@ impl<'a, T: SSABuilder> SSABuilder for PredicatedBuilder<'a, T> {
|
|||
self.b.alloc_ssa(file, comps)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct UniformBuilder<'a, T: Builder> {
|
||||
b: &'a mut T,
|
||||
uniform: bool,
|
||||
}
|
||||
|
||||
impl<'a, T: Builder> UniformBuilder<'a, T> {
|
||||
pub fn new(b: &'a mut T, uniform: bool) -> Self {
|
||||
Self { b, uniform }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Builder> Builder for UniformBuilder<'a, T> {
|
||||
fn push_instr(&mut self, instr: Box<Instr>) -> &mut Instr {
|
||||
self.b.push_instr(instr)
|
||||
}
|
||||
|
||||
fn sm(&self) -> u8 {
|
||||
self.b.sm()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: SSABuilder> SSABuilder for UniformBuilder<'a, T> {
|
||||
fn alloc_ssa(&mut self, file: RegFile, comps: u8) -> SSARef {
|
||||
let file = if self.uniform {
|
||||
file.to_uniform().unwrap()
|
||||
} else {
|
||||
file
|
||||
};
|
||||
self.b.alloc_ssa(file, comps)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue