summaryrefslogtreecommitdiff
path: root/src/glsl/apps/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/apps/compile.c')
-rw-r--r--src/glsl/apps/compile.c55
1 files changed, 6 insertions, 49 deletions
diff --git a/src/glsl/apps/compile.c b/src/glsl/apps/compile.c
index b1165420fb..c9a830b9f3 100644
--- a/src/glsl/apps/compile.c
+++ b/src/glsl/apps/compile.c
@@ -50,12 +50,8 @@ main(int argc,
struct sl_pp_purify_options options;
char errmsg[100] = "";
struct sl_pp_context *context;
- struct sl_pp_token_info *tokens;
unsigned int version;
- unsigned int tokens_eaten;
- struct sl_pp_token_info *outtokens;
FILE *out;
- unsigned int i, j;
unsigned char *outbytes;
unsigned int cboutbytes;
unsigned int shader_type;
@@ -118,7 +114,7 @@ main(int argc,
memset(&options, 0, sizeof(options));
- context = sl_pp_context_create();
+ context = sl_pp_context_create(inbuf, &options);
if (!context) {
fprintf(out, "$CONTEXERROR\n");
@@ -128,24 +124,12 @@ main(int argc,
return 0;
}
- if (sl_pp_tokenise(context, inbuf, &options, &tokens)) {
- fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
-
- printf("Error: %s.\n", sl_pp_context_error_message(context));
- sl_pp_context_destroy(context);
- free(inbuf);
- fclose(out);
- return 0;
- }
-
- free(inbuf);
-
- if (sl_pp_version(context, tokens, &version, &tokens_eaten)) {
+ if (sl_pp_version(context, &version)) {
fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
printf("Error: %s\n", sl_pp_context_error_message(context));
sl_pp_context_destroy(context);
- free(tokens);
+ free(inbuf);
fclose(out);
return 0;
}
@@ -156,39 +140,12 @@ main(int argc,
printf("Error: %s\n", sl_pp_context_error_message(context));
sl_pp_context_destroy(context);
- free(tokens);
- fclose(out);
- return 0;
- }
-
- if (sl_pp_process(context, &tokens[tokens_eaten], &outtokens)) {
- fprintf(out, "$ERROR: `%s'\n", sl_pp_context_error_message(context));
-
- printf("Error: %s\n", sl_pp_context_error_message(context));
- sl_pp_context_destroy(context);
- free(tokens);
+ free(inbuf);
fclose(out);
return 0;
}
- free(tokens);
-
- for (i = j = 0; outtokens[i].token != SL_PP_EOF; i++) {
- switch (outtokens[i].token) {
- case SL_PP_NEWLINE:
- case SL_PP_EXTENSION_REQUIRE:
- case SL_PP_EXTENSION_ENABLE:
- case SL_PP_EXTENSION_WARN:
- case SL_PP_EXTENSION_DISABLE:
- case SL_PP_LINE:
- break;
- default:
- outtokens[j++] = outtokens[i];
- }
- }
- outtokens[j] = outtokens[i];
-
- if (sl_cl_compile(context, outtokens, shader_type, 1, &outbytes, &cboutbytes, errmsg, sizeof(errmsg)) == 0) {
+ if (sl_cl_compile(context, shader_type, 1, &outbytes, &cboutbytes, errmsg, sizeof(errmsg)) == 0) {
unsigned int i;
unsigned int line = 0;
@@ -228,7 +185,7 @@ main(int argc,
}
sl_pp_context_destroy(context);
- free(outtokens);
+ free(inbuf);
fclose(out);
return 0;
}