summaryrefslogtreecommitdiff
path: root/src/glsl/ir_constant_propagation.cpp
diff options
context:
space:
mode:
authorKeith Whitwell <keithw@vmware.com>2010-10-17 19:03:42 -0700
committerKeith Whitwell <keithw@vmware.com>2010-10-17 19:09:42 -0700
commit0072acd447dc6be652e63752e50215c3105322c8 (patch)
tree847d1763b54772d336a04e606f8248291c3092b7 /src/glsl/ir_constant_propagation.cpp
parent543fb77ddece7e1806e8eaa0d65bb2a945ef9a75 (diff)
parentca2b2ac131933b4171b519813df1aaa3a81621cd (diff)
Merge remote branch 'origin/master' into lp-setup-llvm
Conflicts: src/gallium/drivers/llvmpipe/lp_setup_coef.c src/gallium/drivers/llvmpipe/lp_setup_coef.h src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c src/gallium/drivers/llvmpipe/lp_setup_point.c src/gallium/drivers/llvmpipe/lp_setup_tri.c src/gallium/drivers/llvmpipe/lp_state_derived.c src/gallium/drivers/llvmpipe/lp_state_fs.h
Diffstat (limited to 'src/glsl/ir_constant_propagation.cpp')
-rw-r--r--src/glsl/ir_constant_propagation.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp
index f7a0599f42..5d875b7be0 100644
--- a/src/glsl/ir_constant_propagation.cpp
+++ b/src/glsl/ir_constant_propagation.cpp
@@ -1,5 +1,5 @@
/*
- * Constantright © 2010 Intel Corporation
+ * Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* constant of this software and associated documentation files (the "Software"),
@@ -168,18 +168,26 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue)
if (!found)
return;
+ int rhs_channel = 0;
+ for (int j = 0; j < 4; j++) {
+ if (j == channel)
+ break;
+ if (found->write_mask & (1 << j))
+ rhs_channel++;
+ }
+
switch (type->base_type) {
case GLSL_TYPE_FLOAT:
- data.f[i] = found->constant->value.f[channel];
+ data.f[i] = found->constant->value.f[rhs_channel];
break;
case GLSL_TYPE_INT:
- data.i[i] = found->constant->value.i[channel];
+ data.i[i] = found->constant->value.i[rhs_channel];
break;
case GLSL_TYPE_UINT:
- data.u[i] = found->constant->value.u[channel];
+ data.u[i] = found->constant->value.u[rhs_channel];
break;
case GLSL_TYPE_BOOL:
- data.b[i] = found->constant->value.b[channel];
+ data.b[i] = found->constant->value.b[rhs_channel];
break;
default:
assert(!"not reached");