i965/fs: Initialize output_components[] by filling it with zeros.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Aug 2012 08:51:17 +0000 (01:51 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 29 Aug 2012 22:10:57 +0000 (15:10 -0700)
commit6928bea7ca1f2ed308d8255c6816f44467306255
tree2b4d9e38cb5ded58a9d980f0e62c8a6dd9c57717
parent42723d88d370a7599398cc1c2349aeb951ba1c57
i965/fs: Initialize output_components[] by filling it with zeros.

Prior to commit 2f1869822, emit_fb_writes() looped from 0 to 3, writing
all four components of a vec4 color output.  However, that broke for
smaller output types (float, vec2, or vec3).  To fix that, I introduced
a new variable (output_components[]) containing the size of the output
type for each render target.

Unfortunately, I forgot to actually initialize it in the constructor,
which meant that unless a shader wrote to gl_FragColor, or the specific
output for each render target, output_components would contain a garbage
value, and we'd loop for a completely non-deterministic amount of time.

Not actually emitting any color writes seems like the right approach.
We may still need to emit a render target write (to terminate the
thread), but don't have to put in any sensible values (the shader didn't
write anything, after all).

Fixes a regression since 2f18698220d8b27991fab550c4721590d17278e0.
NOTE: This is a candidate for stable release branches.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54193
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Ian Romanick <idr@freedesktop.org>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp