summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader/slang/slang_compile.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2006-12-19 18:46:56 -0700
committerBrian <[email protected]>2006-12-19 18:46:56 -0700
commit65a18442e5d846940714bb662f5b1bb47ab60c29 (patch)
treedb8554850401753e441a8c49b815f48f7df5a150 /src/mesa/shader/slang/slang_compile.c
parent0bf5dbe002a64e198f55724cc1542602c012490f (diff)
Clean-up and re-org of the main GLSL object types.
Use the gl_shader struct as it should be. Renamed gl_linked_program to gl_shader_program. Store both shaders and programs in the same hash table and use the Type field to distinguish them.
Diffstat (limited to 'src/mesa/shader/slang/slang_compile.c')
-rw-r--r--src/mesa/shader/slang/slang_compile.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 6aed167e3fd..286e25d54bd 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2223,6 +2223,7 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
}
+#if 0
static void
slang_create_uniforms(const slang_export_data_table *exports,
struct gl_program *program)
@@ -2237,16 +2238,34 @@ slang_create_uniforms(const slang_export_data_table *exports,
}
}
}
+#endif
GLboolean
_slang_compile(const char *source, slang_code_object * object,
slang_unit_type type, slang_info_log * infolog,
- struct gl_program *program)
+ struct gl_shader *shader)
{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_program *program;
GLboolean success;
grammar id = 0;
+ /* XXX temporary hack */
+ if (!shader->Programs) {
+ GLenum progTarget;
+ if (shader->Type == GL_VERTEX_SHADER)
+ progTarget = GL_VERTEX_PROGRAM_ARB;
+ else
+ progTarget = GL_FRAGMENT_PROGRAM_ARB;
+ shader->Programs
+ = (struct gl_program **) malloc(sizeof(struct gl_program*));
+ shader->Programs[0] = _mesa_new_program(ctx, progTarget, 1);
+ shader->NumPrograms = 1;
+ }
+ program = shader->Programs[0];
+ assert(program);
+
_slang_code_object_dtr(object);
_slang_code_object_ctr(object);
@@ -2265,7 +2284,7 @@ _slang_compile(const char *source, slang_code_object * object,
#if NEW_SLANG
{
GET_CURRENT_CONTEXT(ctx);
- slang_create_uniforms(&object->expdata, program);
+ slang_create_uniforms(&object->expdata, shader);
_mesa_print_program(program);
_mesa_print_program_parameters(ctx, program);
}