[Mesa-dev] [PATCH 2/3] tgsi: emit code for SVIEWINFO and SAMPLE_I

Roland Scheidegger sroland at vmware.com
Fri Mar 8 13:03:27 PST 2013


Am 08.03.2013 21:11, schrieb Brian Paul:
> On 03/08/2013 12:18 PM, sroland at vmware.com wrote:
>> From: Roland Scheidegger<sroland at vmware.com>
>>
>> Can handle them since the single sampler interface was introduced.
>> ---
>>   src/gallium/auxiliary/tgsi/tgsi_exec.c |   18 +++++++++++++-----
>>   1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> b/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> index 9945d42..8c6890b 100644
>> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
>> @@ -2139,7 +2139,8 @@ exec_txd(struct tgsi_exec_machine *mach,
>>
>>   static void
>>   exec_txf(struct tgsi_exec_machine *mach,
>> -         const struct tgsi_full_instruction *inst)
>> +         const struct tgsi_full_instruction *inst,
>> +         boolean is_samplei)
> 
> Can't you just look at inst->Instruction.Opcode to see if it's a
> TGSI_OPCODE_SAMPLE_I instruction?
Sure yes that's probably slightly nicer. I guess I should make the same
change in the corresponding gallivm code...

Roland

> 
> 
>>   {
>>      const uint unit = inst->Src[1].Register.Index;
>>      union tgsi_exec_channel r[4];
>> @@ -2147,13 +2148,20 @@ exec_txf(struct tgsi_exec_machine *mach,
>>      float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
>>      int j;
>>      int8_t offsets[3];
>> +   unsigned target;
>>
>>      /* always fetch all 3 offsets, overkill but keeps code simple */
>>      fetch_texel_offsets(mach, inst, offsets);
>>
>>      IFETCH(&r[3], 0, TGSI_CHAN_W);
>>
>> -   switch(inst->Texture.Texture) {
>> +   if (is_samplei) {
>> +      target = mach->SamplerViews[unit].Resource;
>> +   }
>> +   else {
>> +      target = inst->Texture.Texture;
>> +   }
>> +   switch(target) {
>>      case TGSI_TEXTURE_3D:
>>      case TGSI_TEXTURE_2D_ARRAY:
>>      case TGSI_TEXTURE_SHADOW2D_ARRAY:
>> @@ -4112,7 +4120,7 @@ exec_instruction(
>>         break;
>>
>>      case TGSI_OPCODE_TXF:
>> -      exec_txf(mach, inst);
>> +      exec_txf(mach, inst, FALSE);
>>         break;
>>
>>      case TGSI_OPCODE_TXQ:
>> @@ -4339,7 +4347,7 @@ exec_instruction(
>>         break;
>>
>>      case TGSI_OPCODE_SAMPLE_I:
>> -      assert(0);
>> +      exec_txf(mach, inst, TRUE);
>>         break;
>>
>>      case TGSI_OPCODE_SAMPLE_I_MS:
>> @@ -4375,7 +4383,7 @@ exec_instruction(
>>         break;
>>
>>      case TGSI_OPCODE_SVIEWINFO:
>> -      assert(0);
>> +      exec_txq(mach, inst);
>>         break;
>>
>>      case TGSI_OPCODE_SAMPLE_POS:


More information about the mesa-dev mailing list