summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/compiler/radeon_code.h
diff options
context:
space:
mode:
authorNicolai Hähnle <nhaehnle@gmail.com>2009-07-24 22:41:14 +0200
committerNicolai Hähnle <nhaehnle@gmail.com>2009-07-27 20:32:07 +0200
commit800f48258623f8caf25d013f44784edb7caa3f93 (patch)
treebb187a8b98e920f24762516620587402b6ab2c4b /src/mesa/drivers/dri/r300/compiler/radeon_code.h
parent92f7a599c7e94b0687d02efef1890e1a8ed2f9f3 (diff)
r300: Allow compiler to add constants in a cleaner way
Adding constants is used in a number of non-native instruction rewrites, and it required us to keep copies of modified gl_programs around. This is a first step towards ending this. Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
Diffstat (limited to 'src/mesa/drivers/dri/r300/compiler/radeon_code.h')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_code.h57
1 files changed, 42 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h
index e89e7bc17b..3e6eb97b17 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h
@@ -23,7 +23,6 @@
#ifndef RADEON_CODE_H
#define RADEON_CODE_H
-
#define R300_PFS_MAX_ALU_INST 64
#define R300_PFS_MAX_TEX_INST 32
#define R300_PFS_MAX_TEX_INDIRECT 4
@@ -39,6 +38,44 @@
#define STATE_R300_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1)
+enum {
+ /**
+ * External constants are constants whose meaning is unknown to this
+ * compiler. For example, a Mesa gl_program's constants are turned
+ * into external constants.
+ */
+ RC_CONSTANT_EXTERNAL = 0,
+
+ RC_CONSTANT_IMMEDIATE,
+
+ /**
+ * Constant referring to state that is known by this compiler,
+ * i.e. *not* arbitrary Mesa (or other) state.
+ */
+ RC_CONSTANT_STATE
+};
+
+struct rc_constant {
+ unsigned Type:2; /**< RC_CONSTANT_xxx */
+ union {
+ unsigned External;
+ float Immediate[4];
+ unsigned State[4];
+ } u;
+};
+
+struct rc_constant_list {
+ struct rc_constant * Constants;
+ unsigned Count;
+
+ unsigned _Reserved;
+};
+
+void rc_constants_init(struct rc_constant_list * c);
+void rc_constants_copy(struct rc_constant_list * dst, struct rc_constant_list * src);
+void rc_constants_destroy(struct rc_constant_list * c);
+unsigned rc_constants_add(struct rc_constant_list * c, struct rc_constant * constant);
+
/**
* Stores state that influences the compilation of a fragment program.
*/
@@ -98,13 +135,6 @@ struct r300_fragment_program_code {
int cur_node;
int first_node_has_tex;
- /**
- * Remember which program register a given hardware constant
- * belongs to.
- */
- struct prog_src_register constant[R300_PFS_NUM_CONST_REGS];
- int const_nr;
-
int max_temp_idx;
};
@@ -122,13 +152,6 @@ struct r500_fragment_program_code {
int inst_offset;
int inst_end;
- /**
- * Remember which program register a given hardware constant
- * belongs to.
- */
- struct prog_src_register constant[R500_PFS_NUM_CONST_REGS];
- int const_nr;
-
int max_temp_idx;
};
@@ -140,6 +163,8 @@ struct rX00_fragment_program_code {
GLboolean writes_depth;
+ struct rc_constant_list constants;
+
/* attribute that we are sending the WPOS in */
gl_frag_attrib wpos_attr;
/* attribute that we are sending the fog coordinate in */
@@ -168,6 +193,8 @@ struct r300_vertex_program_code {
int inputs[VERT_ATTRIB_MAX];
int outputs[VERT_RESULT_MAX];
+ struct rc_constant_list constants;
+
GLbitfield InputsRead;
GLbitfield OutputsWritten;
};