mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-05 05:50:29 +01:00
i965/fs: Refactor offset() into a separate function taking the width as argument.
This will be useful in the SIMD lowering pass to avoid having to construct a builder object of the known region width just to pass it as argument to offset(), which doesn't do anything with it other than taking the builder dispatch_width as region width. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
a5b4f63c15
commit
4db93592de
2 changed files with 21 additions and 16 deletions
|
|
@ -44,23 +44,9 @@ namespace brw {
|
|||
struct brw_gs_compile;
|
||||
|
||||
static inline fs_reg
|
||||
offset(fs_reg reg, const brw::fs_builder& bld, unsigned delta)
|
||||
offset(const fs_reg ®, const brw::fs_builder &bld, unsigned delta)
|
||||
{
|
||||
switch (reg.file) {
|
||||
case BAD_FILE:
|
||||
break;
|
||||
case ARF:
|
||||
case FIXED_GRF:
|
||||
case MRF:
|
||||
case VGRF:
|
||||
case ATTR:
|
||||
case UNIFORM:
|
||||
return byte_offset(reg,
|
||||
delta * reg.component_size(bld.dispatch_width()));
|
||||
case IMM:
|
||||
assert(delta == 0);
|
||||
}
|
||||
return reg;
|
||||
return offset(reg, bld.dispatch_width(), delta);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -140,6 +140,25 @@ horiz_offset(const fs_reg ®, unsigned delta)
|
|||
unreachable("Invalid register file");
|
||||
}
|
||||
|
||||
static inline fs_reg
|
||||
offset(fs_reg reg, unsigned width, unsigned delta)
|
||||
{
|
||||
switch (reg.file) {
|
||||
case BAD_FILE:
|
||||
break;
|
||||
case ARF:
|
||||
case FIXED_GRF:
|
||||
case MRF:
|
||||
case VGRF:
|
||||
case ATTR:
|
||||
case UNIFORM:
|
||||
return byte_offset(reg, delta * reg.component_size(width));
|
||||
case IMM:
|
||||
assert(delta == 0);
|
||||
}
|
||||
return reg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scalar channel of \p reg given by \p idx and replicate it to all
|
||||
* channels of the result.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue