summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/i915/i915_fpc.h
diff options
context:
space:
mode:
authorStéphane Marchesin <[email protected]>2011-07-04 20:21:37 -0700
committerStéphane Marchesin <[email protected]>2011-07-06 02:49:48 -0700
commit2bc5e0e97ba7b6c32f6ff90cb90448173d74b89b (patch)
tree8421bf310dfd85869d0f63c950957099a3b7f9b9 /src/gallium/drivers/i915/i915_fpc.h
parentcc78eb63cdc0022684ca6816f258ea4492431916 (diff)
i915g: introduce the tiny shader optimizer.
Diffstat (limited to 'src/gallium/drivers/i915/i915_fpc.h')
-rw-r--r--src/gallium/drivers/i915/i915_fpc.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/gallium/drivers/i915/i915_fpc.h b/src/gallium/drivers/i915/i915_fpc.h
index 509395cf1f5..b760bc461a1 100644
--- a/src/gallium/drivers/i915/i915_fpc.h
+++ b/src/gallium/drivers/i915/i915_fpc.h
@@ -33,7 +33,9 @@
#include "i915_context.h"
#include "i915_reg.h"
+#include "pipe/p_shader_tokens.h"
+#include "tgsi/tgsi_parse.h"
#define I915_PROGRAM_SIZE 192
@@ -207,4 +209,90 @@ extern void
i915_program_error(struct i915_fp_compile *p, const char *msg, ...);
+/*======================================================================
+ * i915_fpc_optimize.c
+ */
+
+
+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_src_register Indirect;
+ struct tgsi_dimension Dimension;
+ struct tgsi_src_register DimIndirect;
+*/
+};
+
+struct i915_full_src_register
+{
+ struct i915_src_register Register;
+/*
+ struct tgsi_src_register Indirect;
+ struct tgsi_dimension Dimension;
+ struct tgsi_src_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);
+
#endif