aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-05-02 06:49:56 +0000
committermarha <marha@users.sourceforge.net>2011-05-02 06:49:56 +0000
commite8af1ef3142aaaf2d17f2d3710e23eee1baf8a61 (patch)
tree115901d752ba4f277ef82564bad209082f1feb2e /mesalib/src/mesa/program
parente4dd9264ee8d4a20eef0eec8c8bf8cff2473b46f (diff)
parent34f1ddbb272a5ad55f56d54e2f861da6360db04f (diff)
downloadvcxsrv-e8af1ef3142aaaf2d17f2d3710e23eee1baf8a61.tar.gz
vcxsrv-e8af1ef3142aaaf2d17f2d3710e23eee1baf8a61.tar.bz2
vcxsrv-e8af1ef3142aaaf2d17f2d3710e23eee1baf8a61.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp5
-rw-r--r--mesalib/src/mesa/program/register_allocate.c28
-rw-r--r--mesalib/src/mesa/program/register_allocate.h1
3 files changed, 27 insertions, 7 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index f6b4ddfb6..8dae7bb23 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -1481,7 +1481,6 @@ ir_to_mesa_visitor::visit(ir_dereference_array *ir)
if (index) {
src.index += index->value.i[0] * element_size;
} else {
- src_reg array_base = this->result;
/* Variable index array dereference. It eats the "vec4" of the
* base of the array and an index that offsets the Mesa register
* index.
@@ -2163,7 +2162,7 @@ ir_to_mesa_visitor::visit(ir_discard *ir)
void
ir_to_mesa_visitor::visit(ir_if *ir)
{
- ir_to_mesa_instruction *cond_inst, *if_inst, *else_inst = NULL;
+ ir_to_mesa_instruction *cond_inst, *if_inst;
ir_to_mesa_instruction *prev_inst;
prev_inst = (ir_to_mesa_instruction *)this->instructions.get_tail();
@@ -2195,7 +2194,7 @@ ir_to_mesa_visitor::visit(ir_if *ir)
visit_exec_list(&ir->then_instructions, this);
if (!ir->else_instructions.is_empty()) {
- else_inst = emit(ir->condition, OPCODE_ELSE);
+ emit(ir->condition, OPCODE_ELSE);
visit_exec_list(&ir->else_instructions, this);
}
diff --git a/mesalib/src/mesa/program/register_allocate.c b/mesalib/src/mesa/program/register_allocate.c
index e78db24a4..095d53796 100644
--- a/mesalib/src/mesa/program/register_allocate.c
+++ b/mesalib/src/mesa/program/register_allocate.c
@@ -77,6 +77,8 @@
#include "main/mtypes.h"
#include "register_allocate.h"
+#define NO_REG ~0
+
struct ra_reg {
GLboolean *conflicts;
unsigned int *conflict_list;
@@ -123,7 +125,7 @@ struct ra_node {
unsigned int class;
- /* Register, if assigned, or ~0. */
+ /* Register, if assigned, or NO_REG. */
unsigned int reg;
/**
@@ -289,7 +291,7 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned int count)
g->nodes[i].adjacency_list = ralloc_array(g, unsigned int, count);
g->nodes[i].adjacency_count = 0;
ra_add_node_adjacency(g, i, i);
- g->nodes[i].reg = ~0;
+ g->nodes[i].reg = NO_REG;
}
return g;
@@ -349,7 +351,7 @@ ra_simplify(struct ra_graph *g)
progress = GL_FALSE;
for (i = g->count - 1; i >= 0; i--) {
- if (g->nodes[i].in_stack)
+ if (g->nodes[i].in_stack || g->nodes[i].reg != NO_REG)
continue;
if (pq_test(g, i)) {
@@ -429,7 +431,7 @@ ra_optimistic_color(struct ra_graph *g)
unsigned int i;
for (i = 0; i < g->count; i++) {
- if (g->nodes[i].in_stack)
+ if (g->nodes[i].in_stack || g->nodes[i].reg != NO_REG)
continue;
g->stack[g->stack_count] = i;
@@ -453,6 +455,24 @@ ra_get_node_reg(struct ra_graph *g, unsigned int n)
return g->nodes[n].reg;
}
+/**
+ * Forces a node to a specific register. This can be used to avoid
+ * creating a register class containing one node when handling data
+ * that must live in a fixed location and is known to not conflict
+ * with other forced register assignment (as is common with shader
+ * input data). These nodes do not end up in the stack during
+ * ra_simplify(), and thus at ra_select() time it is as if they were
+ * the first popped off the stack and assigned their fixed locations.
+ *
+ * Must be called before ra_simplify().
+ */
+void
+ra_set_node_reg(struct ra_graph *g, unsigned int n, unsigned int reg)
+{
+ g->nodes[n].reg = reg;
+ g->nodes[n].in_stack = GL_FALSE;
+}
+
static float
ra_get_spill_benefit(struct ra_graph *g, unsigned int n)
{
diff --git a/mesalib/src/mesa/program/register_allocate.h b/mesalib/src/mesa/program/register_allocate.h
index bb9e2740a..1345debd0 100644
--- a/mesalib/src/mesa/program/register_allocate.h
+++ b/mesalib/src/mesa/program/register_allocate.h
@@ -65,6 +65,7 @@ GLboolean ra_select(struct ra_graph *g);
GLboolean ra_allocate_no_spills(struct ra_graph *g);
unsigned int ra_get_node_reg(struct ra_graph *g, unsigned int n);
+void ra_set_node_reg(struct ra_graph * g, unsigned int n, unsigned int reg);
void ra_set_node_spill_cost(struct ra_graph *g, unsigned int n, float cost);
int ra_get_best_spill_node(struct ra_graph *g);
/** @} */