G45+ determine the data type to return based on the Surface Format, but the original Gen4 hardware needs a bit more hand-holding.
For convenience, set the return format based on the destination register type, as we already set that correctly. Cc: Eric Anholt <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) Eric, I wrote this patch a while back thinking I'd need it for textureSize(). I quickly realized my mistake, but kept it around for integer texturing. You might want to include it in your integer-texture series. I haven't bothered to resurrect my Gen4 system to test integer texturing, though. diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index dbb42f4..3c94707 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -642,6 +642,19 @@ brw_set_dp_read_message(struct brw_compile *p, } } +static uint32_t +gen4_sampler_return_format(uint32_t dst_reg_type) +{ + switch (dst_reg_type) { + case BRW_REGISTER_TYPE_UD: + return BRW_SAMPLER_RETURN_FORMAT_UINT32; + case BRW_REGISTER_TYPE_D: + return BRW_SAMPLER_RETURN_FORMAT_SINT32; + default: + return BRW_SAMPLER_RETURN_FORMAT_FLOAT32; + } +} + static void brw_set_sampler_message(struct brw_compile *p, struct brw_instruction *insn, GLuint binding_table_index, @@ -676,7 +689,8 @@ static void brw_set_sampler_message(struct brw_compile *p, insn->bits3.sampler.binding_table_index = binding_table_index; insn->bits3.sampler.sampler = sampler; insn->bits3.sampler.msg_type = msg_type; - insn->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_FLOAT32; + insn->bits3.sampler.return_format = + gen4_sampler_return_format(insn->bits1.da1.dest_reg_type); } } -- 1.7.7.2 _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
