assert(prog);
memset(prog, 0, sizeof(*prog));
+ mtx_init(&prog->Mutex, mtx_plain);
prog->Id = id;
prog->Target = target;
prog->RefCount = 1;
ralloc_free(prog->nir);
}
+ mtx_destroy(&prog->Mutex);
free(prog);
}
if (*ptr) {
GLboolean deleteFlag;
+ struct gl_program *oldProg = *ptr;
- /*mtx_lock(&(*ptr)->Mutex);*/
- assert((*ptr)->RefCount > 0);
- (*ptr)->RefCount--;
+ mtx_lock(&oldProg->Mutex);
+ assert(oldProg->RefCount > 0);
+ oldProg->RefCount--;
- deleteFlag = ((*ptr)->RefCount == 0);
- /*mtx_lock(&(*ptr)->Mutex);*/
+ deleteFlag = (oldProg->RefCount == 0);
+ mtx_unlock(&oldProg->Mutex);
if (deleteFlag) {
assert(ctx);
- ctx->Driver.DeleteProgram(ctx, *ptr);
+ ctx->Driver.DeleteProgram(ctx, oldProg);
}
*ptr = NULL;
assert(!*ptr);
if (prog) {
- /*mtx_lock(&prog->Mutex);*/
+ mtx_lock(&prog->Mutex);
prog->RefCount++;
- /*mtx_unlock(&prog->Mutex);*/
+ mtx_unlock(&prog->Mutex);
}
*ptr = prog;