Module: Mesa Branch: master Commit: 84f58a08634d0ea07f557ffa5b91c9c8777a2b04 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=84f58a08634d0ea07f557ffa5b91c9c8777a2b04
Author: Pierre-Eric Pelloux-Prayer <[email protected]> Date: Fri Apr 24 12:17:14 2020 +0200 glsl: init gl_FragColor if zero_init=true This fixes shaders doing "gl_FragColor += ..." and doesn't hurt correct shaders, because the zero init is discarded. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607> --- src/compiler/glsl/ast_to_hir.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 630d807e114..9cd3af83a48 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -8797,8 +8797,14 @@ detect_conflicting_assignments(struct _mesa_glsl_parse_state *state, if (!var || !var->data.assigned) continue; - if (strcmp(var->name, "gl_FragColor") == 0) + if (strcmp(var->name, "gl_FragColor") == 0) { gl_FragColor_assigned = true; + if (!var->constant_initializer && state->zero_init) { + const ir_constant_data data = { { 0 } }; + var->data.has_initializer = true; + var->constant_initializer = new(var) ir_constant(var->type, &data); + } + } else if (strcmp(var->name, "gl_FragData") == 0) gl_FragData_assigned = true; else if (strcmp(var->name, "gl_SecondaryFragColorEXT") == 0) _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
