d3d2glsl.c
branchtrunk
changeset 27 3524701d26fb
parent 26 ed1dc1eca8b2
child 28 bdb89e56bb91
equal deleted inserted replaced
26:ed1dc1eca8b2 27:3524701d26fb
   506     {
   506     {
   507         fail(ctx, "Unknown destination register type.");
   507         fail(ctx, "Unknown destination register type.");
   508         return "";
   508         return "";
   509     } // if
   509     } // if
   510 
   510 
   511     const char *dot_str = (arg->writemask != 0) ? "." : "";
   511     char writemask_str[6];
   512     const char *x_str = (arg->writemask0 != 0) ? "x" : "";
   512     int i = 0;
   513     const char *y_str = (arg->writemask1 != 0) ? "y" : "";
   513     if (arg->writemask != 0xF)  // 0xF == 1111. No explicit mask.
   514     const char *z_str = (arg->writemask2 != 0) ? "z" : "";
   514     {
   515     const char *w_str = (arg->writemask3 != 0) ? "w" : "";
   515         writemask_str[i++] = '.';
       
   516         if (arg->writemask0) writemask_str[i++] = 'x';
       
   517         if (arg->writemask1) writemask_str[i++] = 'y';
       
   518         if (arg->writemask2) writemask_str[i++] = 'z';
       
   519         if (arg->writemask3) writemask_str[i++] = 'w';
       
   520     } // if
       
   521     writemask_str[i] = '\0';
       
   522     assert(i < sizeof (writemask_str));
   516 
   523 
   517     // may turn out something like "_x2_sat_pp_centroid r0.xyzw" ...
   524     // may turn out something like "_x2_sat_pp_centroid r0.xyzw" ...
   518     char *retval = get_scratch_buffer(ctx);
   525     char *retval = get_scratch_buffer(ctx);
   519     snprintf(retval, D3D2GLSL_SCRATCH_BUFFER_SIZE, "%s%s%s%s %s%s%s%s%s%s%s",
   526     snprintf(retval, D3D2GLSL_SCRATCH_BUFFER_SIZE, "%s%s%s%s %s%s%s",
   520              result_shift_str, sat_str, pp_str, cent_str,
   527              result_shift_str, sat_str, pp_str, cent_str,
   521              regtype_str, regnum_str, dot_str, x_str, y_str, z_str, w_str);
   528              regtype_str, regnum_str, writemask_str);
   522     return retval;
   529     return retval;
   523 } // make_D3D_destarg_string
   530 } // make_D3D_destarg_string
   524 
   531 
   525 
   532 
   526 static char *make_D3D_sourcearg_string(Context *ctx, const int idx)
   533 static char *make_D3D_sourcearg_string(Context *ctx, const int idx)