summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-02-06 09:57:28 -0700
committerBrian Paul <brianp@vmware.com>2009-02-06 09:57:28 -0700
commitb2e779988eeb595187933fe2122d86f8ccfe059c (patch)
tree45ebb6b079b4f7b651f6c14b3f928697981a4218 /src/mesa/shader/slang
parentda795ff0a837eeb8c8f9d44987b374da2d4d2835 (diff)
mesa: meaningless whitespace change to see if git's working (ignore)
Diffstat (limited to 'src/mesa/shader/slang')
-rw-r--r--src/mesa/shader/slang/slang_compile.c18
-rw-r--r--src/mesa/shader/slang/slang_link.c20
-rw-r--r--src/mesa/shader/slang/slang_log.c6
3 files changed, 29 insertions, 15 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 40460e0c7e..0c7881dd19 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -32,6 +32,7 @@
#include "main/context.h"
#include "shader/program.h"
#include "shader/programopt.h"
+#include "shader/prog_optimize.h"
#include "shader/prog_print.h"
#include "shader/prog_parameter.h"
#include "shader/grammar/grammar_mesa.h"
@@ -2794,11 +2795,22 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
_mesa_print_program(shader->Program);
#endif
+ if (success) {
+ if ((ctx->Shader.Flags & GLSL_NO_OPT) == 0) {
+ if ((ctx->Shader.Flags & GLSL_OPT) || shader->Pragmas.Optimize) {
+ /* apply program optimizations */
+ _mesa_remove_extra_moves(shader->Program);
+ _mesa_remove_dead_code(shader->Program);
+ _mesa_consolidate_registers(shader->Program);
+ }
+ }
+ }
+
shader->CompileStatus = success;
-#if 0
- _mesa_write_shader_to_file(shader);
-#endif
+ if (ctx->Shader.Flags & GLSL_LOG) {
+ _mesa_write_shader_to_file(shader);
+ }
return success;
}
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 77bcda0871..4ee1beccd4 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -675,12 +675,12 @@ _slang_link(GLcontext *ctx,
/* notify driver that a new fragment program has been compiled/linked */
ctx->Driver.ProgramStringNotify(ctx, GL_FRAGMENT_PROGRAM_ARB,
&shProg->FragmentProgram->Base);
- if (MESA_VERBOSE & VERBOSE_GLSL_DUMP) {
- printf("Mesa original fragment program:\n");
+ if (ctx->Shader.Flags & GLSL_DUMP) {
+ _mesa_printf("Mesa original fragment program:\n");
_mesa_print_program(&fragProg->Base);
_mesa_print_program_parameters(ctx, &fragProg->Base);
- printf("Mesa post-link fragment program:\n");
+ _mesa_printf("Mesa post-link fragment program:\n");
_mesa_print_program(&shProg->FragmentProgram->Base);
_mesa_print_program_parameters(ctx, &shProg->FragmentProgram->Base);
}
@@ -693,22 +693,26 @@ _slang_link(GLcontext *ctx,
/* notify driver that a new vertex program has been compiled/linked */
ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB,
&shProg->VertexProgram->Base);
- if (MESA_VERBOSE & VERBOSE_GLSL_DUMP) {
- printf("Mesa original vertex program:\n");
+ if (ctx->Shader.Flags & GLSL_DUMP) {
+ _mesa_printf("Mesa original vertex program:\n");
_mesa_print_program(&vertProg->Base);
_mesa_print_program_parameters(ctx, &vertProg->Base);
- printf("Mesa post-link vertex program:\n");
+ _mesa_printf("Mesa post-link vertex program:\n");
_mesa_print_program(&shProg->VertexProgram->Base);
_mesa_print_program_parameters(ctx, &shProg->VertexProgram->Base);
}
}
- if (MESA_VERBOSE & VERBOSE_GLSL_DUMP) {
- printf("Varying vars:\n");
+ if (ctx->Shader.Flags & GLSL_DUMP) {
+ _mesa_printf("Varying vars:\n");
_mesa_print_parameter_list(shProg->Varying);
+ if (shProg->InfoLog) {
+ _mesa_printf("Info Log: %s\n", shProg->InfoLog);
+ }
}
+
shProg->LinkStatus = (shProg->VertexProgram || shProg->FragmentProgram);
}
diff --git a/src/mesa/shader/slang/slang_log.c b/src/mesa/shader/slang/slang_log.c
index d5576d7ee2..30729ba8d5 100644
--- a/src/mesa/shader/slang/slang_log.c
+++ b/src/mesa/shader/slang/slang_log.c
@@ -77,13 +77,11 @@ slang_info_log_message(slang_info_log * log, const char *prefix,
slang_string_concat(log->text, msg);
slang_string_concat(log->text, "\n");
- if (MESA_VERBOSE & VERBOSE_GLSL) {
- _mesa_printf("Mesa: GLSL %s", log->text);
- }
-
return 1;
}
+#define EXIT_SUCCESS 13
+
int
slang_info_log_print(slang_info_log * log, const char *msg, ...)
{