glx: Fix MakeCurrent with no drawables
GLX_ARB_create_context, which we aspire to support, allows making GL 3.0 or newer contexts current with null current drawables. Strictly this might not be legal for pre-3.0 contexts, but there's no harm in allowing it anyway. Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
		
							parent
							
								
									e2e50c5097
								
							
						
					
					
						commit
						f4b78286ea
					
				| 
						 | 
					@ -560,19 +560,14 @@ DoMakeCurrent(__GLXclientState * cl,
 | 
				
			||||||
    __GLXdrawable *drawPriv = NULL;
 | 
					    __GLXdrawable *drawPriv = NULL;
 | 
				
			||||||
    __GLXdrawable *readPriv = NULL;
 | 
					    __GLXdrawable *readPriv = NULL;
 | 
				
			||||||
    int error;
 | 
					    int error;
 | 
				
			||||||
    GLuint mask;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /* Drawables but no context makes no sense */
 | 
				
			||||||
     ** If one is None and the other isn't, it's a bad match.
 | 
					    if (!contextId && (drawId || readId))
 | 
				
			||||||
     */
 | 
					        return BadMatch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mask = (drawId == None) ? (1 << 0) : 0;
 | 
					    /* If either drawable is null, the other must be too */
 | 
				
			||||||
    mask |= (readId == None) ? (1 << 1) : 0;
 | 
					    if ((drawId == None) != (readId == None))
 | 
				
			||||||
    mask |= (contextId == None) ? (1 << 2) : 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if ((mask != 0x00) && (mask != 0x07)) {
 | 
					 | 
				
			||||||
        return BadMatch;
 | 
					        return BadMatch;
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     ** Lookup old context.  If we have one, it must be in a usable state.
 | 
					     ** Lookup old context.  If we have one, it must be in a usable state.
 | 
				
			||||||
| 
						 | 
					@ -608,20 +603,20 @@ DoMakeCurrent(__GLXclientState * cl,
 | 
				
			||||||
            return BadAccess;
 | 
					            return BadAccess;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert(drawId != None);
 | 
					        if (drawId) {
 | 
				
			||||||
        assert(readId != None);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
 | 
					            drawPriv = __glXGetDrawable(glxc, drawId, client, &status);
 | 
				
			||||||
            if (drawPriv == NULL)
 | 
					            if (drawPriv == NULL)
 | 
				
			||||||
                return status;
 | 
					                return status;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (readId) {
 | 
				
			||||||
            readPriv = __glXGetDrawable(glxc, readId, client, &status);
 | 
					            readPriv = __glXGetDrawable(glxc, readId, client, &status);
 | 
				
			||||||
            if (readPriv == NULL)
 | 
					            if (readPriv == NULL)
 | 
				
			||||||
                return status;
 | 
					                return status;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    else {
 | 
					    } else {
 | 
				
			||||||
        /* Switching to no context.  Ignore new drawable. */
 | 
					        /* Switching to no context.  Ignore new drawable. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        glxc = 0;
 | 
					        glxc = 0;
 | 
				
			||||||
        drawPriv = 0;
 | 
					        drawPriv = 0;
 | 
				
			||||||
        readPriv = 0;
 | 
					        readPriv = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue