diff options
author | Timothy Arceri <[email protected]> | 2018-10-10 11:03:47 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-10-10 15:08:32 +1100 |
commit | 0346ad37741b11d640c1c4970b275c1f0c7f9e75 (patch) | |
tree | 6e10da82ec0d579dd29d897e73903996d4af7d8c /src/compiler/glsl/glcpp/glcpp-parse.y | |
parent | b44c9292b7e5a24e6b06a197d4e72b43a8799d09 (diff) |
glsl: ignore trailing whitespace when define redefined
The Nvidia/AMD binary drivers allow this, as does GCC.
This fixes shader compilation issues in the latest update of
No Mans Sky.
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/glsl/glcpp/glcpp-parse.y')
-rw-r--r-- | src/compiler/glsl/glcpp/glcpp-parse.y | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y index 4be5cfa3d54..1c095cb66f9 100644 --- a/src/compiler/glsl/glcpp/glcpp-parse.y +++ b/src/compiler/glsl/glcpp/glcpp-parse.y @@ -1077,6 +1077,20 @@ _token_list_equal_ignoring_space(token_list_t *a, token_list_t *b) if (node_a == NULL && node_b == NULL) break; + /* Ignore trailing whitespace */ + if (node_a == NULL && node_b->token->type == SPACE) { + while (node_b && node_b->token->type == SPACE) + node_b = node_b->next; + } + + if (node_b == NULL && node_a->token->type == SPACE) { + while (node_a && node_a->token->type == SPACE) + node_a = node_a->next; + } + + if (node_a == NULL && node_b == NULL) + break; + if (node_a == NULL || node_b == NULL) return 0; /* Make sure whitespace appears in the same places in both. |