[Mesa-dev] [PATCH 2/2] i965/vs: Fix textureGrad() with shadow samplers on Haswell.

Kenneth Graunke kenneth at whitecape.org
Wed May 1 10:41:07 PDT 2013


On 02/25/2013 11:55 AM, Eric Anholt wrote:
> Kenneth Graunke <kenneth at whitecape.org> writes:
>
>> The shadow comparitor needs to be loaded into the Z component of the
>> last DWord.
>>
>> Fixes es3conform's shadow_execution_vert and oglconform's
>> shadow-grad advanced.textureGrad.1D tests on Haswell.
>>
>> NOTE: This is a candidate for stable branches.
>>
>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>> ---
>>   src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> index 1863fe5..f5b467d 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
>> @@ -2194,7 +2194,7 @@ vec4_visitor::visit(ir_texture *ir)
>>         emit(MOV(dst_reg(MRF, param_base, ir->coordinate->type, zero_mask),
>>   	       src_reg(0)));
>>         /* Load the shadow comparitor */
>> -      if (ir->shadow_comparitor) {
>> +      if (ir->shadow_comparitor && ir->op != ir_txd) {
>>   	 emit(MOV(dst_reg(MRF, param_base + 1, ir->shadow_comparitor->type,
>>   			  WRITEMASK_X),
>>   		  shadow_comparitor));
>> @@ -2231,12 +2231,18 @@ vec4_visitor::visit(ir_texture *ir)
>>   	    emit(MOV(dst_reg(MRF, param_base + 1, type, WRITEMASK_YW), dPdy));
>>   	    inst->mlen++;
>>
>> -	    if (ir->type->vector_elements == 3) {
>> +	    if (ir->type->vector_elements == 3 || ir->shadow_comparitor) {
>>   	       dPdx.swizzle = BRW_SWIZZLE_ZZZZ;
>>   	       dPdy.swizzle = BRW_SWIZZLE_ZZZZ;
>>   	       emit(MOV(dst_reg(MRF, param_base + 2, type, WRITEMASK_X), dPdx));
>>   	       emit(MOV(dst_reg(MRF, param_base + 2, type, WRITEMASK_Y), dPdy));
>
> Should we bother setting up dst_reg.xy if vector_elements != 3 here?

I don't think it's necessary.  That means setting up a second MRF at the 
end whose values ought to be ignored anyway.  Simply leaving the mlen == 
1 means that the parameters should implicitly be 0.  This seems to work 
fine.

If we have 3 components or a shadow comparitor, we need the second 
parameter (mlen == 2), so we should set it up explicitly.

>
>>   	       inst->mlen++;
>> +
>> +               if (ir->shadow_comparitor) {
>> +                  emit(MOV(dst_reg(MRF, param_base + 2,
>> +                                   ir->shadow_comparitor->type, WRITEMASK_Z),
>> +                           shadow_comparitor));
>> +               }
>>   	    }
>>   	 } else /* intel->gen == 4 */ {
>>   	    emit(MOV(dst_reg(MRF, param_base + 1, type, WRITEMASK_XYZ), dPdx));
>> --
>> 1.8.1.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list