}\r
}\r
\r
-/*\r
+/**\r
* Map mesa register file index to SBIR index.\r
* Take special care when processing input and output indices.\r
+ * \param processor either TGSI_PROCESSOR_FRAGMENT or TGSI_PROCESSOR_VERTEX\r
+ * \param file one of TGSI_FILE_x\r
+ * \param index the mesa register file index\r
+ * \param usage_bitmask ???\r
*/\r
static GLuint\r
map_register_file_index(\r
GLuint processor,\r
GLuint file,\r
GLuint index,\r
- GLuint usage_bitmask )\r
+ GLbitfield usage_bitmask )\r
{\r
GLuint mapped_index;\r
GLuint i;\r
\r
switch( file ) {\r
case TGSI_FILE_INPUT:\r
+ /*\r
+ * The fragment/vertex program input indexes (FRAG/VERT_ATTRIB_x) get\r
+ * mapped to a packed sequence of integers.\r
+ * If a program uses one input attribute, the mapped index will be 1.\r
+ * If a program uses two input attribs, the mapped indexes will be 1,2.\r
+ * If a program uses 3 input attribs, the mapped indexes will be 1,2,3.\r
+ * etc.\r
+ */\r
assert( index < 32 );\r
assert( usage_bitmask & (1 << index) );\r
mapped_index = 0;\r
mapped_index++;\r
}\r
}\r
+ printf("Map input %d to %d\n", index, mapped_index);\r
break;\r
\r
case TGSI_FILE_OUTPUT:\r
- assert( usage_bitmask == 0 );\r
+ assert( usage_bitmask == 0x0 );\r
if( processor == TGSI_PROCESSOR_FRAGMENT ) {\r
+ /* depth result -> index 0\r
+ * color results -> index 1, 2, ...\r
+ */\r
if( index == FRAG_RESULT_DEPR ) {\r
mapped_index = 0;\r
}\r
}\r
}\r
else {\r
+ /* mapped_index = VERT_RESULT_x */\r
mapped_index = index;\r
}\r
break;\r
\r
static GLboolean\r
compile_instruction(\r
- struct prog_instruction *inst,\r
+ const struct prog_instruction *inst,\r
struct tgsi_full_instruction *fullinst,\r
GLuint inputs_read,\r
GLuint processor )\r
processor,\r
fulldst->DstRegister.File,\r
inst->DstReg.Index,\r
- 0 );\r
+ 0x0 );\r
fulldst->DstRegister.WriteMask = convert_writemask( inst->DstReg.WriteMask );\r
\r
for( i = 0; i < fullinst->Instruction.NumSrcRegs; i++ ) {\r