mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 01:38:06 +02:00
fix some glBindProgramNV/ARB details
This commit is contained in:
parent
3ca3ab0cd1
commit
5e92a7c745
2 changed files with 37 additions and 14 deletions
|
|
@ -463,19 +463,30 @@ _mesa_BindProgramARB(GLenum target, GLuint program)
|
|||
}
|
||||
else {
|
||||
prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, program);
|
||||
}
|
||||
if (!prog && program > 0){
|
||||
/* allocate new program */
|
||||
prog = _mesa_alloc_program(ctx, target, program);
|
||||
if (!prog) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB");
|
||||
return;
|
||||
if (prog) {
|
||||
if (prog->Target == 0) {
|
||||
/* prog was allocated with glGenProgramsARB */
|
||||
prog->Target = target;
|
||||
}
|
||||
else if (prog->Target != target) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glBindProgramARB(target mismatch)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* allocate a new program now */
|
||||
prog = _mesa_alloc_program(ctx, target, program);
|
||||
if (!prog) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramARB");
|
||||
return;
|
||||
}
|
||||
prog->Id = program;
|
||||
prog->Target = target;
|
||||
prog->Resident = GL_TRUE;
|
||||
prog->RefCount = 1;
|
||||
_mesa_HashInsert(ctx->Shared->Programs, program, prog);
|
||||
}
|
||||
prog->Id = program;
|
||||
prog->Target = target;
|
||||
prog->Resident = GL_TRUE;
|
||||
prog->RefCount = 1;
|
||||
_mesa_HashInsert(ctx->Shared->Programs, program, prog);
|
||||
}
|
||||
|
||||
/* bind now */
|
||||
|
|
|
|||
|
|
@ -227,12 +227,24 @@ _mesa_BindProgramNV(GLenum target, GLuint id)
|
|||
*/
|
||||
if (id == 0) {
|
||||
/* OK, the null program object */
|
||||
/* XXX use the ARB_vertex/fragment prorgram default objects??? */
|
||||
prog = NULL;
|
||||
}
|
||||
else {
|
||||
prog = (struct program *) _mesa_HashLookup(ctx->Shared->Programs, id);
|
||||
if (!prog && id > 0){
|
||||
/* allocate new program */
|
||||
if (prog) {
|
||||
if (prog->Target == 0) {
|
||||
/* prog was allocated with glGenProgramsNV */
|
||||
prog->Target = target;
|
||||
}
|
||||
else if (prog->Target != target) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glBindProgramNV(target mismatch)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* allocate a new program now */
|
||||
prog = _mesa_alloc_program(ctx, target, id);
|
||||
if (!prog) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindProgramNV");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue