[Mesa-dev] [PATCH 3/3] i965/fs: Implement texelFetch() on Gen4.

Kenneth Graunke kenneth at whitecape.org
Fri Sep 9 20:18:02 PDT 2011


On 09/09/2011 10:07 AM, Eric Anholt wrote:
> On Thu,  8 Sep 2011 15:49:23 -0700, Kenneth Graunke <kenneth at whitecape.org> wrote:
>> +      /* Initialize the rest of u/v/r with 0.0, for safety */
>> +      for (int i = ir->coordinate->type->vector_elements; i < 3; i++) {
>> +	 emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i * 2), fs_reg(0.0f));
>> +      }
>> +
> 
> Didn't we decide that it was not just "for safety", but that that text
> about out of bounds returning 0 was what made that code required?

I don't recall any text about "out of bounds returning 0."  Perhaps you
found something after our conversation?  The closest I could find is in
the "ld" Message Type table entry:

"[Pre-DevIL] Errata: For the SIMD8 and SIMD4x2 forms of this message,
the v parameter must be set to zero for non-array SURFTYPE_1D, and r
must be set to zero for all SURFTYPE_1D and array SURFTYPE_2D surfaces."

But it explicitly mentions every kind of SIMD message except SIMD16 (the
one I'm using).  So it suggests, but doesn't outright justify.

I'm not sure if it's required for txb and txl, so in that case, it may
be "just for safety."  For txf/ld, it does seem to be required.

In lieu of a spec quote, perhaps the following would be better?

/* Initialize the rest of the coordinate to 0.  This appears to be
 * required for the ld message (txf), and seems wise for the others.
 */


More information about the mesa-dev mailing list