Indent.
authormichal <michal@michal-laptop.(none)>
Fri, 6 Jul 2007 16:53:55 +0000 (18:53 +0200)
committermichal <michal@michal-laptop.(none)>
Fri, 6 Jul 2007 16:53:55 +0000 (18:53 +0200)
Fix function prototype.

src/mesa/pipe/tgsi/mesa/mesa_to_tgsi.c

index e37778fe41eb014142027084c3bfa753bbdd3f95..e6298f579fdb2a7fef15c0de5a6a8c949ae55c5f 100644 (file)
@@ -5,9 +5,10 @@
  * Map mesa register file to SBIR register file.\r
  */\r
 static GLuint\r
-map_register_file( enum register_file file )\r
+map_register_file(\r
+   enum register_file file )\r
 {\r
-   switch (file) {\r
+   switch( file ) {\r
    case PROGRAM_UNDEFINED:\r
       return TGSI_FILE_NULL;\r
    case PROGRAM_TEMPORARY:\r
@@ -25,7 +26,7 @@ map_register_file( enum register_file file )
    case PROGRAM_ADDRESS:\r
       return TGSI_FILE_ADDRESS;\r
    default:\r
-      assert (0);\r
+      assert( 0 );\r
       return TGSI_FILE_NULL;\r
    }\r
 }\r
@@ -35,37 +36,40 @@ map_register_file( enum register_file file )
  * Take special care when processing input and output indices.\r
  */\r
 static GLuint\r
-map_register_file_index( GLuint processor,\r
-                        GLuint file,\r
-                        GLuint index,\r
-                        GLuint usage_bitmask )\r
+map_register_file_index(\r
+   GLuint processor,\r
+   GLuint file,\r
+   GLuint index,\r
+   GLuint usage_bitmask )\r
 {\r
    GLuint mapped_index;\r
    GLuint i;\r
 \r
-   switch (file)\r
-   {\r
+   switch( file ) {\r
    case TGSI_FILE_INPUT:\r
-      assert (index < 32);\r
-      assert (usage_bitmask & (1 << index));\r
+      assert( index < 32 );\r
+      assert( usage_bitmask & (1 << index) );\r
       mapped_index = 0;\r
-      for (i = 0; i < index; i++) {\r
-        if (usage_bitmask & (1 << i))\r
-           mapped_index++;\r
+      for( i = 0; i < index; i++ ) {\r
+         if( usage_bitmask & (1 << i) ) {\r
+            mapped_index++;\r
+         }\r
       }\r
       break;\r
 \r
    case TGSI_FILE_OUTPUT:\r
-      assert (usage_bitmask == 0);\r
-      if (processor == TGSI_PROCESSOR_FRAGMENT) {\r
-        if (index == FRAG_RESULT_DEPR) {\r
-           mapped_index = 0;\r
-        } else {\r
-           assert (index == FRAG_RESULT_COLR);\r
-           mapped_index = index + 1;\r
-        }\r
-      } else {\r
-        mapped_index = index;\r
+      assert( usage_bitmask == 0 );\r
+      if( processor == TGSI_PROCESSOR_FRAGMENT ) {\r
+        if( index == FRAG_RESULT_DEPR ) {\r
+            mapped_index = 0;\r
+         }\r
+         else {\r
+            assert( index == FRAG_RESULT_COLR );\r
+            mapped_index = index + 1;\r
+         }\r
+      }\r
+      else {\r
+         mapped_index = index;\r
       }\r
       break;\r
 \r
@@ -80,9 +84,10 @@ map_register_file_index( GLuint processor,
  * Map mesa texture target to SBIR texture target.\r
  */\r
 static GLuint\r
-map_texture_target( GLuint textarget )\r
+map_texture_target(\r
+   GLuint textarget )\r
 {\r
-   switch (textarget) {\r
+   switch( textarget ) {\r
    case TEXTURE_1D_INDEX:\r
       return TGSI_TEXTURE_1D;\r
    case TEXTURE_2D_INDEX:\r
@@ -94,15 +99,17 @@ map_texture_target( GLuint textarget )
    case TEXTURE_RECT_INDEX:\r
       return TGSI_TEXTURE_RECT;\r
    default:\r
-      assert (0);\r
+      assert( 0 );\r
    }\r
+\r
    return TGSI_TEXTURE_1D;\r
 }\r
 \r
 static GLuint\r
-convert_sat( GLuint sat )\r
+convert_sat(\r
+   GLuint sat )\r
 {\r
-   switch (sat) {\r
+   switch( sat ) {\r
    case SATURATE_OFF:\r
       return TGSI_SAT_NONE;\r
    case SATURATE_ZERO_ONE:\r
@@ -110,107 +117,114 @@ convert_sat( GLuint sat )
    case SATURATE_PLUS_MINUS_ONE:\r
       return TGSI_SAT_MINUS_PLUS_ONE;\r
    default:\r
-      assert (0);\r
+      assert( 0 );\r
       return TGSI_SAT_NONE;\r
    }\r
 }\r
 \r
 static GLuint\r
-convert_writemask( GLuint writemask )\r
+convert_writemask(\r
+   GLuint writemask )\r
 {\r
-   assert (WRITEMASK_X == TGSI_WRITEMASK_X);\r
-   assert (WRITEMASK_Y == TGSI_WRITEMASK_Y);\r
-   assert (WRITEMASK_Z == TGSI_WRITEMASK_Z);\r
-   assert (WRITEMASK_W == TGSI_WRITEMASK_W);\r
-   assert ((writemask & ~TGSI_WRITEMASK_XYZW) == 0);\r
+   assert( WRITEMASK_X == TGSI_WRITEMASK_X );\r
+   assert( WRITEMASK_Y == TGSI_WRITEMASK_Y );\r
+   assert( WRITEMASK_Z == TGSI_WRITEMASK_Z );\r
+   assert( WRITEMASK_W == TGSI_WRITEMASK_W );\r
+   assert( (writemask & ~TGSI_WRITEMASK_XYZW) == 0 );\r
 \r
    return writemask;\r
 }\r
 \r
 static GLboolean\r
-compile_instruction( struct prog_instruction *inst,\r
-                    struct tgsi_full_instruction *fullinst,\r
-                    GLuint inputs_read,\r
-                    GLuint processor )\r
+compile_instruction(\r
+   struct prog_instruction *inst,\r
+   struct tgsi_full_instruction *fullinst,\r
+   GLuint inputs_read,\r
+   GLuint processor )\r
 {\r
    GLuint i;\r
    struct tgsi_full_dst_register *fulldst;\r
    struct tgsi_full_src_register *fullsrc;\r
 \r
-   *fullinst = tgsi_default_full_instruction ();\r
+   *fullinst = tgsi_default_full_instruction();\r
 \r
-   fullinst->Instruction.Saturate = convert_sat (inst->SaturateMode);\r
+   fullinst->Instruction.Saturate = convert_sat( inst->SaturateMode );\r
    fullinst->Instruction.NumDstRegs = 1;\r
-   fullinst->Instruction.NumSrcRegs = _mesa_num_inst_src_regs (inst->Opcode);\r
+   fullinst->Instruction.NumSrcRegs = _mesa_num_inst_src_regs( inst->Opcode );\r
 \r
    fulldst = &fullinst->FullDstRegisters[0];\r
-   fulldst->DstRegister.File =\r
-      map_register_file (inst->DstReg.File);\r
-   fulldst->DstRegister.Index =\r
-      map_register_file_index (processor,\r
-                              fulldst->DstRegister.File,\r
-                              inst->DstReg.Index,\r
-                              0);\r
-   fulldst->DstRegister.WriteMask =\r
-      convert_writemask (inst->DstReg.WriteMask);\r
-\r
-   for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {\r
+   fulldst->DstRegister.File = map_register_file( inst->DstReg.File );\r
+   fulldst->DstRegister.Index = map_register_file_index(\r
+      processor,\r
+      fulldst->DstRegister.File,\r
+      inst->DstReg.Index,\r
+      0 );\r
+   fulldst->DstRegister.WriteMask = convert_writemask( inst->DstReg.WriteMask );\r
+\r
+   for( i = 0; i < fullinst->Instruction.NumSrcRegs; i++ ) {\r
       GLuint j;\r
 \r
       fullsrc = &fullinst->FullSrcRegisters[i];\r
-      fullsrc->SrcRegister.File =\r
-        map_register_file (inst->SrcReg[i].File);\r
-      fullsrc->SrcRegister.Index =\r
-        map_register_file_index (processor,\r
-                                 fullsrc->SrcRegister.File,\r
-                                 inst->SrcReg[i].Index,\r
-                                 inputs_read);\r
-\r
-      for (j = 0; j < 4; j++) {\r
-        GLuint swz;\r
-\r
-        swz = GET_SWZ(inst->SrcReg[i].Swizzle, j);\r
-        if (swz > SWIZZLE_W) {\r
-           tgsi_util_set_src_register_extswizzle (\r
-              &fullsrc->SrcRegisterExtSwz,\r
-              swz,\r
-              j);\r
-        } else {\r
-           tgsi_util_set_src_register_swizzle (\r
-              &fullsrc->SrcRegister,\r
-              swz,\r
-              j);\r
-        }\r
+      fullsrc->SrcRegister.File = map_register_file( inst->SrcReg[i].File );\r
+      fullsrc->SrcRegister.Index = map_register_file_index(\r
+         processor,\r
+         fullsrc->SrcRegister.File,\r
+         inst->SrcReg[i].Index,\r
+         inputs_read );\r
+\r
+      for( j = 0; j < 4; j++ ) {\r
+         GLuint swz;\r
+\r
+         swz = GET_SWZ( inst->SrcReg[i].Swizzle, j );\r
+         if( swz > SWIZZLE_W ) {\r
+            tgsi_util_set_src_register_extswizzle(\r
+               &fullsrc->SrcRegisterExtSwz,\r
+               swz,\r
+               j );\r
+         }\r
+         else {\r
+            tgsi_util_set_src_register_swizzle(\r
+               &fullsrc->SrcRegister,\r
+               swz,\r
+               j );\r
+         }\r
       }\r
 \r
-      if (inst->SrcReg[i].NegateBase == NEGATE_XYZW) {\r
-        fullsrc->SrcRegister.Negate = 1;\r
-      } else if (inst->SrcReg[i].NegateBase != NEGATE_NONE) {\r
-        if (inst->SrcReg[i].NegateBase & NEGATE_X)\r
-           fullsrc->SrcRegisterExtSwz.NegateX = 1;\r
-        if (inst->SrcReg[i].NegateBase & NEGATE_Y)\r
-           fullsrc->SrcRegisterExtSwz.NegateY = 1;\r
-        if (inst->SrcReg[i].NegateBase & NEGATE_Z)\r
-           fullsrc->SrcRegisterExtSwz.NegateZ = 1;\r
-        if (inst->SrcReg[i].NegateBase & NEGATE_W)\r
-           fullsrc->SrcRegisterExtSwz.NegateW = 1;\r
+      if( inst->SrcReg[i].NegateBase == NEGATE_XYZW ) {\r
+         fullsrc->SrcRegister.Negate = 1;\r
+      }\r
+      else if( inst->SrcReg[i].NegateBase != NEGATE_NONE ) {\r
+         if( inst->SrcReg[i].NegateBase & NEGATE_X ) {\r
+            fullsrc->SrcRegisterExtSwz.NegateX = 1;\r
+         }\r
+         if( inst->SrcReg[i].NegateBase & NEGATE_Y ) {\r
+            fullsrc->SrcRegisterExtSwz.NegateY = 1;\r
+         }\r
+         if( inst->SrcReg[i].NegateBase & NEGATE_Z ) {\r
+            fullsrc->SrcRegisterExtSwz.NegateZ = 1;\r
+         }\r
+         if( inst->SrcReg[i].NegateBase & NEGATE_W ) {\r
+            fullsrc->SrcRegisterExtSwz.NegateW = 1;\r
+         }\r
       }\r
 \r
-      if (inst->SrcReg[i].Abs)\r
-        fullsrc->SrcRegisterExtMod.Absolute = 1;\r
+      if( inst->SrcReg[i].Abs ) {\r
+         fullsrc->SrcRegisterExtMod.Absolute = 1;\r
+      }\r
 \r
-      if (inst->SrcReg[i].NegateAbs)\r
-        fullsrc->SrcRegisterExtMod.Negate = 1;\r
+      if( inst->SrcReg[i].NegateAbs ) {\r
+         fullsrc->SrcRegisterExtMod.Negate = 1;\r
+      }\r
 \r
-      if (inst->SrcReg[i].RelAddr) {\r
-        fullsrc->SrcRegister.Indirect = 1;\r
+      if( inst->SrcReg[i].RelAddr ) {\r
+         fullsrc->SrcRegister.Indirect = 1;\r
 \r
-        fullsrc->SrcRegisterInd.File = TGSI_FILE_ADDRESS;\r
-        fullsrc->SrcRegisterInd.Index = 0;\r
+         fullsrc->SrcRegisterInd.File = TGSI_FILE_ADDRESS;\r
+         fullsrc->SrcRegisterInd.Index = 0;\r
       }\r
    }\r
 \r
-   switch (inst->Opcode) {\r
+   switch( inst->Opcode ) {\r
    case OPCODE_ARL:\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_ARL;\r
       break;\r
@@ -282,8 +296,9 @@ compile_instruction( struct prog_instruction *inst,
       break;\r
    case OPCODE_RSQ:\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_RSQ;\r
-      tgsi_util_set_full_src_register_sign_mode (&fullinst->FullSrcRegisters[0],\r
-                                                TGSI_UTIL_SIGN_CLEAR);\r
+      tgsi_util_set_full_src_register_sign_mode(\r
+         &fullinst->FullSrcRegisters[0],\r
+         TGSI_UTIL_SIGN_CLEAR );\r
       break;\r
    case OPCODE_SCS:\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_SCS;\r
@@ -307,21 +322,21 @@ compile_instruction( struct prog_instruction *inst,
    case OPCODE_TEX:\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TEX;\r
       fullinst->Instruction.NumSrcRegs = 2;\r
-      fullinst->InstructionExtTexture.Texture = map_texture_target (inst->TexSrcTarget);\r
+      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r
       fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;\r
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;\r
       break;\r
    case OPCODE_TXB:\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TXB;\r
       fullinst->Instruction.NumSrcRegs = 2;\r
-      fullinst->InstructionExtTexture.Texture = map_texture_target (inst->TexSrcTarget);\r
+      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r
       fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;\r
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;\r
       break;\r
    case OPCODE_TXP:\r
       fullinst->Instruction.Opcode = TGSI_OPCODE_TEX;\r
       fullinst->Instruction.NumSrcRegs = 2;\r
-      fullinst->InstructionExtTexture.Texture = map_texture_target (inst->TexSrcTarget);\r
+      fullinst->InstructionExtTexture.Texture = map_texture_target( inst->TexSrcTarget );\r
       fullinst->FullSrcRegisters[0].SrcRegisterExtSwz.ExtDivide = TGSI_EXTSWIZZLE_W;\r
       fullinst->FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER;\r
       fullinst->FullSrcRegisters[1].SrcRegister.Index = inst->TexSrcUnit;\r
@@ -333,17 +348,17 @@ compile_instruction( struct prog_instruction *inst,
    case OPCODE_END:\r
       return GL_TRUE;\r
    default:\r
-      assert (0);\r
+      assert( 0 );\r
    }\r
 \r
    return GL_FALSE;\r
 }\r
 \r
 GLboolean\r
-tgsi_compile_fp_program( const struct gl_fragment_program *program,\r
-                        struct tgsi_token *tokens,\r
-                        GLuint max_token_count,\r
-                        GLuint *token_count )\r
+tgsi_compile_fp_program(\r
+   const struct gl_fragment_program *program,\r
+   struct tgsi_token *tokens,\r
+   GLuint maxTokens )\r
 {\r
    GLuint i, ti;\r
    struct tgsi_header *header;\r
@@ -353,10 +368,10 @@ tgsi_compile_fp_program( const struct gl_fragment_program *program,
    struct tgsi_full_src_register *fullsrc;\r
    GLuint inputs_read;\r
 \r
-   *(struct tgsi_version *) &tokens[0] = tgsi_build_version ();\r
+   *(struct tgsi_version *) &tokens[0] = tgsi_build_version();\r
 \r
    header = (struct tgsi_header *) &tokens[1];\r
-   *header = tgsi_build_header ();\r
+   *header = tgsi_build_header();\r
 \r
    ti = 2;\r
 \r
@@ -387,7 +402,7 @@ tgsi_compile_fp_program( const struct gl_fragment_program *program,
       &fulldecl,\r
       &tokens[ti],\r
       header,\r
-      max_token_count - ti );\r
+      maxTokens - ti );\r
 \r
    /*\r
     * Interpolate generic attributes.\r
@@ -406,14 +421,14 @@ tgsi_compile_fp_program( const struct gl_fragment_program *program,
       &fulldecl,\r
       &tokens[ti],\r
       header,\r
-      max_token_count - ti );\r
+      maxTokens - ti );\r
 \r
    /*\r
     * Copy input fragment xyz to output xyz.\r
     * If the shader writes depth, do not copy the z component.\r
     */\r
 \r
-   fullinst = tgsi_default_full_instruction ();\r
+   fullinst = tgsi_default_full_instruction();\r
 \r
    fullinst.Instruction.Opcode = TGSI_OPCODE_MOV;\r
    fullinst.Instruction.NumDstRegs = 1;\r
@@ -422,9 +437,10 @@ tgsi_compile_fp_program( const struct gl_fragment_program *program,
    fulldst = &fullinst.FullDstRegisters[0];\r
    fulldst->DstRegister.File = TGSI_FILE_OUTPUT;\r
    fulldst->DstRegister.Index = 0;\r
-   if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR)) {\r
+   if( program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPR) ) {\r
       fulldst->DstRegister.WriteMask = TGSI_WRITEMASK_XY;\r
-   } else {\r
+   }\r
+   else {\r
       fulldst->DstRegister.WriteMask = TGSI_WRITEMASK_XYZ;\r
    }\r
 \r
@@ -432,35 +448,40 @@ tgsi_compile_fp_program( const struct gl_fragment_program *program,
    fullsrc->SrcRegister.File = TGSI_FILE_INPUT;\r
    fullsrc->SrcRegister.Index = 0;\r
 \r
-   ti += tgsi_build_full_instruction (&fullinst,\r
-                                     &tokens[ti],\r
-                                     header,\r
-                                     max_token_count - ti);\r
+   ti += tgsi_build_full_instruction(\r
+      &fullinst,\r
+      &tokens[ti],\r
+      header,\r
+      maxTokens - ti );\r
 \r
    for( i = 0; i < program->Base.NumInstructions; i++ ) {\r
-      if (compile_instruction (&program->Base.Instructions[i],\r
-                              &fullinst,\r
-                              inputs_read,\r
-                              TGSI_PROCESSOR_FRAGMENT)) {\r
-        assert (i == program->Base.NumInstructions - 1);\r
-        tgsi_dump (tokens, TGSI_DUMP_NO_IGNORED | TGSI_DUMP_NO_DEFAULT);\r
-        break;\r
+      if( compile_instruction(\r
+            &program->Base.Instructions[i],\r
+            &fullinst,\r
+            inputs_read,\r
+            TGSI_PROCESSOR_FRAGMENT ) ) {\r
+         assert( i == program->Base.NumInstructions - 1 );\r
+         tgsi_dump(\r
+            tokens,\r
+            TGSI_DUMP_NO_IGNORED | TGSI_DUMP_NO_DEFAULT );\r
+         break;\r
       }\r
 \r
-      ti += tgsi_build_full_instruction (&fullinst,\r
-                                        &tokens[ti],\r
-                                        header,\r
-                                        max_token_count - ti);\r
+      ti += tgsi_build_full_instruction(\r
+         &fullinst,\r
+         &tokens[ti],\r
+         header,\r
+         maxTokens - ti );\r
    }\r
 \r
    return GL_TRUE;\r
 }\r
 \r
 GLboolean\r
-tgsi_compile_vp_program( const struct gl_vertex_program *program,\r
-                        struct tgsi_token *tokens,\r
-                        GLuint max_token_count,\r
-                        GLuint *token_count )\r
+tgsi_compile_vp_program(\r
+   const struct gl_vertex_program *program,\r
+   struct tgsi_token *tokens,\r
+   GLuint maxTokens )\r
 {\r
    GLuint ii, ti;\r
    struct tgsi_header *header;\r
@@ -468,30 +489,32 @@ tgsi_compile_vp_program( const struct gl_vertex_program *program,
    struct tgsi_full_instruction fullinst;\r
    GLuint inputs_read = ~0;\r
 \r
-   *(struct tgsi_version *) &tokens[0] = tgsi_build_version ();\r
+   *(struct tgsi_version *) &tokens[0] = tgsi_build_version();\r
 \r
    header = (struct tgsi_header *) &tokens[1];\r
-   *header = tgsi_build_header ();\r
+   *header = tgsi_build_header();\r
 \r
    processor = (struct tgsi_processor *) &tokens[2];\r
-   *processor = tgsi_build_processor (TGSI_PROCESSOR_VERTEX, header);\r
+   *processor = tgsi_build_processor( TGSI_PROCESSOR_VERTEX, header );\r
 \r
    ti = 3;\r
 \r
-   for (ii = 0; ii < program->Base.NumInstructions; ii++) {\r
-      if (compile_instruction (&program->Base.Instructions[ii],\r
-                              &fullinst,\r
-                              inputs_read,\r
-                              TGSI_PROCESSOR_VERTEX)) {\r
-        assert (ii == program->Base.NumInstructions - 1);\r
-        tgsi_dump (tokens, TGSI_DUMP_NO_IGNORED | TGSI_DUMP_NO_DEFAULT);\r
-        break;\r
+   for( ii = 0; ii < program->Base.NumInstructions; ii++ ) {\r
+      if( compile_instruction(\r
+            &program->Base.Instructions[ii],\r
+            &fullinst,\r
+            inputs_read,\r
+            TGSI_PROCESSOR_VERTEX ) ) {\r
+         assert( ii == program->Base.NumInstructions - 1 );\r
+         tgsi_dump( tokens, TGSI_DUMP_NO_IGNORED | TGSI_DUMP_NO_DEFAULT );\r
+         break;\r
       }\r
 \r
-      ti += tgsi_build_full_instruction (&fullinst,\r
-                                        &tokens[ti],\r
-                                        header,\r
-                                        max_token_count - ti);\r
+      ti += tgsi_build_full_instruction(\r
+         &fullinst,\r
+         &tokens[ti],\r
+         header,\r
+         maxTokens - ti );\r
    }\r
 \r
    return GL_TRUE;\r