From b3aefd1cfb6aacd1695c52911dd39da50d893ece Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 19 Sep 2005 20:12:32 +0000 Subject: additional wrapper updates, bug 4468 --- src/mesa/shader/slang/slang_compile.c | 15 ++++++++------- src/mesa/shader/slang/slang_execute.c | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/mesa/shader/slang') diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 0ff450ca91..688eac33c7 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -635,7 +635,7 @@ int slang_info_log_error (slang_info_log *log, const char *msg, ...) char buf[1024]; va_start (va, msg); - _mesa_sprintf (buf, msg, va); + _mesa_vsprintf (buf, msg, va); if (slang_info_log_message (log, "error", buf)) return 1; slang_info_log_memory (log); @@ -649,7 +649,7 @@ int slang_info_log_warning (slang_info_log *log, const char *msg, ...) char buf[1024]; va_start (va, msg); - _mesa_sprintf (buf, msg, va); + _mesa_vsprintf (buf, msg, va); if (slang_info_log_message (log, "warning", buf)) return 1; slang_info_log_memory (log); @@ -685,7 +685,7 @@ static int parse_identifier (slang_parse_ctx *C, char **id) slang_info_log_memory (C->L); return 0; } - C->I += strlen ((const char *) C->I) + 1; + C->I += _mesa_strlen ((const char *) C->I) + 1; return 1; } @@ -734,8 +734,9 @@ static int parse_float (slang_parse_ctx *C, float *number) return 0; } - whole = (char *) (slang_alloc_malloc ((strlen (integral) + strlen (fractional) + strlen ( - exponent) + 3) * sizeof (char))); + whole = (char *) (slang_alloc_malloc ((_mesa_strlen (integral) + + _mesa_strlen (fractional) + _mesa_strlen (exponent) + 3) * + sizeof (char))); if (whole == NULL) { slang_alloc_free (exponent); @@ -751,7 +752,7 @@ static int parse_float (slang_parse_ctx *C, float *number) slang_string_concat (whole, "E"); slang_string_concat (whole, exponent); - *number = (float) (atof (whole)); + *number = (float) (_mesa_strtod(whole, (char **)NULL)); slang_alloc_free (whole); slang_alloc_free (exponent); @@ -2115,7 +2116,7 @@ if (slang_string_compare ("main", (**parsed_func_ret).header.name) == 0) xxx_prolog (&file, (**parsed_func_ret).address); _slang_execute (&file); slang_assembly_file_destruct (&file); -exit (0); +_mesa_exit (0); } } return 1; diff --git a/src/mesa/shader/slang/slang_execute.c b/src/mesa/shader/slang/slang_execute.c index 78a638b444..5b1d6d3940 100644 --- a/src/mesa/shader/slang/slang_execute.c +++ b/src/mesa/shader/slang/slang_execute.c @@ -34,6 +34,9 @@ #include "slang_storage.h" #include "slang_execute.h" +#define DEBUG_SLANG + +#ifdef DEBUG_SLANG static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i) { fprintf (f, "%.5u:\t", i); @@ -179,11 +182,14 @@ static void dump (const slang_assembly_file *file) fclose (f); } +#endif int _slang_execute (const slang_assembly_file *file) { slang_machine mach; +#ifdef DEBUG_SLANG FILE *f; +#endif mach.ip = 0; mach.sp = SLANG_MACHINE_STACK_SIZE; @@ -200,13 +206,18 @@ int _slang_execute (const slang_assembly_file *file) static_assert(sizeof (GLuint) == 4); /*static_assert(sizeof (GLuint *) == 4);*/ +#ifdef DEBUG_SLANG dump (file); +#endif +#ifdef DEBUG_SLANG f = fopen ("~mesa-slang-assembly-execution.txt", "w"); +#endif while (!mach.exit) { slang_assembly *a = file->code + mach.ip; +#ifdef DEBUG_SLANG if (f != NULL) { unsigned int i; @@ -216,6 +227,7 @@ int _slang_execute (const slang_assembly_file *file) fprintf (f, "\t%.5u\t%6f\t%u\n", i, mach.stack._float[i], mach.stack._addr[i]); fflush (f); } +#endif mach.ip++; switch (a->type) @@ -344,8 +356,10 @@ int _slang_execute (const slang_assembly_file *file) } } +#ifdef DEBUG_SLANG if (f != NULL) fclose (f); +#endif return 0; } -- cgit v1.2.3