From 0d50be1a1ff4264bd48f93b0e85544ace1807c0a Mon Sep 17 00:00:00 2001 From: Chris Wolfe Date: Tue, 7 Aug 2012 18:57:05 -0400 Subject: [PATCH] glsl: Restrict opt_dead_code_local to variable assignment Temporary fix to Chrome OS bug Change-Id: I4ca51603da18e3156f90ed77490902b3f8229f5c --- src/glsl/opt_dead_code_local.cpp | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/src/glsl/opt_dead_code_local.cpp b/src/glsl/opt_dead_code_local.cpp index 4af78a7..0e3a7f4 100644 --- a/src/glsl/opt_dead_code_local.cpp +++ b/src/glsl/opt_dead_code_local.cpp @@ -252,10 +252,20 @@ process_assignment(void *ctx, ir_assignment *ir, exec_list *assignments) } } + if (ir->lhs->as_dereference_variable() == NULL) { + /* HACK: Chrome has encountered bugs when this optimization processes + * array elements in the lhs. For example: + * vec4 tmp; tmp[3] = 1.0; + * is incorrectly recorded as writing to only the (x) element, and will + * be killed if a later statement replaces (x). To sidestep this problem + * temporarily, trim only assignments to bare variables. + */ + return progress; + } + /* Add this instruction to the assignment list available to be removed. */ assignment_entry *entry = new(ctx) assignment_entry(var, ir); assignments->push_tail(entry); - if (debug) { printf("add %s\n", var->name); -- 1.7.7.3