summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/shader/slang/slang_preprocess.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/mesa/shader/slang/slang_preprocess.c b/src/mesa/shader/slang/slang_preprocess.c
index 7159db7e1e2..b1f62ded3da 100644
--- a/src/mesa/shader/slang/slang_preprocess.c
+++ b/src/mesa/shader/slang/slang_preprocess.c
@@ -28,9 +28,9 @@
* \author Michal Krol
*/
-#include "imports.h"
-#include "slang_compile.h"
+#include "imports.h"
#include "grammar_mesa.h"
+#include "slang_compile.h"
#include "slang_preprocess.h"
static const char *slang_version_syn =
@@ -66,12 +66,18 @@ int _slang_preprocess_version (const char *text, unsigned int *version, unsigned
grammar_destroy (id);
+ /* there can be multiple #version directives - grab the last one */
I = prod;
while (I < prod + size)
{
- *version = (unsigned int) I[0] + (unsigned int) I[1] * 100;
- *eaten = (unsigned int) I[2] + ((unsigned int) I[3] << 8) +
- ((unsigned int) I[4] << 16) + ((unsigned int) I[5] << 24);
+ *version =
+ (unsigned int) I[0] +
+ (unsigned int) I[1] * 100;
+ *eaten =
+ ((unsigned int) I[2]) +
+ ((unsigned int) I[3] << 8) +
+ ((unsigned int) I[4] << 16) +
+ ((unsigned int) I[5] << 24);
I += 6;
}