diff options
author | Michal Krol <mjkrol@gmail.org> | 2006-05-16 10:04:24 +0000 |
---|---|---|
committer | Michal Krol <mjkrol@gmail.org> | 2006-05-16 10:04:24 +0000 |
commit | 21ef956e9a48ab21e724a480a592e17d651477e6 (patch) | |
tree | 341779220a3e68298889f9e9c134ac2050e5551a /src/mesa/shader/slang/slang_execute.c | |
parent | a67330d157ffe05602a3163c946aa97e29cb6bb5 (diff) |
Extend printMESA function to output also to shader's info log.
Fix float-to-int conversion for x86 back-end.
Diffstat (limited to 'src/mesa/shader/slang/slang_execute.c')
-rw-r--r-- | src/mesa/shader/slang/slang_execute.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/mesa/shader/slang/slang_execute.c b/src/mesa/shader/slang/slang_execute.c index 5577909da0..e5beb509f0 100644 --- a/src/mesa/shader/slang/slang_execute.c +++ b/src/mesa/shader/slang/slang_execute.c @@ -29,6 +29,7 @@ */ #include "imports.h" +#include "slang_compile.h" #include "slang_execute.h" #include "slang_library_noise.h" #include "slang_library_texsample.h" @@ -38,6 +39,7 @@ GLvoid slang_machine_ctr (slang_machine *self) { slang_machine_init (self); + self->infolog = NULL; #if defined(USE_X86_ASM) || defined(SLANG_X86) self->x86.compiled_func = NULL; #endif @@ -45,6 +47,10 @@ GLvoid slang_machine_ctr (slang_machine *self) GLvoid slang_machine_dtr (slang_machine *self) { + if (self->infolog != NULL) { + slang_info_log_destruct (self->infolog); + slang_alloc_free (self->infolog); + } #if defined(USE_X86_ASM) || defined(SLANG_X86) if (self->x86.compiled_func != NULL) _mesa_exec_free (self->x86.compiled_func); @@ -60,14 +66,6 @@ void slang_machine_init (slang_machine *mach) mach->exit = 0; } -int _slang_execute (const slang_assembly_file *file) -{ - slang_machine mach; - - slang_machine_ctr (&mach); - return _slang_execute2 (file, &mach); -} - #if DEBUG_SLANG static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i) @@ -286,6 +284,17 @@ static void dump (const slang_assembly_file *file) #endif +static GLvoid +ensure_infolog_created (slang_info_log **infolog) +{ + if (*infolog == NULL) { + *infolog = slang_alloc_malloc (sizeof (slang_info_log)); + if (*infolog == NULL) + return; + slang_info_log_construct (*infolog); + } +} + int _slang_execute2 (const slang_assembly_file *file, slang_machine *mach) { slang_machine_slot *stack; @@ -545,12 +554,19 @@ int _slang_execute2 (const slang_assembly_file *file, slang_machine *mach) /* mesa-specific extensions */ case slang_asm_float_print: _mesa_printf ("slang print: %f\n", stack[mach->sp]._float); + ensure_infolog_created (&mach->infolog); + slang_info_log_print (mach->infolog, "%f", stack[mach->sp]._float); break; case slang_asm_int_print: _mesa_printf ("slang print: %d\n", (GLint) stack[mach->sp]._float); + ensure_infolog_created (&mach->infolog); + slang_info_log_print (mach->infolog, "%d", (GLint) (stack[mach->sp]._float)); break; case slang_asm_bool_print: _mesa_printf ("slang print: %s\n", (GLint) stack[mach->sp]._float ? "true" : "false"); + ensure_infolog_created (&mach->infolog); + slang_info_log_print (mach->infolog, "%s", + (GLint) (stack[mach->sp]._float) ? "true" : "false"); break; default: assert (0); |