softpipe: add indirect store buffer/image unit
[mesa.git] / src / gallium / auxiliary / tgsi / tgsi_build.c
index 55e4d064edcc43dabdeb48f1b339473e50932d79..3db117ac3db94e4a9e47b2e5f946632cef9a0db7 100644 (file)
@@ -163,6 +163,16 @@ tgsi_default_declaration_range( void )
    return dr;
 }
 
+static struct tgsi_declaration_dimension
+tgsi_default_declaration_dimension()
+{
+   struct tgsi_declaration_dimension dim;
+
+   dim.Index2D = 0;
+
+   return dim;
+}
+
 static struct tgsi_declaration_range
 tgsi_build_declaration_range(
    unsigned first,
@@ -381,6 +391,7 @@ tgsi_default_full_declaration( void )
 
    full_declaration.Declaration  = tgsi_default_declaration();
    full_declaration.Range = tgsi_default_declaration_range();
+   full_declaration.Dim = tgsi_default_declaration_dimension();
    full_declaration.Semantic = tgsi_default_declaration_semantic();
    full_declaration.Interp = tgsi_default_declaration_interp();
    full_declaration.Image = tgsi_default_declaration_image();
@@ -596,7 +607,8 @@ tgsi_build_full_immediate(
    struct tgsi_header *header,
    unsigned maxsize )
 {
-   unsigned size = 0, i;
+   unsigned size = 0;
+   int i;
    struct tgsi_immediate *immediate;
 
    if( maxsize <= size )
@@ -649,8 +661,9 @@ tgsi_default_instruction( void )
 }
 
 static struct tgsi_instruction
-tgsi_build_instruction(unsigned opcode,
+tgsi_build_instruction(enum tgsi_opcode opcode,
                        unsigned saturate,
+                       unsigned precise,
                        unsigned num_dst_regs,
                        unsigned num_src_regs,
                        struct tgsi_header *header)
@@ -665,6 +678,7 @@ tgsi_build_instruction(unsigned opcode,
    instruction = tgsi_default_instruction();
    instruction.Opcode = opcode;
    instruction.Saturate = saturate;
+   instruction.Precise = precise;
    instruction.NumDstRegs = num_dst_regs;
    instruction.NumSrcRegs = num_src_regs;
 
@@ -699,7 +713,6 @@ tgsi_default_instruction_label( void )
 static struct tgsi_instruction_label
 tgsi_build_instruction_label(
    unsigned label,
-   struct tgsi_token  *prev_token,
    struct tgsi_instruction *instruction,
    struct tgsi_header *header )
 {
@@ -732,7 +745,6 @@ tgsi_build_instruction_texture(
    unsigned texture,
    unsigned num_offsets,
    unsigned return_type,
-   struct tgsi_token *prev_token,
    struct tgsi_instruction *instruction,
    struct tgsi_header *header )
 {
@@ -767,7 +779,6 @@ tgsi_build_instruction_memory(
    unsigned qualifier,
    unsigned texture,
    unsigned format,
-   struct tgsi_token *prev_token,
    struct tgsi_instruction *instruction,
    struct tgsi_header *header )
 {
@@ -802,7 +813,6 @@ tgsi_default_texture_offset( void )
 static struct tgsi_texture_offset
 tgsi_build_texture_offset(
    int index, int file, int swizzle_x, int swizzle_y, int swizzle_z,
-   struct tgsi_token *prev_token,
    struct tgsi_instruction *instruction,
    struct tgsi_header *header )
 {
@@ -1052,7 +1062,6 @@ tgsi_build_full_instruction(
    unsigned size = 0;
    unsigned i;
    struct tgsi_instruction *instruction;
-   struct tgsi_token *prev_token;
 
    if( maxsize <= size )
       return 0;
@@ -1061,10 +1070,10 @@ tgsi_build_full_instruction(
 
    *instruction = tgsi_build_instruction(full_inst->Instruction.Opcode,
                                          full_inst->Instruction.Saturate,
+                                         full_inst->Instruction.Precise,
                                          full_inst->Instruction.NumDstRegs,
                                          full_inst->Instruction.NumSrcRegs,
                                          header);
-   prev_token = (struct tgsi_token  *) instruction;
 
    if (full_inst->Instruction.Label) {
       struct tgsi_instruction_label *instruction_label;
@@ -1077,10 +1086,8 @@ tgsi_build_full_instruction(
 
       *instruction_label = tgsi_build_instruction_label(
          full_inst->Label.Label,
-         prev_token,
          instruction,
-         header );
-      prev_token = (struct tgsi_token  *) instruction_label;
+        header );
    }
 
    if (full_inst->Instruction.Texture) {
@@ -1096,10 +1103,8 @@ tgsi_build_full_instruction(
          full_inst->Texture.Texture,
          full_inst->Texture.NumOffsets,
          full_inst->Texture.ReturnType,
-         prev_token,
          instruction,
          header   );
-      prev_token = (struct tgsi_token  *) instruction_texture;
 
       for (i = 0; i < full_inst->Texture.NumOffsets; i++) {
          struct tgsi_texture_offset *texture_offset;
@@ -1114,10 +1119,8 @@ tgsi_build_full_instruction(
             full_inst->TexOffsets[i].SwizzleX,
             full_inst->TexOffsets[i].SwizzleY,
             full_inst->TexOffsets[i].SwizzleZ,
-            prev_token,
             instruction,
             header);
-         prev_token = (struct tgsi_token *) texture_offset;
       }
    }
 
@@ -1134,10 +1137,8 @@ tgsi_build_full_instruction(
          full_inst->Memory.Qualifier,
          full_inst->Memory.Texture,
          full_inst->Memory.Format,
-         prev_token,
          instruction,
          header );
-      prev_token = (struct tgsi_token  *) instruction_memory;
    }
 
    for( i = 0;  i <   full_inst->Instruction.NumDstRegs; i++ ) {
@@ -1362,7 +1363,8 @@ tgsi_build_full_property(
    struct tgsi_header *header,
    unsigned maxsize )
 {
-   unsigned size = 0, i;
+   unsigned size = 0;
+   int i;
    struct tgsi_property *property;
 
    if( maxsize <= size )