summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_execute.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2006-02-27 14:41:41 +0000
committerMichal Krol <[email protected]>2006-02-27 14:41:41 +0000
commit9ac9605de156408580b81ba7e2780bd3f5372c6d (patch)
treee0dfe1127ed3b7f9674c450dea59b921e84c4dfc /src/mesa/shader/slang/slang_execute.c
parentc56f2c49a51e7ad1106c46e3e86dfe2756ef87c4 (diff)
More GLSL code:
- add x86 code generator; - add full support for uniforms in ARB_shader_objects; - add assembly instruction: global_addr; - reorganize #includes; - built-in uniforms accessed by index, rather than by name; - add some entries to x86sse rtasm; - add configurations to VC6 projects: 'Release x86' and 'Debug x86'; - #define SLANG_X86 active only on VC6 x86 builds; - introduce code export table for a shader; - remove GNU license from the noise library;
Diffstat (limited to 'src/mesa/shader/slang/slang_execute.c')
-rw-r--r--src/mesa/shader/slang/slang_execute.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/mesa/shader/slang/slang_execute.c b/src/mesa/shader/slang/slang_execute.c
index 06f0eefdf60..0714ddff0d9 100644
--- a/src/mesa/shader/slang/slang_execute.c
+++ b/src/mesa/shader/slang/slang_execute.c
@@ -32,14 +32,26 @@
#include "context.h"
#include "swrast/s_context.h"
#include "colormac.h"
-#include "slang_utility.h"
-#include "slang_assemble.h"
-#include "slang_storage.h"
#include "slang_execute.h"
#include "slang_library_noise.h"
#define DEBUG_SLANG 0
+GLvoid slang_machine_ctr (slang_machine *self)
+{
+ slang_machine_init (self);
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+ self->x86.compiled_func = NULL;
+#endif
+}
+
+GLvoid slang_machine_dtr (slang_machine *self)
+{
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+ /* TODO: free self->x86.compiled_func */
+#endif
+}
+
void slang_machine_init (slang_machine *mach)
{
mach->ip = 0;
@@ -53,7 +65,7 @@ int _slang_execute (const slang_assembly_file *file)
{
slang_machine mach;
- slang_machine_init (&mach);
+ slang_machine_ctr (&mach);
return _slang_execute2 (file, &mach);
}
@@ -207,6 +219,9 @@ static void dump_instruction (FILE *f, slang_assembly *a, unsigned int i)
case slang_asm_local_addr:
fprintf (f, "local_addr\t%u, %u", a->param[0], a->param[1]);
break;
+ case slang_asm_global_addr:
+ fprintf (f, "global_addr\t%u", a->param[0]);
+ break;
case slang_asm_call:
fprintf (f, "call\t%u", a->param[0]);
break;
@@ -293,6 +308,14 @@ int _slang_execute2 (const slang_assembly_file *file, slang_machine *mach)
f = fopen (filename, "w");
#endif
+#if defined(USE_X86_ASM) || defined(SLANG_X86)
+ if (mach->x86.compiled_func != NULL)
+ {
+ mach->x86.compiled_func (mach);
+ return 1;
+ }
+#endif
+
stack = mach->mem + SLANG_MACHINE_GLOBAL_SIZE;
while (!mach->exit)
@@ -427,6 +450,7 @@ int _slang_execute2 (const slang_assembly_file *file, slang_machine *mach)
mach->sp++;
break;
case slang_asm_addr_push:
+ case slang_asm_global_addr:
mach->sp--;
stack[mach->sp]._addr = a->param[0];
break;