summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2010-04-08 16:48:41 +1000
committerDave Airlie <[email protected]>2010-04-08 16:48:41 +1000
commitdff50ff592da7cb1d784fae794dd1647a5445bca (patch)
treecd1b29e4001b8afdfff2520a01fcfba6b8b250e9 /src/mesa/main
parent968bf9634ec03e61441834603f13f0c914bbb0ce (diff)
parent4b39a0da89f5b07d4a24bc9ce52693e6c2acfe99 (diff)
Merge remote branch 'origin/7.8'
Conflicts: Makefile configs/default src/mesa/main/version.h
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/state.c5
-rw-r--r--src/mesa/main/texenvprogram.c43
2 files changed, 30 insertions, 18 deletions
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 589029db58b..b971cc976ee 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -582,9 +582,6 @@ _mesa_update_state_locked( GLcontext *ctx )
if (new_state & _DD_NEW_SEPARATE_SPECULAR)
update_separate_specular( ctx );
- if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT))
- update_arrays( ctx );
-
if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
update_viewport_matrix(ctx);
@@ -620,6 +617,8 @@ _mesa_update_state_locked( GLcontext *ctx )
new_prog_state |= update_program( ctx );
}
+ if (new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT))
+ update_arrays( ctx );
out:
new_prog_state |= update_program_constants(ctx);
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 7b8a8b85f22..964ba13c700 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -1415,6 +1415,7 @@ create_new_program(GLcontext *ctx, struct state_key *key,
struct texenv_fragment_program p;
GLuint unit;
struct ureg cf, out;
+ int i;
memset(&p, 0, sizeof(p));
p.state = key;
@@ -1436,7 +1437,13 @@ create_new_program(GLcontext *ctx, struct state_key *key,
p.program->Base.NumAddressRegs = 0;
p.program->Base.Parameters = _mesa_new_parameter_list();
p.program->Base.InputsRead = 0x0;
- p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
+
+ if (ctx->DrawBuffer->_NumColorDrawBuffers == 1)
+ p.program->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR;
+ else {
+ for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++)
+ p.program->Base.OutputsWritten |= (1 << (FRAG_RESULT_DATA0 + i));
+ }
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
p.src_texture[unit] = undef;
@@ -1485,22 +1492,28 @@ create_new_program(GLcontext *ctx, struct state_key *key,
}
cf = get_source( &p, SRC_PREVIOUS, 0 );
- out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
- if (key->separate_specular) {
- /* Emit specular add.
- */
- struct ureg s = register_input(&p, FRAG_ATTRIB_COL1);
- emit_arith( &p, OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef );
- emit_arith( &p, OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef );
- }
- else if (memcmp(&cf, &out, sizeof(cf)) != 0) {
- /* Will wind up in here if no texture enabled or a couple of
- * other scenarios (GL_REPLACE for instance).
- */
- emit_arith( &p, OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef );
- }
+ for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
+ if (ctx->DrawBuffer->_NumColorDrawBuffers == 1)
+ out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_COLOR );
+ else {
+ out = make_ureg( PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i );
+ }
+ if (key->separate_specular) {
+ /* Emit specular add.
+ */
+ struct ureg s = register_input(&p, FRAG_ATTRIB_COL1);
+ emit_arith( &p, OPCODE_ADD, out, WRITEMASK_XYZ, 0, cf, s, undef );
+ emit_arith( &p, OPCODE_MOV, out, WRITEMASK_W, 0, cf, undef, undef );
+ }
+ else if (memcmp(&cf, &out, sizeof(cf)) != 0) {
+ /* Will wind up in here if no texture enabled or a couple of
+ * other scenarios (GL_REPLACE for instance).
+ */
+ emit_arith( &p, OPCODE_MOV, out, WRITEMASK_XYZW, 0, cf, undef, undef );
+ }
+ }
/* Finish up:
*/
emit_arith( &p, OPCODE_END, undef, WRITEMASK_XYZW, 0, undef, undef, undef);