diff options
author | Chris Forbes <[email protected]> | 2014-08-10 11:39:44 +1200 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2014-08-15 19:10:29 +1200 |
commit | 86dc34a0b0d967e9c8611bc29178fdb1de22c724 (patch) | |
tree | 3f5d9fafe8e7c367ee47f97559a41cc3eb2ed1c1 /src/mesa | |
parent | f7146d1a946003bfbb6bc9fc6462a4c827cd93ba (diff) |
i965: Generalize sampler state pointer mangling for non-const
For now, assume that the addressed sampler can be in any of the
16-sampler banks. If we preserved range information this far, we
could avoid emitting these instructions if the sampler were known
to be contained within one bank.
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_eu_emit.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 3626bf4ad01..39f94e96059 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -2386,7 +2386,19 @@ void brw_adjust_sampler_state_pointer(struct brw_compile *p, brw_imm_ud(16 * (sampler / 16) * sampler_state_size)); } } else { - /* XXX: Non-const sampler array indexing case */ + /* Non-const sampler array indexing case */ + if (brw->gen < 8 && !brw->is_haswell) { + return; + } + + struct brw_reg temp = vec1(retype(scratch, BRW_REGISTER_TYPE_UD)); + + brw_AND(p, temp, sampler_index, brw_imm_ud(0x0f0)); + brw_SHL(p, temp, temp, brw_imm_ud(4)); + brw_ADD(p, + get_element_ud(header, 3), + get_element_ud(brw_vec8_grf(0, 0), 3), + temp); } } |