mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 15:48:36 +02:00
Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline
This commit is contained in:
commit
381b4b0c91
12 changed files with 199 additions and 149 deletions
|
|
@ -96,8 +96,12 @@ code while a branch has the latest stable code.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
Questions about active Mesa development branches should be posted to
|
||||
the mesa3d-dev mailing list.
|
||||
The command <code>git-branch</code> will list all available branches.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Questions about branch status/activity should be posted to the
|
||||
mesa3d-dev mailing list.
|
||||
</p>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,32 +6,26 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
** Copyright (c) 2007 The Khronos Group Inc.
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: This software was created using the
|
||||
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
|
||||
** not been independently verified as being compliant with the OpenGL(R)
|
||||
** version 1.2.1 Specification.
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
|
|
|
|||
|
|
@ -6,32 +6,26 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
** Copyright (c) 2007 The Khronos Group Inc.
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: This software was created using the
|
||||
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
|
||||
** not been independently verified as being compliant with the OpenGL(R)
|
||||
** version 1.2.1 Specification.
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ static GLboolean DoBindContext(__DRInativeDisplay *dpy,
|
|||
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
|
||||
}
|
||||
|
||||
if ((pdp != prp) && (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp)) {
|
||||
if ((pdp != prp) && (!prp->pStamp || *prp->pStamp != prp->lastStamp)) {
|
||||
DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
|
||||
__driUtilUpdateDrawableInfo(prp);
|
||||
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
|
||||
|
|
@ -420,7 +420,7 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
|
|||
psp = pdp->driScreenPriv;
|
||||
if (!psp) {
|
||||
/* ERROR!!! */
|
||||
_mesa_problem("Warning! Possible infinite loop due to bug "
|
||||
_mesa_problem(NULL, "Warning! Possible infinite loop due to bug "
|
||||
"in file %s, line %d\n",
|
||||
__FILE__, __LINE__);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ xmesa_get_window_size(XMesaDisplay *dpy, XMesaBuffer b,
|
|||
/***** Linked list of XMesaBuffers *****/
|
||||
/**********************************************************************/
|
||||
|
||||
static XMesaBuffer XMesaBufferList = NULL;
|
||||
XMesaBuffer XMesaBufferList = NULL;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -378,6 +378,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
|
|||
b->cmap = cmap;
|
||||
|
||||
_mesa_initialize_framebuffer(&b->mesa_buffer, &vis->mesa_visual);
|
||||
b->mesa_buffer.Delete = xmesa_delete_framebuffer;
|
||||
|
||||
/*
|
||||
* Front renderbuffer
|
||||
|
|
@ -451,8 +452,8 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
|
|||
* Find an XMesaBuffer by matching X display and colormap but NOT matching
|
||||
* the notThis buffer.
|
||||
*/
|
||||
static XMesaBuffer
|
||||
find_xmesa_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis)
|
||||
XMesaBuffer
|
||||
xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis)
|
||||
{
|
||||
XMesaBuffer b;
|
||||
for (b=XMesaBufferList; b; b=b->Next) {
|
||||
|
|
@ -465,38 +466,27 @@ find_xmesa_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis)
|
|||
|
||||
|
||||
/**
|
||||
* Free an XMesaBuffer, remove from linked list, perhaps free X colormap
|
||||
* entries.
|
||||
* Remove buffer from linked list, delete if no longer referenced.
|
||||
*/
|
||||
static void
|
||||
free_xmesa_buffer(int client, XMesaBuffer buffer)
|
||||
xmesa_free_buffer(XMesaBuffer buffer)
|
||||
{
|
||||
XMesaBuffer prev = NULL, b;
|
||||
(void) client;
|
||||
for (b=XMesaBufferList; b; b=b->Next) {
|
||||
if (b==buffer) {
|
||||
/* unlink bufer from list */
|
||||
|
||||
for (b = XMesaBufferList; b; b = b->Next) {
|
||||
if (b == buffer) {
|
||||
struct gl_framebuffer *fb = &buffer->mesa_buffer;
|
||||
|
||||
/* unlink buffer from list */
|
||||
if (prev)
|
||||
prev->Next = buffer->Next;
|
||||
else
|
||||
XMesaBufferList = buffer->Next;
|
||||
/* Check to free X colors */
|
||||
if (buffer->num_alloced>0) {
|
||||
/* If no other buffer uses this X colormap then free the colors. */
|
||||
if (!find_xmesa_buffer(buffer->display, buffer->cmap, buffer)) {
|
||||
#ifdef XFree86Server
|
||||
(void)FreeColors(buffer->cmap, client,
|
||||
buffer->num_alloced, buffer->alloced_colors,
|
||||
0);
|
||||
#else
|
||||
XFreeColors(buffer->display, buffer->cmap,
|
||||
buffer->alloced_colors, buffer->num_alloced, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
_mesa_free_framebuffer_data(&buffer->mesa_buffer);
|
||||
_mesa_free(buffer);
|
||||
/* mark as delete pending */
|
||||
fb->DeletePending = GL_TRUE;
|
||||
/* Dereference. If count = zero we'll really delete the buffer */
|
||||
_mesa_dereference_framebuffer(&fb);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -504,7 +494,7 @@ free_xmesa_buffer(int client, XMesaBuffer buffer)
|
|||
prev = b;
|
||||
}
|
||||
/* buffer not found in XMesaBufferList */
|
||||
_mesa_problem(NULL,"free_xmesa_buffer() - buffer not found\n");
|
||||
_mesa_problem(NULL,"xmesa_free_buffer() - buffer not found\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -686,7 +676,7 @@ setup_grayscale(int client, XMesaVisual v,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
prevBuffer = find_xmesa_buffer(v->display, cmap, buffer);
|
||||
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
|
||||
if (prevBuffer &&
|
||||
(buffer->xm_visual->mesa_visual.rgbMode ==
|
||||
prevBuffer->xm_visual->mesa_visual.rgbMode)) {
|
||||
|
|
@ -775,7 +765,7 @@ setup_dithered_color(int client, XMesaVisual v,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
prevBuffer = find_xmesa_buffer(v->display, cmap, buffer);
|
||||
prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
|
||||
if (prevBuffer &&
|
||||
(buffer->xm_visual->mesa_visual.rgbMode ==
|
||||
prevBuffer->xm_visual->mesa_visual.rgbMode)) {
|
||||
|
|
@ -1666,7 +1656,7 @@ XMesaCreateWindowBuffer2(XMesaVisual v, XMesaWindow w, XMesaContext c)
|
|||
|
||||
if (!initialize_visual_and_buffer( client, v, b, v->mesa_visual.rgbMode,
|
||||
(XMesaDrawable) w, cmap )) {
|
||||
free_xmesa_buffer(client, b);
|
||||
xmesa_free_buffer(b);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1787,7 +1777,7 @@ XMesaCreatePixmapBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap)
|
|||
|
||||
if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode,
|
||||
(XMesaDrawable) p, cmap)) {
|
||||
free_xmesa_buffer(client, b);
|
||||
xmesa_free_buffer(b);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1821,7 +1811,7 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
|
|||
|
||||
if (!initialize_visual_and_buffer(client, v, b, v->mesa_visual.rgbMode,
|
||||
drawable, cmap)) {
|
||||
free_xmesa_buffer(client, b);
|
||||
xmesa_free_buffer(b);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1834,48 +1824,10 @@ XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
|
|||
/*
|
||||
* Deallocate an XMesaBuffer structure and all related info.
|
||||
*/
|
||||
void XMesaDestroyBuffer( XMesaBuffer b )
|
||||
void
|
||||
XMesaDestroyBuffer(XMesaBuffer b)
|
||||
{
|
||||
int client = 0;
|
||||
|
||||
#ifdef XFree86Server
|
||||
if (b->frontxrb->drawable)
|
||||
client = CLIENT_ID(b->frontxrb->drawable->id);
|
||||
#endif
|
||||
|
||||
if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc );
|
||||
if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc );
|
||||
if (b->swapgc) XMesaFreeGC( b->xm_visual->display, b->swapgc );
|
||||
|
||||
if (b->xm_visual->mesa_visual.doubleBufferMode)
|
||||
{
|
||||
if (b->backxrb->ximage) {
|
||||
#if defined(USE_XSHM) && !defined(XFree86Server)
|
||||
if (b->shm) {
|
||||
XShmDetach( b->xm_visual->display, &b->shminfo );
|
||||
XDestroyImage( b->backxrb->ximage );
|
||||
shmdt( b->shminfo.shmaddr );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
XMesaDestroyImage( b->backxrb->ximage );
|
||||
}
|
||||
if (b->backxrb->pixmap) {
|
||||
XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap );
|
||||
if (b->xm_visual->hpcr_clear_flag) {
|
||||
XMesaFreePixmap( b->xm_visual->display,
|
||||
b->xm_visual->hpcr_clear_pixmap );
|
||||
XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (b->rowimage) {
|
||||
_mesa_free( b->rowimage->data );
|
||||
b->rowimage->data = NULL;
|
||||
XMesaDestroyImage( b->rowimage );
|
||||
}
|
||||
|
||||
free_xmesa_buffer(client, b);
|
||||
xmesa_free_buffer(b);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2436,7 +2388,7 @@ void xmesa_destroy_buffers_on_display(XMesaDisplay *dpy)
|
|||
for (b = XMesaBufferList; b; b = next) {
|
||||
next = b->Next;
|
||||
if (b->display == dpy) {
|
||||
free_xmesa_buffer(0, b);
|
||||
xmesa_free_buffer(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "GL/xmesa.h"
|
||||
#include "xmesaP.h"
|
||||
#include "imports.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
|
||||
|
|
@ -352,5 +353,72 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via gl_framebuffer::Delete() method when this buffer
|
||||
* is _really_ being
|
||||
* deleted.
|
||||
*/
|
||||
void
|
||||
xmesa_delete_framebuffer(struct gl_framebuffer *fb)
|
||||
{
|
||||
XMesaBuffer b = XMESA_BUFFER(fb);
|
||||
|
||||
#ifdef XFree86Server
|
||||
int client = 0;
|
||||
if (b->frontxrb->drawable)
|
||||
client = CLIENT_ID(b->frontxrb->drawable->id);
|
||||
#endif
|
||||
|
||||
if (b->num_alloced > 0) {
|
||||
/* If no other buffer uses this X colormap then free the colors. */
|
||||
if (!xmesa_find_buffer(b->display, b->cmap, b)) {
|
||||
#ifdef XFree86Server
|
||||
(void)FreeColors(b->cmap, client,
|
||||
b->num_alloced, b->alloced_colors, 0);
|
||||
#else
|
||||
XFreeColors(b->display, b->cmap,
|
||||
b->alloced_colors, b->num_alloced, 0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (b->gc)
|
||||
XMesaFreeGC(b->xm_visual->display, b->gc);
|
||||
if (b->cleargc)
|
||||
XMesaFreeGC(b->xm_visual->display, b->cleargc);
|
||||
if (b->swapgc)
|
||||
XMesaFreeGC(b->xm_visual->display, b->swapgc);
|
||||
|
||||
if (b->xm_visual->mesa_visual.doubleBufferMode) {
|
||||
/* free back ximage/pixmap/shmregion */
|
||||
if (b->backxrb->ximage) {
|
||||
#if defined(USE_XSHM) && !defined(XFree86Server)
|
||||
if (b->shm) {
|
||||
XShmDetach( b->xm_visual->display, &b->shminfo );
|
||||
XDestroyImage( b->backxrb->ximage );
|
||||
shmdt( b->shminfo.shmaddr );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
XMesaDestroyImage( b->backxrb->ximage );
|
||||
b->backxrb->ximage = NULL;
|
||||
}
|
||||
if (b->backxrb->pixmap) {
|
||||
XMesaFreePixmap( b->xm_visual->display, b->backxrb->pixmap );
|
||||
if (b->xm_visual->hpcr_clear_flag) {
|
||||
XMesaFreePixmap( b->xm_visual->display,
|
||||
b->xm_visual->hpcr_clear_pixmap );
|
||||
XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b->rowimage) {
|
||||
_mesa_free( b->rowimage->data );
|
||||
b->rowimage->data = NULL;
|
||||
XMesaDestroyImage( b->rowimage );
|
||||
}
|
||||
|
||||
_mesa_free_framebuffer_data(fb);
|
||||
_mesa_free(fb);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
extern _glthread_Mutex _xmesa_lock;
|
||||
|
||||
extern XMesaBuffer XMesaBufferList;
|
||||
|
||||
/* for PF_8R8G8B24 pixel format */
|
||||
typedef struct {
|
||||
|
|
@ -489,6 +490,12 @@ extern struct xmesa_renderbuffer *
|
|||
xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual,
|
||||
GLboolean backBuffer);
|
||||
|
||||
extern void
|
||||
xmesa_delete_framebuffer(struct gl_framebuffer *fb);
|
||||
|
||||
extern XMesaBuffer
|
||||
xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis);
|
||||
|
||||
extern unsigned long
|
||||
xmesa_color_to_pixel( GLcontext *ctx,
|
||||
GLubyte r, GLubyte g, GLubyte b, GLubyte a,
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@
|
|||
#include "fbobject.h"
|
||||
#include "feedback.h"
|
||||
#include "fog.h"
|
||||
#include "framebuffer.h"
|
||||
#include "get.h"
|
||||
#include "glthread.h"
|
||||
#include "glapioffsets.h"
|
||||
|
|
@ -1666,6 +1667,8 @@ void
|
|||
_mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
||||
GLframebuffer *readBuffer )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(oldCtx);
|
||||
|
||||
if (MESA_VERBOSE & VERBOSE_API)
|
||||
_mesa_debug(newCtx, "_mesa_make_current()\n");
|
||||
|
||||
|
|
@ -1690,6 +1693,15 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
|||
_glapi_set_context((void *) newCtx);
|
||||
ASSERT(_mesa_get_current_context() == newCtx);
|
||||
|
||||
if (oldCtx) {
|
||||
if (oldCtx->WinSysDrawBuffer) {
|
||||
_mesa_dereference_framebuffer(&oldCtx->WinSysDrawBuffer);
|
||||
}
|
||||
if (oldCtx->WinSysReadBuffer) {
|
||||
_mesa_dereference_framebuffer(&oldCtx->WinSysReadBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
if (!newCtx) {
|
||||
_glapi_set_dispatch(NULL); /* none current */
|
||||
}
|
||||
|
|
@ -1703,6 +1715,8 @@ _mesa_make_current( GLcontext *newCtx, GLframebuffer *drawBuffer,
|
|||
ASSERT(readBuffer->Name == 0);
|
||||
newCtx->WinSysDrawBuffer = drawBuffer;
|
||||
newCtx->WinSysReadBuffer = readBuffer;
|
||||
drawBuffer->RefCount++;
|
||||
readBuffer->RefCount++;
|
||||
|
||||
/*
|
||||
* Only set the context's Draw/ReadBuffer fields if they're NULL
|
||||
|
|
|
|||
|
|
@ -166,6 +166,8 @@ _mesa_initialize_framebuffer(struct gl_framebuffer *fb, const GLvisual *visual)
|
|||
|
||||
_glthread_INIT_MUTEX(fb->Mutex);
|
||||
|
||||
fb->RefCount = 1;
|
||||
|
||||
/* save the visual */
|
||||
fb->Visual = *visual;
|
||||
|
||||
|
|
@ -198,7 +200,6 @@ void
|
|||
_mesa_destroy_framebuffer(struct gl_framebuffer *fb)
|
||||
{
|
||||
if (fb) {
|
||||
_glthread_DESTROY_MUTEX(fb->Mutex);
|
||||
_mesa_free_framebuffer_data(fb);
|
||||
_mesa_free(fb);
|
||||
}
|
||||
|
|
@ -216,6 +217,8 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
|
|||
|
||||
assert(fb);
|
||||
|
||||
_glthread_DESTROY_MUTEX(fb->Mutex);
|
||||
|
||||
for (i = 0; i < BUFFER_COUNT; i++) {
|
||||
struct gl_renderbuffer_attachment *att = &fb->Attachment[i];
|
||||
if (att->Renderbuffer) {
|
||||
|
|
@ -605,21 +608,25 @@ update_color_draw_buffers(GLcontext *ctx, struct gl_framebuffer *fb)
|
|||
GLbitfield bufferMask = fb->_ColorDrawBufferMask[output];
|
||||
GLuint count = 0;
|
||||
GLuint i;
|
||||
/* We need the inner loop here because glDrawBuffer(GL_FRONT_AND_BACK)
|
||||
* can specify writing to two or four color buffers (for example).
|
||||
*/
|
||||
for (i = 0; bufferMask && i < BUFFER_COUNT; i++) {
|
||||
const GLuint bufferBit = 1 << i;
|
||||
if (bufferBit & bufferMask) {
|
||||
struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
|
||||
if (rb) {
|
||||
fb->_ColorDrawBuffers[output][count] = rb;
|
||||
count++;
|
||||
if (!fb->DeletePending) {
|
||||
/* We need the inner loop here because glDrawBuffer(GL_FRONT_AND_BACK)
|
||||
* can specify writing to two or four color buffers (for example).
|
||||
*/
|
||||
for (i = 0; bufferMask && i < BUFFER_COUNT; i++) {
|
||||
const GLuint bufferBit = 1 << i;
|
||||
if (bufferBit & bufferMask) {
|
||||
struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer;
|
||||
if (rb) {
|
||||
fb->_ColorDrawBuffers[output][count] = rb;
|
||||
count++;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
_mesa_warning(ctx, "DrawBuffer names a missing buffer!\n");
|
||||
*/
|
||||
}
|
||||
bufferMask &= ~bufferBit;
|
||||
}
|
||||
else {
|
||||
/*_mesa_warning(ctx, "DrawBuffer names a missing buffer!\n");*/
|
||||
}
|
||||
bufferMask &= ~bufferBit;
|
||||
}
|
||||
}
|
||||
fb->_NumColorDrawBuffers[output] = count;
|
||||
|
|
@ -635,7 +642,7 @@ static void
|
|||
update_color_read_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
|
||||
{
|
||||
(void) ctx;
|
||||
if (fb->_ColorReadBufferIndex == -1) {
|
||||
if (fb->_ColorReadBufferIndex == -1 || fb->DeletePending) {
|
||||
fb->_ColorReadBuffer = NULL; /* legal! */
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -2243,6 +2243,7 @@ struct gl_framebuffer
|
|||
_glthread_Mutex Mutex; /**< for thread safety */
|
||||
GLuint Name; /* if zero, this is a window system framebuffer */
|
||||
GLint RefCount;
|
||||
GLboolean DeletePending;
|
||||
|
||||
GLvisual Visual; /**< The framebuffer's visual.
|
||||
Immutable if this is a window system buffer.
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.2
|
||||
* Version: 6.5.3
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -54,7 +54,8 @@ read_index_pixels( GLcontext *ctx,
|
|||
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
GLint i;
|
||||
|
||||
ASSERT(rb);
|
||||
if (!rb)
|
||||
return;
|
||||
|
||||
/* width should never be > MAX_WIDTH since we did clipping earlier */
|
||||
ASSERT(width <= MAX_WIDTH);
|
||||
|
|
@ -91,6 +92,9 @@ read_depth_pixels( GLcontext *ctx,
|
|||
const GLboolean biasOrScale
|
||||
= ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0;
|
||||
|
||||
if (!rb)
|
||||
return;
|
||||
|
||||
/* clipping should have been done already */
|
||||
ASSERT(x >= 0);
|
||||
ASSERT(y >= 0);
|
||||
|
|
@ -99,8 +103,6 @@ read_depth_pixels( GLcontext *ctx,
|
|||
/* width should never be > MAX_WIDTH since we did clipping earlier */
|
||||
ASSERT(width <= MAX_WIDTH);
|
||||
|
||||
ASSERT(rb);
|
||||
|
||||
if (type == GL_UNSIGNED_SHORT && fb->Visual.depthBits == 16
|
||||
&& !biasOrScale && !packing->SwapBytes) {
|
||||
/* Special case: directly read 16-bit unsigned depth values. */
|
||||
|
|
@ -171,7 +173,8 @@ read_stencil_pixels( GLcontext *ctx,
|
|||
struct gl_renderbuffer *rb = fb->_StencilBuffer;
|
||||
GLint j;
|
||||
|
||||
ASSERT(rb);
|
||||
if (!rb)
|
||||
return;
|
||||
|
||||
/* width should never be > MAX_WIDTH since we did clipping earlier */
|
||||
ASSERT(width <= MAX_WIDTH);
|
||||
|
|
@ -195,6 +198,7 @@ read_stencil_pixels( GLcontext *ctx,
|
|||
/**
|
||||
* Optimized glReadPixels for particular pixel formats when pixel
|
||||
* scaling, biasing, mapping, etc. are disabled.
|
||||
* \return GL_TRUE if success, GL_FALSE if unable to do the readpixels
|
||||
*/
|
||||
static GLboolean
|
||||
fast_read_rgba_pixels( GLcontext *ctx,
|
||||
|
|
@ -207,6 +211,9 @@ fast_read_rgba_pixels( GLcontext *ctx,
|
|||
{
|
||||
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
|
||||
if (!rb)
|
||||
return GL_FALSE;
|
||||
|
||||
ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB);
|
||||
|
||||
/* clipping should have already been done */
|
||||
|
|
@ -316,7 +323,8 @@ read_rgba_pixels( GLcontext *ctx,
|
|||
struct gl_framebuffer *fb = ctx->ReadBuffer;
|
||||
struct gl_renderbuffer *rb = fb->_ColorReadBuffer;
|
||||
|
||||
ASSERT(rb);
|
||||
if (!rb)
|
||||
return;
|
||||
|
||||
if (type == GL_FLOAT && ((ctx->Color.ClampReadColor == GL_TRUE) ||
|
||||
(ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
|
||||
|
|
@ -457,8 +465,8 @@ read_depth_stencil_pixels(GLcontext *ctx,
|
|||
depthRb = ctx->ReadBuffer->_DepthBuffer;
|
||||
stencilRb = ctx->ReadBuffer->_StencilBuffer;
|
||||
|
||||
ASSERT(depthRb);
|
||||
ASSERT(stencilRb);
|
||||
if (!depthRb || !stencilRb)
|
||||
return;
|
||||
|
||||
depthRb = ctx->ReadBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||
stencilRb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ void _vbo_DestroyContext( GLcontext *ctx )
|
|||
ctx->aelt_context = NULL;
|
||||
}
|
||||
|
||||
vbo_exec_destroy(ctx);
|
||||
FREE(vbo_context(ctx));
|
||||
ctx->swtnl_im = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue