}
}
-void
-_mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader)
+static void
+_mesa_init_shader(struct gl_shader *shader)
{
shader->RefCount = 1;
- shader->Geom.VerticesOut = -1;
- shader->Geom.InputType = GL_TRIANGLES;
- shader->Geom.OutputType = GL_TRIANGLE_STRIP;
+ shader->info.Geom.VerticesOut = -1;
+ shader->info.Geom.InputType = GL_TRIANGLES;
+ shader->info.Geom.OutputType = GL_TRIANGLE_STRIP;
}
/**
* Allocate a new gl_shader object, initialize it.
- * Called via ctx->Driver.NewShader()
*/
struct gl_shader *
-_mesa_new_shader(struct gl_context *ctx, GLuint name, gl_shader_stage stage)
+_mesa_new_shader(GLuint name, gl_shader_stage stage)
{
struct gl_shader *shader;
shader = rzalloc(NULL, struct gl_shader);
if (shader) {
shader->Stage = stage;
shader->Name = name;
- _mesa_init_shader(ctx, shader);
+ _mesa_init_shader(shader);
+ }
+ return shader;
+}
+
+
+/**
+ * Allocate a new gl_linked_shader object.
+ * Called via ctx->Driver.NewShader()
+ */
+struct gl_linked_shader *
+_mesa_new_linked_shader(gl_shader_stage stage)
+{
+ struct gl_linked_shader *shader;
+ shader = rzalloc(NULL, struct gl_linked_shader);
+ if (shader) {
+ shader->Stage = stage;
}
return shader;
}
{
free((void *)sh->Source);
free(sh->Label);
+ ralloc_free(sh);
+}
+
+
+/**
+ * Delete a shader object.
+ */
+void
+_mesa_delete_linked_shader(struct gl_context *ctx,
+ struct gl_linked_shader *sh)
+{
_mesa_reference_program(ctx, &sh->Program, NULL);
ralloc_free(sh);
}
for (sh = 0; sh < MESA_SHADER_STAGES; sh++) {
if (shProg->_LinkedShaders[sh] != NULL) {
- _mesa_delete_shader(ctx, shProg->_LinkedShaders[sh]);
+ _mesa_delete_linked_shader(ctx, shProg->_LinkedShaders[sh]);
shProg->_LinkedShaders[sh] = NULL;
}
}
void
_mesa_init_shader_object_functions(struct dd_function_table *driver)
{
- driver->NewShader = _mesa_new_shader;
+ driver->NewShader = _mesa_new_linked_shader;
driver->LinkShader = _mesa_ir_link_shader;
}