mojoshader.c
changeset 1190 51de95edd697
parent 1188 25000edc0176
child 1193 4decf307c228
equal deleted inserted replaced
1189:9aaae21251bc 1190:51de95edd697
   988     char rel_swizzle[4] = { '\0' };
   988     char rel_swizzle[4] = { '\0' };
   989     char rel_regnum_str[16] = { '\0' };
   989     char rel_regnum_str[16] = { '\0' };
   990     const char *rel_regtype_str = "";
   990     const char *rel_regtype_str = "";
   991     if (arg->relative)
   991     if (arg->relative)
   992     {
   992     {
   993         rel_swizzle[0] = '.';
   993         if (arg->relative_regtype == REG_TYPE_LOOP)
   994         rel_swizzle[1] = swizzle_channels[arg->relative_component];
   994         {
   995         rel_swizzle[2] = '\0';
   995             rel_swizzle[0] = '\0';
       
   996             rel_swizzle[1] = '\0';
       
   997             rel_swizzle[2] = '\0';
       
   998         } // if
       
   999         else
       
  1000         {
       
  1001             rel_swizzle[0] = '.';
       
  1002             rel_swizzle[1] = swizzle_channels[arg->relative_component];
       
  1003             rel_swizzle[2] = '\0';
       
  1004         } // else
       
  1005 
   996         rel_lbracket = "[";
  1006         rel_lbracket = "[";
   997         rel_rbracket = "]";
  1007         rel_rbracket = "]";
   998         rel_regtype_str = get_D3D_register_string(ctx, arg->relative_regtype,
  1008         rel_regtype_str = get_D3D_register_string(ctx, arg->relative_regtype,
   999                                                   arg->relative_regnum,
  1009                                                   arg->relative_regnum,
  1000                                                   rel_regnum_str,
  1010                                                   rel_regnum_str,
  2106             } // else
  2116             } // else
  2107         } // else
  2117         } // else
  2108 
  2118 
  2109         rel_lbracket = "[";
  2119         rel_lbracket = "[";
  2110 
  2120 
  2111         rel_regtype_str = get_GLSL_varname_in_buf(ctx, arg->relative_regtype,
  2121         if (arg->relative_regtype == REG_TYPE_LOOP)
  2112                                                   arg->relative_regnum,
  2122         {
  2113                                                   (char *) alloca(64), 64);
  2123             rel_regtype_str = "aL";
  2114         rel_swizzle[0] = '.';
  2124             rel_swizzle[0] = '\0';
  2115         rel_swizzle[1] = swizzle_channels[arg->relative_component];
  2125             rel_swizzle[1] = '\0';
  2116         rel_swizzle[2] = '\0';
  2126             rel_swizzle[2] = '\0';
       
  2127         } // if
       
  2128         else
       
  2129         {
       
  2130             rel_regtype_str = get_GLSL_varname_in_buf(ctx, arg->relative_regtype,
       
  2131                                                       arg->relative_regnum,
       
  2132                                                       (char *) alloca(64), 64);
       
  2133             rel_swizzle[0] = '.';
       
  2134             rel_swizzle[1] = swizzle_channels[arg->relative_component];
       
  2135             rel_swizzle[2] = '\0';
       
  2136         } // else
  2117         rel_rbracket = "]";
  2137         rel_rbracket = "]";
  2118     } // if
  2138     } // if
  2119 
  2139 
  2120     char swiz_str[6] = { '\0' };
  2140     char swiz_str[6] = { '\0' };
  2121     if (!isscalar(ctx, ctx->shader_type, arg->regtype, arg->regnum))
  2141     if (!isscalar(ctx, ctx->shader_type, arg->regtype, arg->regnum))
  8938             } // switch
  8958             } // switch
  8939 
  8959 
  8940             if (info->relative_regnum != 0)  // true for now.
  8960             if (info->relative_regnum != 0)  // true for now.
  8941                 fail(ctx, "invalid register for relative address");
  8961                 fail(ctx, "invalid register for relative address");
  8942 
  8962 
  8943             if (!replicate_swizzle(relswiz))
  8963             if ( (info->relative_regtype != REG_TYPE_LOOP) && !replicate_swizzle(relswiz) )
  8944                 fail(ctx, "relative address needs replicate swizzle");
  8964                 fail(ctx, "relative address needs replicate swizzle");
  8945 
  8965 
  8946             info->relative_component = (relswiz & 0x3);
  8966             info->relative_component = (relswiz & 0x3);
  8947 
  8967 
  8948             retval++;
  8968             retval++;