summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/r300_context.h
diff options
context:
space:
mode:
authorAapo Tahkola <aet@rasterburn.org>2006-01-09 22:53:38 +0000
committerAapo Tahkola <aet@rasterburn.org>2006-01-09 22:53:38 +0000
commit2d4ff6a8cf83ca3a829021482b08b95bea7aa31a (patch)
tree38917d4645330e519ffa0a3cacfcf2a6f90fe280 /src/mesa/drivers/dri/r300/r300_context.h
parentc217d5a3a84cd55456e3312873933db80ba00d67 (diff)
Missing patch from Ben Skeggs:
Lots of changes, and fixes for some badness on my behalf. 1. Disposable data used during fp compile is now per-context, rather than per-program to save memory. 2. Track usage of INPUT/TEMP registers from Mesa program, free them when no longer required so the hw temps can be re-used. 3. Changed LAST_NODE to OUTPUT_COLOR (see r300_reg.h) 4. Implemented remaining ARB_f_p instructions, with the exception of the trig/LIT opcodes. 5. Treat ZERO/ONE swizzles the same way as other native swizzles. 6. emit_arith changes, basically a complete re-write. Should produce cleaner instructions, but no real functional changes. internal reg -> hw reg routines shared with emit_tex. A bit messy still.
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_context.h')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h47
1 files changed, 37 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index 8eaff49ae3..bfa48d07c8 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -85,7 +85,6 @@ typedef struct r300_context *r300ContextPtr;
typedef GLuint uint32_t;
typedef GLubyte uint8_t;
-struct r300_fragment_program;
/* We should probably change types within vertex_shader
and pixel_shader structure later on */
@@ -613,12 +612,46 @@ struct r300_vertex_program {
#define PFS_MAX_TEX_INDIRECT 4
#define PFS_NUM_TEMP_REGS 32
#define PFS_NUM_CONST_REGS 32
+
+/* Tracking data for Mesa registers */
+struct reg_acc {
+ int reg; /* Assigned hw temp */
+ unsigned int refcount; /* Number of uses by mesa program */
+};
+
+struct r300_pfs_compile_state {
+ int v_pos, s_pos; /* highest ALU slots used */
+
+ /* Track some information gathered during opcode
+ * construction.
+ *
+ * NOTE: Data is only set by the code, and isn't used yet.
+ */
+ struct {
+ int vsrc[3];
+ int ssrc[3];
+ int umask;
+ } slot[PFS_MAX_ALU_INST];
+
+ /* Used to map Mesa's inputs/temps onto hardware temps */
+ int temp_in_use;
+ struct reg_acc temps[PFS_NUM_TEMP_REGS];
+ struct reg_acc inputs[32]; /* don't actually need 32... */
+
+ /* Track usage of hardware temps, for register allocation,
+ * indirection detection, etc. */
+ int hwreg_in_use;
+ GLuint used_in_node;
+ GLuint dest_in_node;
+};
+
struct r300_fragment_program {
struct fragment_program mesa_program;
GLcontext *ctx;
GLboolean translated;
GLboolean error;
+ struct r300_pfs_compile_state *cs;
struct {
int length;
@@ -633,14 +666,13 @@ struct r300_fragment_program {
GLuint inst3;
} inst[PFS_MAX_ALU_INST];
} alu;
- int v_pos;
- int s_pos;
struct {
int tex_offset;
int tex_end;
int alu_offset;
int alu_end;
+ int flags;
} node[4];
int cur_node;
int first_node_has_tex;
@@ -661,14 +693,7 @@ struct r300_fragment_program {
} param[PFS_NUM_CONST_REGS];
int param_nr;
GLboolean params_uptodate;
-
- GLuint temps[PFS_NUM_TEMP_REGS];
- int temp_in_use;
- GLuint used_in_node;
- GLuint dest_in_node;
- GLuint inputs[32]; /* don't actually need 32... */
- int hwreg_in_use;
int max_temp_idx;
};
@@ -794,6 +819,8 @@ struct r300_state {
struct r300_vertex_shader_state vertex_shader;
#if USE_ARB_F_P == 0
struct r300_pixel_shader_state pixel_shader;
+#else
+ struct r300_pfs_compile_state pfs_compile;
#endif
struct r300_dma_region aos[R300_MAX_AOS_ARRAYS];
int aos_count;