"type of shader\n");
}
- for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) {
- if (prog->_LinkedShaders[i] != NULL) {
- _mesa_delete_linked_shader(ctx, prog->_LinkedShaders[i]);
- }
-
- prog->_LinkedShaders[i] = NULL;
- }
-
/* Link all shaders for a particular stage and validate the result.
*/
for (int stage = 0; stage < MESA_SHADER_STAGES; stage++) {
}
if ((status == EXIT_SUCCESS) && options->do_link) {
- _mesa_clear_shader_program_data(whole_program);
+ _mesa_clear_shader_program_data(ctx, whole_program);
link_shaders(ctx, whole_program);
status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
}
void
-_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
+_mesa_clear_shader_program_data(struct gl_context *ctx,
+ struct gl_shader_program *shProg)
{
+ for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
+ if (shProg->_LinkedShaders[i] != NULL) {
+ _mesa_delete_linked_shader(ctx, shProg->_LinkedShaders[i]);
+ shProg->_LinkedShaders[i] = NULL;
+ }
+ }
+
shProg->NumUniformStorage = 0;
shProg->UniformStorage = NULL;
shProg->NumUniformRemapTable = 0;
struct gl_linked_shader *sh);
extern "C" void
-_mesa_clear_shader_program_data(struct gl_shader_program *);
+_mesa_clear_shader_program_data(struct gl_context *ctx,
+ struct gl_shader_program *);
extern "C" void
_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
* Clear (free) the shader program state that gets produced by linking.
*/
void
-_mesa_clear_shader_program_data(struct gl_shader_program *shProg)
+_mesa_clear_shader_program_data(struct gl_context *ctx,
+ struct gl_shader_program *shProg)
{
- unsigned i;
+ for (gl_shader_stage sh = 0; sh < MESA_SHADER_STAGES; sh++) {
+ if (shProg->_LinkedShaders[sh] != NULL) {
+ _mesa_delete_linked_shader(ctx, shProg->_LinkedShaders[sh]);
+ shProg->_LinkedShaders[sh] = NULL;
+ }
+ }
if (shProg->UniformStorage) {
- for (i = 0; i < shProg->NumUniformStorage; ++i)
+ for (unsigned i = 0; i < shProg->NumUniformStorage; ++i)
_mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
ralloc_free(shProg->UniformStorage);
shProg->NumUniformStorage = 0;
struct gl_shader_program *shProg)
{
GLuint i;
- gl_shader_stage sh;
assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
- _mesa_clear_shader_program_data(shProg);
+ _mesa_clear_shader_program_data(ctx, shProg);
if (shProg->AttributeBindings) {
string_to_uint_map_dtor(shProg->AttributeBindings);
shProg->TransformFeedback.VaryingNames = NULL;
shProg->TransformFeedback.NumVarying = 0;
-
- for (sh = 0; sh < MESA_SHADER_STAGES; sh++) {
- if (shProg->_LinkedShaders[sh] != NULL) {
- _mesa_delete_linked_shader(ctx, shProg->_LinkedShaders[sh]);
- shProg->_LinkedShaders[sh] = NULL;
- }
- }
-
free(shProg->Label);
shProg->Label = NULL;
}
_mesa_new_shader_program(GLuint name);
extern void
-_mesa_clear_shader_program_data(struct gl_shader_program *shProg);
+_mesa_clear_shader_program_data(struct gl_context *ctx,
+ struct gl_shader_program *shProg);
extern void
_mesa_free_shader_program_data(struct gl_context *ctx,
{
unsigned int i;
- _mesa_clear_shader_program_data(prog);
+ _mesa_clear_shader_program_data(ctx, prog);
prog->LinkStatus = GL_TRUE;