+struct i915_src_register
+{
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned SwizzleX : 3; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleY : 3; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleZ : 3; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleW : 3; /* TGSI_SWIZZLE_ */
+ unsigned Absolute : 1; /* BOOL */
+ unsigned Negate : 1; /* BOOL */
+};
+
+/* Additional swizzle supported in i915 */
+#define TGSI_SWIZZLE_ZERO 4
+#define TGSI_SWIZZLE_ONE 5
+
+struct i915_dst_register
+{
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned Padding : 6;
+};
+
+
+struct i915_full_dst_register
+{
+ struct i915_dst_register Register;
+/*
+ struct tgsi_ind_register Indirect;
+ struct tgsi_dimension Dimension;
+ struct tgsi_ind_register DimIndirect;
+*/
+};
+
+struct i915_full_src_register
+{
+ struct i915_src_register Register;
+/*
+ struct tgsi_ind_register Indirect;
+ struct tgsi_dimension Dimension;
+ struct tgsi_ind_register DimIndirect;
+*/
+};
+
+struct i915_full_instruction
+{
+ struct tgsi_instruction Instruction;
+/*
+ struct tgsi_instruction_predicate Predicate;
+ struct tgsi_instruction_label Label;
+*/
+ struct tgsi_instruction_texture Texture;
+ struct i915_full_dst_register Dst[1];
+ struct i915_full_src_register Src[3];
+};
+
+
+union i915_full_token
+{
+ struct tgsi_token Token;
+ struct tgsi_full_declaration FullDeclaration;
+ struct tgsi_full_immediate FullImmediate;
+ struct i915_full_instruction FullInstruction;
+ struct tgsi_full_property FullProperty;
+};
+
+struct i915_token_list
+{
+ union i915_full_token* Tokens;
+ unsigned NumTokens;
+};
+
+extern struct i915_token_list* i915_optimize(const struct tgsi_token *tokens);
+
+extern void i915_optimize_free(struct i915_token_list *tokens);
+
+extern uint i915_num_coords(uint tex);