summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/radeon_program.h
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2008-06-14 01:46:19 +0200
committerNicolai Haehnle <nhaehnle@gmail.com>2008-06-14 04:14:56 +0200
commite34dc8227c1fa8bc9ffcd311de701053a633a7ec (patch)
treec4337d9c41714bd771199cf3d061967e7dc28ca4 /src/mesa/drivers/dri/r300/radeon_program.h
parentb5170bc9d32530ec93dae4b543d3552e83d6b4a1 (diff)
r300_fragprog: Refactor TEX transformation
Streamlining source and destination registers, as well as texcoord scaling for RECT textures is now done in a radeon_program based transformation. The idea is that this will allow us to optimize away unnecessary indirections more easily.
Diffstat (limited to 'src/mesa/drivers/dri/r300/radeon_program.h')
-rw-r--r--src/mesa/drivers/dri/r300/radeon_program.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_program.h b/src/mesa/drivers/dri/r300/radeon_program.h
index 18091ac02a..3cde4d4f6f 100644
--- a/src/mesa/drivers/dri/r300/radeon_program.h
+++ b/src/mesa/drivers/dri/r300/radeon_program.h
@@ -41,6 +41,13 @@ enum {
CLAUSE_TEX
};
+enum {
+ PROGRAM_BUILTIN = PROGRAM_FILE_MAX /**< not a real register, but a special swizzle constant */
+};
+
+#define SWIZZLE_0000 MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO)
+#define SWIZZLE_1111 MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE)
+
/**
* A clause is simply a sequence of instructions that are executed
* in order.
@@ -107,4 +114,50 @@ void radeonCompilerEraseClauses(
int start,
int end);
+struct prog_instruction* radeonClauseInsertInstructions(
+ struct radeon_compiler *compiler,
+ struct radeon_clause *clause,
+ int position, int count);
+
+/**
+ *
+ */
+struct radeon_program_transform_context {
+ struct radeon_compiler *compiler;
+
+ /**
+ * Destination clause where new instructions must be written.
+ */
+ struct radeon_clause *dest;
+
+ /**
+ * Original clause that is currently being transformed.
+ */
+ struct radeon_clause *src;
+};
+
+/**
+ * A transformation that can be passed to \ref radeonClauseLinearTransform.
+ *
+ * The function will be called once for each instruction.
+ * It has to either emit the appropriate transformed code for the instruction
+ * and return GL_TRUE, or return GL_FALSE if it doesn't understand the
+ * instruction.
+ *
+ * The function gets passed the userData as last parameter.
+ */
+struct radeon_program_transformation {
+ GLboolean (*function)(
+ struct radeon_program_transform_context*,
+ struct prog_instruction*,
+ void*);
+ void *userData;
+};
+
+void radeonClauseLocalTransform(
+ struct radeon_compiler *compiler,
+ struct radeon_clause *clause,
+ int num_transformations,
+ struct radeon_program_transformation* transformations);
+
#endif