mojoshader.c
changeset 1254 422f68756c9f
parent 1225 50b8dd7e0b1a
child 1255 0135d797e287
equal deleted inserted replaced
1253:c84325b641cc 1254:422f68756c9f
  3238                 case REG_TYPE_TEXCRDOUT:
  3238                 case REG_TYPE_TEXCRDOUT:
  3239                 case REG_TYPE_COLOROUT:
  3239                 case REG_TYPE_COLOROUT:
  3240                 case REG_TYPE_DEPTHOUT:
  3240                 case REG_TYPE_DEPTHOUT:
  3241                     ignore = 1;
  3241                     ignore = 1;
  3242                     break;
  3242                     break;
  3243                 case REG_TYPE_TEXTURE:
       
  3244                 case REG_TYPE_MISCTYPE:
       
  3245                 case REG_TYPE_INPUT:
       
  3246                     ignore = shader_is_pixel(ctx);
       
  3247                     break;
       
  3248                 default:
  3243                 default:
  3249                     ignore = 0;
  3244                     ignore = 0;
  3250                     break;
  3245                     break;
  3251             } // switch
  3246             } // switch
  3252 
  3247 
  3253             if (!ignore)
  3248             if (!ignore)
  3254             {
  3249             {
  3255                 if (shader_is_pixel(ctx))
  3250                 wptr->usage = item->usage;
  3256                     fail(ctx, "BUG: pixel shader with vertex attributes");
  3251                 wptr->index = item->index;
  3257                 else
  3252                 wptr->name = alloc_varname(ctx, item);
  3258                 {
  3253                 wptr++;
  3259                     wptr->usage = item->usage;
  3254                 count++;
  3260                     wptr->index = item->index;
       
  3261                     wptr->name = alloc_varname(ctx, item);
       
  3262                     wptr++;
       
  3263                     count++;
       
  3264                 } // else
       
  3265             } // if
  3255             } // if
  3266 
  3256 
  3267             item = item->next;
  3257             item = item->next;
  3268         } // for
  3258         } // for
  3269     } // if
  3259     } // if
  3514     while (item != NULL)
  3504     while (item != NULL)
  3515     {
  3505     {
  3516         RegisterList *next = item->next;
  3506         RegisterList *next = item->next;
  3517         const RegisterType regtype = item->regtype;
  3507         const RegisterType regtype = item->regtype;
  3518         const int regnum = item->regnum;
  3508         const int regnum = item->regnum;
       
  3509         MOJOSHADER_usage usage;
  3519 
  3510 
  3520         if (!get_defined_register(ctx, regtype, regnum))
  3511         if (!get_defined_register(ctx, regtype, regnum))
  3521         {
  3512         {
  3522             // haven't already dealt with this one.
  3513             // haven't already dealt with this one.
  3523             switch (regtype)
  3514             switch (regtype)
  3535                         return;
  3526                         return;
  3536                     } // if
  3527                     } // if
  3537 
  3528 
  3538                     // Apparently this is an attribute that wasn't DCL'd.
  3529                     // Apparently this is an attribute that wasn't DCL'd.
  3539                     //  Add it to the attribute list; deal with it later.
  3530                     //  Add it to the attribute list; deal with it later.
  3540                     // !!! FIXME: we should use something other than UNKNOWN here.
  3531                     if (regtype == REG_TYPE_RASTOUT)
  3541                     add_attribute_register(ctx, regtype, regnum,
  3532                     {
  3542                                            MOJOSHADER_USAGE_UNKNOWN, 0, 0xF, 0);
  3533                         if ((RastOutType) regnum == RASTOUT_TYPE_POSITION)
       
  3534                             usage = MOJOSHADER_USAGE_POSITION;
       
  3535                         else if ((RastOutType) regnum == RASTOUT_TYPE_FOG)
       
  3536                             usage = MOJOSHADER_USAGE_FOG;
       
  3537                         else if ((RastOutType) regnum==RASTOUT_TYPE_POINT_SIZE)
       
  3538                             usage = MOJOSHADER_USAGE_POINTSIZE;
       
  3539                     } // if
       
  3540                     else if (regtype == REG_TYPE_ATTROUT ||
       
  3541                              regtype == REG_TYPE_COLOROUT)
       
  3542                     {
       
  3543                         usage = MOJOSHADER_USAGE_COLOR;
       
  3544                     } // else if
       
  3545                     else if (regtype == REG_TYPE_TEXCRDOUT)
       
  3546                         usage = MOJOSHADER_USAGE_TEXCOORD;
       
  3547                     else if (regtype == REG_TYPE_DEPTHOUT)
       
  3548                         usage = MOJOSHADER_USAGE_DEPTH;
       
  3549 
       
  3550                     add_attribute_register(ctx, regtype, regnum, usage,
       
  3551                                            regnum, 0xF, 0);
  3543                     break;
  3552                     break;
  3544 
  3553 
  3545                 case REG_TYPE_ADDRESS:
  3554                 case REG_TYPE_ADDRESS:
  3546                 case REG_TYPE_PREDICATE:
  3555                 case REG_TYPE_PREDICATE:
  3547                 case REG_TYPE_TEMP:
  3556                 case REG_TYPE_TEMP: