[Mesa-dev] [PATCH 5/8] tgsi: add support for image operations to tgsi_exec.

Dave Airlie airlied at gmail.com
Tue Mar 22 22:40:34 UTC 2016


>> +   int dim;
>> +   switch (tgsi_tex) {
>> +   case TGSI_TEXTURE_BUFFER:
>> +   case TGSI_TEXTURE_1D:
>> +      dim = 1;
>> +      break;
>> +   case TGSI_TEXTURE_2D:
>> +   case TGSI_TEXTURE_RECT:
>> +   case TGSI_TEXTURE_1D_ARRAY:
>> +   case TGSI_TEXTURE_2D_MSAA:
>> +      dim = 2;
>> +      break;
>> +   case TGSI_TEXTURE_3D:
>> +   case TGSI_TEXTURE_CUBE:
>> +   case TGSI_TEXTURE_2D_ARRAY:
>> +   case TGSI_TEXTURE_2D_ARRAY_MSAA:
>> +   case TGSI_TEXTURE_CUBE_ARRAY:
>> +      dim = 3;
>> +      break;
>> +   default:
>> +      assert(!"unknown texture target");
>> +      dim = 0;
>> +      break;
>> +   }
>> +
>> +   if (sample) {
>> +      switch (tgsi_tex) {
>> +      case TGSI_TEXTURE_2D_MSAA:
>> +         *sample = 3;
>> +         break;
>> +      case TGSI_TEXTURE_2D_ARRAY_MSAA:
>> +         *sample = 4;
>> +         break;
>> +      default:
>> +         *sample = 0;
>> +         break;
>> +      }
>> +   }
>> +   return dim;
>> +}
>
>
> That function seems to do two independent things.  Can this be two
> functions?
>
Probably, I was just following local style

tgsi_util_get_texture_coord_dim

was what I copied.

Dave.


More information about the mesa-dev mailing list