[Mesa-dev] [PATCH] i965/fs: Initialize output_components[] by filling it with zeros.

Paul Berry stereotype441 at gmail.com
Wed Aug 29 10:04:15 PDT 2012


On 29 August 2012 02:30, Kenneth Graunke <kenneth at whitecape.org> wrote:

> 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 at whitecape.org>
>

Reviewed-by: Paul Berry <stereotype441 at gmail.com>


> ---
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> index e8f64b2..d3cbde3 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> @@ -2277,6 +2277,7 @@ fs_visitor::fs_visitor(struct brw_wm_compile *c,
> struct gl_shader_program *prog,
>
>     this->frag_depth = NULL;
>     memset(this->outputs, 0, sizeof(this->outputs));
> +   memset(this->output_components, 0, sizeof(this->output_components));
>     this->first_non_payload_grf = 0;
>     this->max_grf = intel->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF;
>
> --
> 1.7.11.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120829/a4424fe1/attachment.html>


More information about the mesa-dev mailing list