diff options
| author | Ian Romanick <ian.d.romanick@intel.com> | 2010-06-07 18:53:06 -0700 | 
|---|---|---|
| committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-06-07 18:53:06 -0700 | 
| commit | 15d162d7b1ebe09b0bdaf43194529f9ef995c623 (patch) | |
| tree | 47f860e36c543b053726ac6f2ef4aa9bbfa64a43 | |
| parent | 6cd2a5cc4b8eb1d445f2ae5311db8fda9d46b7a1 (diff) | |
Don't process empty shaders
Some valid shaders, such as 'precision highp float;', evaluate to
empty sets of instructions.  This causes some of the optimization
stages to enter infinite loops.  Instead, don't bother processing the
empty ones.
| -rw-r--r-- | glsl_parser_extras.cpp | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/glsl_parser_extras.cpp b/glsl_parser_extras.cpp index afce9d9c34..f6b30289ce 100644 --- a/glsl_parser_extras.cpp +++ b/glsl_parser_extras.cpp @@ -737,7 +737,8 @@ main(int argc, char **argv)  	 ast->print();        } -      _mesa_ast_to_hir(&instructions, &state); +      if (!state.translation_unit.is_empty()) +	 _mesa_ast_to_hir(&instructions, &state);     } else {        /* FINISHME: We should initialize this to the max GLSL version supported         * FINISHME: by the driver.  At the moment, we don't know what that is. @@ -748,7 +749,7 @@ main(int argc, char **argv)     }     /* Optimization passes */ -   if (!state.error) { +   if (!state.error && !instructions.is_empty()) {        bool progress;        do {  	 progress = false; | 
