summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-02-08 21:50:33 -0500
committerZack Rusin <zackr@vmware.com>2010-02-08 21:50:33 -0500
commit85c7ec70ad41c8ada75a4cbace83d16815d3e2c5 (patch)
tree7154254e4d6c26e27e410524f814a52329ff46d3 /src/gallium/drivers
parent257267ee9817d67e6963e81766a121c367478f65 (diff)
llvmpipe: switch to using dynamic stack allocation instead of registers
with mutable vars we don't need to follow the phi nodes. meaning that control flow becomes trivial as we don't have scan the rest of the tgsi to figure out the variable usage anymore. futhermore the memory2register pass promotes alloca/store/load to registers while inserting the right phi nodes. so we get simplicity and performance.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 320e2b72e4..2001a95661 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -468,20 +468,21 @@ generate_fs(struct llvmpipe_context *lp,
for (attrib = 0; attrib < shader->info.num_outputs; ++attrib) {
for(chan = 0; chan < NUM_CHANNELS; ++chan) {
if(outputs[attrib][chan]) {
- lp_build_name(outputs[attrib][chan], "output%u.%u.%c", i, attrib, "xyzw"[chan]);
+ LLVMValueRef out = LLVMBuildLoad(builder, outputs[attrib][chan], "");
+ lp_build_name(out, "output%u.%u.%c", i, attrib, "xyzw"[chan]);
switch (shader->info.output_semantic_name[attrib]) {
case TGSI_SEMANTIC_COLOR:
{
unsigned cbuf = shader->info.output_semantic_index[attrib];
- lp_build_name(outputs[attrib][chan], "color%u.%u.%c", i, attrib, "rgba"[chan]);
+ lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
/* Alpha test */
/* XXX: should the alpha reference value be passed separately? */
/* XXX: should only test the final assignment to alpha */
if(cbuf == 0 && chan == 3) {
- LLVMValueRef alpha = outputs[attrib][chan];
+ LLVMValueRef alpha = out;
LLVMValueRef alpha_ref_value;
alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr);
alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value);
@@ -489,13 +490,13 @@ generate_fs(struct llvmpipe_context *lp,
&mask, alpha, alpha_ref_value);
}
- color[cbuf][chan] = outputs[attrib][chan];
+ color[cbuf][chan] = out;
break;
}
case TGSI_SEMANTIC_POSITION:
if(chan == 2)
- z = outputs[attrib][chan];
+ z = out;
break;
}
}