[Mesa-dev] [PATCH 4/5] i965/vs: Add support for shadow comparitors with gather4
Chris Forbes
chrisf at ijw.co.nz
Thu Oct 10 23:15:11 CEST 2013
You're right, that looks completely bogus.
I only have compiler tests and eyeballs for the shadow variants at
this point -- I'll sort that out :)
-- Chris
On Fri, Oct 11, 2013 at 9:33 AM, Eric Anholt <eric at anholt.net> wrote:
> Chris Forbes <chrisf at ijw.co.nz> writes:
>
>> gather4_c's argument layout is straightforward -- refz just goes on the
>> end.
>>
>> gather4_po_c's layout however -- the array index is replaced with refz.
>>
>> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> index 20221d9..7aa8368 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> @@ -2341,7 +2341,7 @@ vec4_visitor::visit(ir_texture *ir)
>> src_reg(0)));
>> }
>> /* Load the shadow comparitor */
>> - if (ir->shadow_comparitor && ir->op != ir_txd) {
>> + if (ir->shadow_comparitor && ir->op != ir_txd && (ir->op != ir_tg4 || !has_nonconstant_offset)) {
>> emit(MOV(dst_reg(MRF, param_base + 1, ir->shadow_comparitor->type,
>> WRITEMASK_X),
>> shadow_comparitor));
>> @@ -2406,9 +2406,18 @@ vec4_visitor::visit(ir_texture *ir)
>> inst->mlen += 2;
>> }
>> } else if (ir->op == ir_tg4 && has_nonconstant_offset) {
>> - emit(MOV(dst_reg(MRF, param_base + 1, glsl_type::ivec2_type, WRITEMASK_XY),
>> - offset_value));
>> - inst->mlen++;
>> + if (ir->shadow_comparitor) {
>> + emit(MOV(dst_reg(MRF, param_base + 1,
>> + ir->shadow_comparitor->type, WRITEMASK_X),
>> + shadow_comparitor));
>> + emit(MOV(dst_reg(MRF, param_base + 1, glsl_type::ivec2_type, WRITEMASK_YZ),
>> + offset_value));
>> + inst->mlen++;
>> + } else {
>> + emit(MOV(dst_reg(MRF, param_base + 1, glsl_type::ivec2_type, WRITEMASK_XY),
>> + offset_value));
>> + inst->mlen++;
>> + }
>> }
>> }
>
> I don't think this code ends up working out. I'm looking at the 4x2
> tables and I see:
>
> 0.x 0.y 0.z 0.w 1.x 1.y 1.z 1.w
> sample_c: u v r ai ref
> sample_po_c: u v r ref offu offv
>
> You're writing the shadow comparitor to 1.x instead of 0.w, and the
> offset to 1.yz instead of 1.xy.
>
> Are there tests for these cases?
More information about the mesa-dev
mailing list