summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_execute.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2006-02-18 15:11:18 +0000
committerMichal Krol <[email protected]>2006-02-18 15:11:18 +0000
commit3654193a4d417560c90b4bbe47d8070919cdc348 (patch)
tree9c984f7fe482f9af08575d6b3338cd4128e5455c /src/mesa/shader/slang/slang_execute.c
parente94be8d5c0b28c4eecf8492cb07ae9dff9026ada (diff)
More GLSL code.
- general constructors allowed; - implement noise functions (from Stefan Gustavson - thanks!) - cosmetic stuff.
Diffstat (limited to 'src/mesa/shader/slang/slang_execute.c')
-rw-r--r--src/mesa/shader/slang/slang_execute.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_execute.c b/src/mesa/shader/slang/slang_execute.c
index a40a35cd578..22dba0119a7 100644
--- a/src/mesa/shader/slang/slang_execute.c
+++ b/src/mesa/shader/slang/slang_execute.c
@@ -33,6 +33,7 @@
#include "slang_assemble.h"
#include "slang_storage.h"
#include "slang_execute.h"
+#include "slang_library_noise.h"
#define DEBUG_SLANG 0
@@ -122,6 +123,18 @@ static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i)
case slang_asm_float_ceil:
fprintf (f, "float_ceil");
break;
+ case slang_asm_float_noise1:
+ fprintf (f, "float_noise1");
+ break;
+ case slang_asm_float_noise2:
+ fprintf (f, "float_noise2");
+ break;
+ case slang_asm_float_noise3:
+ fprintf (f, "float_noise3");
+ break;
+ case slang_asm_float_noise4:
+ fprintf (f, "float_noise4");
+ break;
case slang_asm_int_copy:
fprintf (f, "int_copy\t%d, %d", a->param[0], a->param[1]);
break;
@@ -365,6 +378,24 @@ int _slang_execute2 (const slang_assembly_file *file, slang_machine *mach)
case slang_asm_float_ceil:
stack[mach->sp]._float = CEILF (stack[mach->sp]._float);
break;
+ case slang_asm_float_noise1:
+ stack[mach->sp]._float = _slang_library_noise1 (stack[mach->sp]._float);
+ break;
+ case slang_asm_float_noise2:
+ stack[mach->sp + 1]._float = _slang_library_noise2 (stack[mach->sp]._float,
+ stack[mach->sp + 1]._float);
+ mach->sp++;
+ break;
+ case slang_asm_float_noise3:
+ stack[mach->sp + 2]._float = _slang_library_noise3 (stack[mach->sp]._float,
+ stack[mach->sp + 1]._float, stack[mach->sp + 2]._float);
+ mach->sp += 2;
+ break;
+ case slang_asm_float_noise4:
+ stack[mach->sp + 3]._float = _slang_library_noise4 (stack[mach->sp]._float,
+ stack[mach->sp + 1]._float, stack[mach->sp + 2]._float, stack[mach->sp + 3]._float);
+ mach->sp += 3;
+ break;
case slang_asm_int_to_float:
break;
case slang_asm_int_to_addr:
@@ -442,6 +473,8 @@ int _slang_execute2 (const slang_assembly_file *file, slang_machine *mach)
case slang_asm_bool_print:
_mesa_printf ("slang print: %s\n", (GLint) stack[mach->sp]._float ? "true" : "false");
break;
+ default:
+ assert (0);
}
}