From 1ed503a856d9753a813951796bc6ba56c42ecd28 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 7 Nov 2011 07:15:44 +0100 Subject: xserver pixman mesa git update 7 nov 2011 --- mesalib/src/mesa/drivers/dri/common/dri_util.c | 533 ++++++++++----------- mesalib/src/mesa/drivers/dri/common/dri_util.h | 201 ++++---- mesalib/src/mesa/drivers/dri/common/drisw_util.c | 49 +- mesalib/src/mesa/drivers/dri/common/drisw_util.h | 134 ------ mesalib/src/mesa/drivers/dri/common/utils.c | 23 - mesalib/src/mesa/drivers/dri/common/utils.h | 5 - mesalib/src/mesa/drivers/dri/common/xmlconfig.c | 22 + mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h | 2 +- mesalib/src/mesa/state_tracker/st_cb_bitmap.c | 5 + mesalib/src/mesa/state_tracker/st_cb_clear.c | 3 + mesalib/src/mesa/state_tracker/st_cb_drawpixels.c | 4 + mesalib/src/mesa/state_tracker/st_cb_drawtex.c | 3 + mesalib/src/mesa/state_tracker/st_extensions.c | 3 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 52 +- mesalib/src/mesa/swrast/s_readpix.c | 2 +- 15 files changed, 440 insertions(+), 601 deletions(-) delete mode 100644 mesalib/src/mesa/drivers/dri/common/drisw_util.h (limited to 'mesalib/src/mesa') diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c index da4e39f9c..1640c1448 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -15,12 +15,7 @@ */ -#include -#include -#include - -#include "main/imports.h" - +#include #include "dri_util.h" #include "utils.h" #include "xmlpool.h" @@ -35,18 +30,230 @@ PUBLIC const char __dri2ConfigOptions[] = static const uint __dri2NConfigOptions = 1; -#ifndef GLX_OML_sync_control -typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); -#endif +/*****************************************************************/ +/** \name Screen handling functions */ +/*****************************************************************/ +/*@{*/ + +static void +setupLoaderExtensions(__DRIscreen *psp, + const __DRIextension **extensions) +{ + int i; + + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0) + psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0) + psp->dri2.image = (__DRIimageLookupExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0) + psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i]; + } +} + +static __DRIscreen * +dri2CreateNewScreen(int scrn, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, void *data) +{ + static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; + drmVersionPtr version; + + psp = calloc(1, sizeof(*psp)); + if (!psp) + return NULL; + + setupLoaderExtensions(psp, extensions); + + version = drmGetVersion(fd); + if (version) { + psp->drm_version.major = version->version_major; + psp->drm_version.minor = version->version_minor; + psp->drm_version.patch = version->version_patchlevel; + drmFreeVersion(version); + } + + psp->loaderPrivate = data; + + psp->extensions = emptyExtensionList; + psp->fd = fd; + psp->myNum = scrn; + + psp->api_mask = (1 << __DRI_API_OPENGL); + + *driver_configs = driDriverAPI.InitScreen(psp); + if (*driver_configs == NULL) { + free(psp); + return NULL; + } + + driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions, __dri2NConfigOptions); + driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum, "dri2"); + + return psp; +} + +/** + * Destroy the per-screen private information. + * + * \internal + * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls + * drmClose(), and finally frees \p screenPrivate. + */ +static void driDestroyScreen(__DRIscreen *psp) +{ + if (psp) { + /* No interaction with the X-server is possible at this point. This + * routine is called after XCloseDisplay, so there is no protocol + * stream open to the X-server anymore. + */ + + _mesa_destroy_shader_compiler(); + + driDriverAPI.DestroyScreen(psp); + + driDestroyOptionCache(&psp->optionCache); + driDestroyOptionInfo(&psp->optionInfo); + + free(psp); + } +} + +static const __DRIextension **driGetExtensions(__DRIscreen *psp) +{ + return psp->extensions; +} + +/*@}*/ + + +/*****************************************************************/ +/** \name Context handling functions */ +/*****************************************************************/ +/*@{*/ + +static __DRIcontext * +dri2CreateNewContextForAPI(__DRIscreen *screen, int api, + const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + __DRIcontext *context; + const struct gl_config *modes = (config != NULL) ? &config->modes : NULL; + void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; + gl_api mesa_api; + + if (!(screen->api_mask & (1 << api))) + return NULL; + + switch (api) { + case __DRI_API_OPENGL: + mesa_api = API_OPENGL; + break; + case __DRI_API_GLES: + mesa_api = API_OPENGLES; + break; + case __DRI_API_GLES2: + mesa_api = API_OPENGLES2; + break; + default: + return NULL; + } + + context = malloc(sizeof *context); + if (!context) + return NULL; + + context->loaderPrivate = data; + + context->driScreenPriv = screen; + context->driDrawablePriv = NULL; + context->driReadablePriv = NULL; + + if (!driDriverAPI.CreateContext(mesa_api, modes, context, shareCtx) ) { + free(context); + return NULL; + } + + return context; +} + + +static __DRIcontext * +dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL, + config, shared, data); +} + +/** + * Destroy the per-context private information. + * + * \internal + * This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls + * drmDestroyContext(), and finally frees \p contextPrivate. + */ +static void +driDestroyContext(__DRIcontext *pcp) +{ + if (pcp) { + driDriverAPI.DestroyContext(pcp); + free(pcp); + } +} + +static int +driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) +{ + (void) dest; + (void) src; + (void) mask; + return GL_FALSE; +} + +/*@}*/ -static void dri_get_drawable(__DRIdrawable *pdp); -static void dri_put_drawable(__DRIdrawable *pdp); /*****************************************************************/ /** \name Context (un)binding functions */ /*****************************************************************/ /*@{*/ +static void dri_get_drawable(__DRIdrawable *pdp); +static void dri_put_drawable(__DRIdrawable *pdp); + +/** + * This function takes both a read buffer and a draw buffer. This is needed + * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent + * function. + */ +static int driBindContext(__DRIcontext *pcp, + __DRIdrawable *pdp, + __DRIdrawable *prp) +{ + /* + ** Assume error checking is done properly in glXMakeCurrent before + ** calling driUnbindContext. + */ + + if (!pcp) + return GL_FALSE; + + /* Bind the drawable to the context */ + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + dri_get_drawable(pdp); + } + if (prp && pdp != prp) { + dri_get_drawable(prp); + } + + return driDriverAPI.MakeCurrent(pcp, pdp, prp); +} + /** * Unbind context. * @@ -65,7 +272,6 @@ static void dri_put_drawable(__DRIdrawable *pdp); */ static int driUnbindContext(__DRIcontext *pcp) { - __DRIscreen *psp; __DRIdrawable *pdp; __DRIdrawable *prp; @@ -75,17 +281,16 @@ static int driUnbindContext(__DRIcontext *pcp) */ if (pcp == NULL) - return GL_FALSE; + return GL_FALSE; - psp = pcp->driScreenPriv; pdp = pcp->driDrawablePriv; prp = pcp->driReadablePriv; /* already unbound */ if (!pdp && !prp) - return GL_TRUE; - /* Let driver unbind drawable from context */ - (*psp->DriverAPI.UnbindContext)(pcp); + return GL_TRUE; + + driDriverAPI.UnbindContext(pcp); assert(pdp); if (pdp->refcount == 0) { @@ -96,63 +301,48 @@ static int driUnbindContext(__DRIcontext *pcp) dri_put_drawable(pdp); if (prp != pdp) { - if (prp->refcount == 0) { + if (prp->refcount == 0) { /* ERROR!!! */ return GL_FALSE; } - dri_put_drawable(prp); + dri_put_drawable(prp); } - /* XXX this is disabled so that if we call SwapBuffers on an unbound * window we can determine the last context bound to the window and * use that context's lock. (BrianP, 2-Dec-2000) */ - pcp->driDrawablePriv = pcp->driReadablePriv = NULL; + pcp->driDrawablePriv = NULL; + pcp->driReadablePriv = NULL; return GL_TRUE; } -/** - * This function takes both a read buffer and a draw buffer. This is needed - * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent - * function. - */ -static int driBindContext(__DRIcontext *pcp, - __DRIdrawable *pdp, - __DRIdrawable *prp) -{ - __DRIscreen *psp = NULL; +/*@}*/ - /* - ** Assume error checking is done properly in glXMakeCurrent before - ** calling driUnbindContext. - */ - if (!pcp) - return GL_FALSE; +static void dri_get_drawable(__DRIdrawable *pdp) +{ + pdp->refcount++; +} - /* Bind the drawable to the context */ - psp = pcp->driScreenPriv; - pcp->driDrawablePriv = pdp; - pcp->driReadablePriv = prp; +static void dri_put_drawable(__DRIdrawable *pdp) +{ if (pdp) { - pdp->driContextPriv = pcp; - dri_get_drawable(pdp); - } - if (prp && pdp != prp) { - dri_get_drawable(prp); - } + pdp->refcount--; + if (pdp->refcount) + return; - /* Call device-specific MakeCurrent */ - return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); + driDriverAPI.DestroyBuffer(pdp); + free(pdp); + } } static __DRIdrawable * dri2CreateNewDrawable(__DRIscreen *screen, const __DRIconfig *config, - void *loaderPrivate) + void *data) { __DRIdrawable *pdraw; @@ -160,15 +350,18 @@ dri2CreateNewDrawable(__DRIscreen *screen, if (!pdraw) return NULL; + pdraw->loaderPrivate = data; + + pdraw->driScreenPriv = screen; pdraw->driContextPriv = NULL; - pdraw->loaderPrivate = loaderPrivate; - pdraw->refcount = 1; + pdraw->refcount = 0; pdraw->lastStamp = 0; pdraw->w = 0; pdraw->h = 0; - pdraw->driScreenPriv = screen; - if (!(*screen->DriverAPI.CreateBuffer)(screen, pdraw, &config->modes, 0)) { + dri_get_drawable(pdraw); + + if (!driDriverAPI.CreateBuffer(screen, pdraw, &config->modes, GL_FALSE)) { free(pdraw); return NULL; } @@ -178,19 +371,25 @@ dri2CreateNewDrawable(__DRIscreen *screen, return pdraw; } +static void +driDestroyDrawable(__DRIdrawable *pdp) +{ + dri_put_drawable(pdp); +} + static __DRIbuffer * dri2AllocateBuffer(__DRIscreen *screen, unsigned int attachment, unsigned int format, int width, int height) { - return (*screen->DriverAPI.AllocateBuffer)(screen, attachment, format, - width, height); + return driDriverAPI.AllocateBuffer(screen, attachment, format, + width, height); } static void dri2ReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer) { - (*screen->DriverAPI.ReleaseBuffer)(screen, buffer); + driDriverAPI.ReleaseBuffer(screen, buffer); } @@ -228,232 +427,12 @@ dri2ConfigQueryf(__DRIscreen *screen, const char *var, GLfloat *val) return 0; } - -static void dri_get_drawable(__DRIdrawable *pdp) -{ - pdp->refcount++; -} - -static void dri_put_drawable(__DRIdrawable *pdp) -{ - __DRIscreen *psp; - - if (pdp) { - pdp->refcount--; - if (pdp->refcount) - return; - - psp = pdp->driScreenPriv; - (*psp->DriverAPI.DestroyBuffer)(pdp); - free(pdp); - } -} - -static void -driDestroyDrawable(__DRIdrawable *pdp) -{ - dri_put_drawable(pdp); -} - -/*@}*/ - - -/*****************************************************************/ -/** \name Context handling functions */ -/*****************************************************************/ -/*@{*/ - -/** - * Destroy the per-context private information. - * - * \internal - * This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls - * drmDestroyContext(), and finally frees \p contextPrivate. - */ -static void -driDestroyContext(__DRIcontext *pcp) -{ - if (pcp) { - (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); - free(pcp); - } -} - static unsigned int dri2GetAPIMask(__DRIscreen *screen) { return screen->api_mask; } -static __DRIcontext * -dri2CreateNewContextForAPI(__DRIscreen *screen, int api, - const __DRIconfig *config, - __DRIcontext *shared, void *data) -{ - __DRIcontext *context; - const struct gl_config *modes = (config != NULL) ? &config->modes : NULL; - void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; - gl_api mesa_api; - - if (!(screen->api_mask & (1 << api))) - return NULL; - - switch (api) { - case __DRI_API_OPENGL: - mesa_api = API_OPENGL; - break; - case __DRI_API_GLES: - mesa_api = API_OPENGLES; - break; - case __DRI_API_GLES2: - mesa_api = API_OPENGLES2; - break; - default: - return NULL; - } - - context = malloc(sizeof *context); - if (!context) - return NULL; - - context->driScreenPriv = screen; - context->driDrawablePriv = NULL; - context->loaderPrivate = data; - - if (!(*screen->DriverAPI.CreateContext)(mesa_api, modes, - context, shareCtx) ) { - free(context); - return NULL; - } - - return context; -} - - -static __DRIcontext * -dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, - __DRIcontext *shared, void *data) -{ - return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL, - config, shared, data); -} - -static int -driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) -{ - (void) dest; - (void) src; - (void) mask; - return GL_FALSE; -} - -/*@}*/ - - -/*****************************************************************/ -/** \name Screen handling functions */ -/*****************************************************************/ -/*@{*/ - -/** - * Destroy the per-screen private information. - * - * \internal - * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls - * drmClose(), and finally frees \p screenPrivate. - */ -static void driDestroyScreen(__DRIscreen *psp) -{ - if (psp) { - /* No interaction with the X-server is possible at this point. This - * routine is called after XCloseDisplay, so there is no protocol - * stream open to the X-server anymore. - */ - - _mesa_destroy_shader_compiler(); - - if (psp->DriverAPI.DestroyScreen) - (*psp->DriverAPI.DestroyScreen)(psp); - - driDestroyOptionCache(&psp->optionCache); - driDestroyOptionInfo(&psp->optionInfo); - - free(psp); - } -} - -static void -setupLoaderExtensions(__DRIscreen *psp, - const __DRIextension **extensions) -{ - int i; - - for (i = 0; extensions[i]; i++) { - if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0) - psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i]; - if (strcmp(extensions[i]->name, __DRI_IMAGE_LOOKUP) == 0) - psp->dri2.image = (__DRIimageLookupExtension *) extensions[i]; - if (strcmp(extensions[i]->name, __DRI_USE_INVALIDATE) == 0) - psp->dri2.useInvalidate = (__DRIuseInvalidateExtension *) extensions[i]; - } -} - -/** - * DRI2 - */ -static __DRIscreen * -dri2CreateNewScreen(int scrn, int fd, - const __DRIextension **extensions, - const __DRIconfig ***driver_configs, void *data) -{ - static const __DRIextension *emptyExtensionList[] = { NULL }; - __DRIscreen *psp; - drmVersionPtr version; - - if (driDriverAPI.InitScreen2 == NULL) - return NULL; - - psp = calloc(1, sizeof(*psp)); - if (!psp) - return NULL; - - setupLoaderExtensions(psp, extensions); - - version = drmGetVersion(fd); - if (version) { - psp->drm_version.major = version->version_major; - psp->drm_version.minor = version->version_minor; - psp->drm_version.patch = version->version_patchlevel; - drmFreeVersion(version); - } - - psp->extensions = emptyExtensionList; - psp->fd = fd; - psp->myNum = scrn; - - psp->DriverAPI = driDriverAPI; - psp->api_mask = (1 << __DRI_API_OPENGL); - *driver_configs = driDriverAPI.InitScreen2(psp); - if (*driver_configs == NULL) { - free(psp); - return NULL; - } - - psp->DriverAPI = driDriverAPI; - psp->loaderPrivate = data; - - driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions, - __dri2NConfigOptions); - driParseConfigFiles(&psp->optionCache, &psp->optionInfo, psp->myNum, - "dri2"); - - return psp; -} - -static const __DRIextension **driGetExtensions(__DRIscreen *psp) -{ - return psp->extensions; -} /** Core interface */ const __DRIcoreExtension driCoreExtension = { diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h index 7a3b0a9b2..bebb021f6 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.h +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h @@ -44,24 +44,25 @@ * \author Brian Paul */ +/** + * The following structs are shared between DRISW and DRI2, the DRISW structs + * are essentially base classes of the DRI2 structs. DRISW needs to compile on + * platforms without DRM, so keep the structs opaque to DRM. + */ + #ifndef _DRI_UTIL_H_ #define _DRI_UTIL_H_ #include -#include -#include -#include -#include "xmlconfig.h" -#include "main/glheader.h" +#include #include "main/mtypes.h" -#include "GL/internal/dri_interface.h" - -#define GLX_BAD_CONTEXT 5 +#include "xmlconfig.h" /** * Extensions. */ extern const __DRIcoreExtension driCoreExtension; +extern const __DRIswrastExtension driSWRastExtension; extern const __DRIdri2Extension driDRI2Extension; extern const __DRI2configQueryExtension dri2ConfigQueryExtension; @@ -76,56 +77,37 @@ extern const __DRI2configQueryExtension dri2ConfigQueryExtension; * this structure. */ struct __DriverAPIRec { - /** - * Screen destruction callback - */ + const __DRIconfig **(*InitScreen) (__DRIscreen * priv); + void (*DestroyScreen)(__DRIscreen *driScrnPriv); - /** - * Context creation callback - */ GLboolean (*CreateContext)(gl_api api, - const struct gl_config *glVis, - __DRIcontext *driContextPriv, + const struct gl_config *glVis, + __DRIcontext *driContextPriv, void *sharedContextPrivate); - /** - * Context destruction callback - */ void (*DestroyContext)(__DRIcontext *driContextPriv); - /** - * Buffer (drawable) creation callback - */ GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, const struct gl_config *glVis, GLboolean pixmapBuffer); - - /** - * Buffer (drawable) destruction callback - */ + void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); - /** - * Context activation callback - */ + void (*SwapBuffers)(__DRIdrawable *driDrawPriv); + GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, __DRIdrawable *driDrawPriv, __DRIdrawable *driReadPriv); - /** - * Context unbinding callback - */ GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); - /* DRI2 Entry point */ - const __DRIconfig **(*InitScreen2) (__DRIscreen * priv); - __DRIbuffer *(*AllocateBuffer) (__DRIscreen *screenPrivate, - unsigned int attachment, - unsigned int format, - int width, int height); + unsigned int attachment, + unsigned int format, + int width, int height); + void (*ReleaseBuffer) (__DRIscreen *screenPrivate, __DRIbuffer *buffer); }; @@ -133,59 +115,54 @@ extern const struct __DriverAPIRec driDriverAPI; /** - * Per-drawable private DRI driver information. + * Per-screen private driver information. */ -struct __DRIdrawableRec { +struct __DRIscreenRec { /** - * Driver's private drawable information. - * - * This structure is opaque. + * Current screen's number */ - void *driverPrivate; + int myNum; /** - * Private data from the loader. We just hold on to it and pass - * it back when calling into loader provided functions. + * File descriptor returned when the kernel device driver is opened. + * + * Used to: + * - authenticate client to kernel + * - map the frame buffer, SAREA, etc. + * - close the kernel device driver */ - void *loaderPrivate; + int fd; /** - * Reference count for number of context's currently bound to this - * drawable. - * - * Once it reaches zero, the drawable can be destroyed. - * - * \note This behavior will change with GLX 1.3. + * DRM (kernel module) version information. */ - int refcount; + __DRIversion drm_version; /** - * Last value of the stamp. - * - * If this differs from the value stored at __DRIdrawable::dri2.stamp, - * then the drawable information has been modified by the X server, and the - * drawable information (below) should be retrieved from the X server. + * Device-dependent private information (not stored in the SAREA). + * + * This pointer is never touched by the DRI layer. */ - unsigned int lastStamp; + void *driverPrivate; - int w, h; + void *loaderPrivate; - /** - * Pointer to context to which this drawable is currently bound. - */ - __DRIcontext *driContextPriv; + const __DRIextension **extensions; - /** - * Pointer to screen on which this drawable was created. - */ - __DRIscreen *driScreenPriv; + const __DRIswrastLoaderExtension *swrast_loader; - /** - * Drawable timestamp. Increased when the loader calls invalidate. - */ struct { - unsigned int stamp; + /* Flag to indicate that this is a DRI2 screen. Many of the above + * fields will not be valid or initializaed in that case. */ + __DRIdri2LoaderExtension *loader; + __DRIimageLookupExtension *image; + __DRIuseInvalidateExtension *useInvalidate; } dri2; + + driOptionCache optionInfo; + driOptionCache optionCache; + + unsigned int api_mask; }; /** @@ -197,6 +174,11 @@ struct __DRIcontextRec { */ void *driverPrivate; + /** + * The loaders's private context data. This structure is opaque. + */ + void *loaderPrivate; + /** * Pointer to drawable currently bound to this context for drawing. */ @@ -212,11 +194,6 @@ struct __DRIcontextRec { */ __DRIscreen *driScreenPriv; - /** - * The loaders's private context data. This structure is opaque. - */ - void *loaderPrivate; - struct { int draw_stamp; int read_stamp; @@ -224,59 +201,59 @@ struct __DRIcontextRec { }; /** - * Per-screen private driver information. + * Per-drawable private DRI driver information. */ -struct __DRIscreenRec { +struct __DRIdrawableRec { /** - * Current screen's number + * Driver's private drawable information. + * + * This structure is opaque. */ - int myNum; + void *driverPrivate; /** - * Callback functions into the hardware-specific DRI driver code. + * Private data from the loader. We just hold on to it and pass + * it back when calling into loader provided functions. */ - struct __DriverAPIRec DriverAPI; + void *loaderPrivate; - const __DRIextension **extensions; + /** + * Pointer to context to which this drawable is currently bound. + */ + __DRIcontext *driContextPriv; /** - * DRM (kernel module) version information. + * Pointer to screen on which this drawable was created. */ - __DRIversion drm_version; + __DRIscreen *driScreenPriv; /** - * File descriptor returned when the kernel device driver is opened. - * - * Used to: - * - authenticate client to kernel - * - map the frame buffer, SAREA, etc. - * - close the kernel device driver + * Reference count for number of context's currently bound to this + * drawable. + * + * Once it reaches zero, the drawable can be destroyed. + * + * \note This behavior will change with GLX 1.3. */ - int fd; + int refcount; /** - * Device-dependent private information (not stored in the SAREA). - * - * This pointer is never touched by the DRI layer. + * Last value of the stamp. + * + * If this differs from the value stored at __DRIdrawable::dri2.stamp, + * then the drawable information has been modified by the X server, and the + * drawable information (below) should be retrieved from the X server. */ -#ifdef __cplusplus - void *priv; -#else - void *private; -#endif + unsigned int lastStamp; + int w, h; + + /** + * Drawable timestamp. Increased when the loader calls invalidate. + */ struct { - /* Flag to indicate that this is a DRI2 screen. Many of the above - * fields will not be valid or initializaed in that case. */ - __DRIdri2LoaderExtension *loader; - __DRIimageLookupExtension *image; - __DRIuseInvalidateExtension *useInvalidate; + unsigned int stamp; } dri2; - - driOptionCache optionInfo; - driOptionCache optionCache; - unsigned int api_mask; - void *loaderPrivate; }; extern void diff --git a/mesalib/src/mesa/drivers/dri/common/drisw_util.c b/mesalib/src/mesa/drivers/dri/common/drisw_util.c index 1bdb6d893..614339eeb 100644 --- a/mesalib/src/mesa/drivers/dri/common/drisw_util.c +++ b/mesalib/src/mesa/drivers/dri/common/drisw_util.c @@ -27,7 +27,7 @@ * DRISW utility functions, i.e. dri_util.c stripped from drm-specific bits. */ -#include "drisw_util.h" +#include "dri_util.h" #include "utils.h" @@ -54,20 +54,19 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; - (void) data; - psp = CALLOC_STRUCT(__DRIscreenRec); if (!psp) return NULL; setupLoaderExtensions(psp, extensions); + psp->loaderPrivate = data; + psp->extensions = emptyExtensionList; psp->fd = -1; psp->myNum = scrn; *driver_configs = driDriverAPI.InitScreen(psp); - if (*driver_configs == NULL) { FREE(psp); return NULL; @@ -80,7 +79,6 @@ static void driDestroyScreen(__DRIscreen *psp) { if (psp) { driDriverAPI.DestroyScreen(psp); - FREE(psp); } } @@ -95,38 +93,13 @@ static const __DRIextension **driGetExtensions(__DRIscreen *psp) * Context functions */ -static __DRIcontext * -driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, - __DRIcontext *shared, void *data) -{ - __DRIcontext *pcp; - void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; - - pcp = CALLOC_STRUCT(__DRIcontextRec); - if (!pcp) - return NULL; - - pcp->loaderPrivate = data; - - pcp->driScreenPriv = psp; - pcp->driDrawablePriv = NULL; - pcp->driReadablePriv = NULL; - - if (!driDriverAPI.CreateContext(API_OPENGL, - &config->modes, pcp, shareCtx)) { - FREE(pcp); - return NULL; - } - - return pcp; -} - static __DRIcontext * driCreateNewContextForAPI(__DRIscreen *psp, int api, const __DRIconfig *config, __DRIcontext *shared, void *data) { __DRIcontext *pcp; + const struct gl_config *modes = (config != NULL) ? &config->modes : NULL; void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; gl_api mesa_api; @@ -154,8 +127,7 @@ driCreateNewContextForAPI(__DRIscreen *psp, int api, pcp->driDrawablePriv = NULL; pcp->driReadablePriv = NULL; - if (!driDriverAPI.CreateContext(mesa_api, - &config->modes, pcp, shareCtx)) { + if (!driDriverAPI.CreateContext(mesa_api, modes, pcp, shareCtx)) { FREE(pcp); return NULL; } @@ -163,6 +135,14 @@ driCreateNewContextForAPI(__DRIscreen *psp, int api, return pcp; } +static __DRIcontext * +driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + return driCreateNewContextForAPI(psp, __DRI_API_OPENGL, + config, shared, data); +} + static void driDestroyContext(__DRIcontext *pcp) { @@ -193,7 +173,7 @@ static int driBindContext(__DRIcontext *pcp, pdp->driContextPriv = pcp; dri_get_drawable(pdp); } - if ( prp && pdp != prp ) { + if (prp && pdp != prp) { dri_get_drawable(prp); } } @@ -248,7 +228,6 @@ static void dri_put_drawable(__DRIdrawable *pdp) return; driDriverAPI.DestroyBuffer(pdp); - FREE(pdp); } } diff --git a/mesalib/src/mesa/drivers/dri/common/drisw_util.h b/mesalib/src/mesa/drivers/dri/common/drisw_util.h deleted file mode 100644 index cae47e1f6..000000000 --- a/mesalib/src/mesa/drivers/dri/common/drisw_util.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * Copyright 2010 George Sapountzis - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS 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 - * BRIAN PAUL 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * @file - * Binding of the DRI interface (dri_interface.h) for DRISW. - * - * The DRISW structs are 'base classes' of the corresponding DRI1 / DRI2 (DRM) - * structs. The bindings for SW and DRM can be unified by making the DRM structs - * 'sub-classes' of the SW structs, either proper or with field re-ordering. - * - * The code can also be unified but that requires cluttering the common code - * with ifdef's and guarding with (__DRIscreen::fd >= 0) for DRM. - */ - -#ifndef _DRISW_UTIL_H -#define _DRISW_UTIL_H - -#include "main/mtypes.h" - -#include -#include -typedef struct _drmLock drmLock; - - -/** - * Extensions - */ -extern const __DRIcoreExtension driCoreExtension; -extern const __DRIswrastExtension driSWRastExtension; - - -/** - * Driver callback functions - */ -struct __DriverAPIRec { - const __DRIconfig **(*InitScreen) (__DRIscreen * priv); - - void (*DestroyScreen)(__DRIscreen *driScrnPriv); - - GLboolean (*CreateContext)(gl_api glapi, - const struct gl_config *glVis, - __DRIcontext *driContextPriv, - void *sharedContextPrivate); - - void (*DestroyContext)(__DRIcontext *driContextPriv); - - GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, - __DRIdrawable *driDrawPriv, - const struct gl_config *glVis, - GLboolean pixmapBuffer); - - void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); - - void (*SwapBuffers)(__DRIdrawable *driDrawPriv); - - GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, - __DRIdrawable *driDrawPriv, - __DRIdrawable *driReadPriv); - - GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); -}; - -extern const struct __DriverAPIRec driDriverAPI; - - -/** - * Data types - */ -struct __DRIscreenRec { - int myNum; - - int fd; - - void *private; - - const __DRIextension **extensions; - - const __DRIswrastLoaderExtension *swrast_loader; -}; - -struct __DRIcontextRec { - - void *driverPrivate; - - void *loaderPrivate; - - __DRIdrawable *driDrawablePriv; - - __DRIdrawable *driReadablePriv; - - __DRIscreen *driScreenPriv; -}; - -struct __DRIdrawableRec { - - void *driverPrivate; - - void *loaderPrivate; - - __DRIcontext *driContextPriv; - - __DRIscreen *driScreenPriv; - - int refcount; - - /* gallium */ - unsigned int lastStamp; - - int w; - int h; -}; - -#endif /* _DRISW_UTIL_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c index d8656a784..328f56b50 100644 --- a/mesalib/src/mesa/drivers/dri/common/utils.c +++ b/mesalib/src/mesa/drivers/dri/common/utils.c @@ -37,29 +37,6 @@ #include "utils.h" -/** - * Print message to \c stderr if the \c LIBGL_DEBUG environment variable - * is set. - * - * Is called from the drivers. - * - * \param f \c printf like format string. - */ -void -__driUtilMessage(const char *f, ...) -{ - va_list args; - - if (getenv("LIBGL_DEBUG")) { - fprintf(stderr, "libGL: "); - va_start(args, f); - vfprintf(stderr, f, args); - va_end(args); - fprintf(stderr, "\n"); - } -} - - unsigned driParseDebugString( const char * debug, const struct dri_debug_control * control ) diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h index c2302de5d..9d6eb3037 100644 --- a/mesalib/src/mesa/drivers/dri/common/utils.h +++ b/mesalib/src/mesa/drivers/dri/common/utils.h @@ -32,16 +32,11 @@ #include #include "main/context.h" -typedef struct __DRIutilversionRec2 __DRIutilversion2; - struct dri_debug_control { const char * string; unsigned flag; }; -extern void -__driUtilMessage(const char *f, ...); - extern unsigned driParseDebugString( const char * debug, const struct dri_debug_control * control ); diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c index 12dd31bb1..6d1d5ec61 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c +++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c @@ -420,6 +420,28 @@ static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) return GL_FALSE; } +/** + * Print message to \c stderr if the \c LIBGL_DEBUG environment variable + * is set. + * + * Is called from the drivers. + * + * \param f \c printf like format string. + */ +static void +__driUtilMessage(const char *f, ...) +{ + va_list args; + + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL: "); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + fprintf(stderr, "\n"); + } +} + /** \brief Output a warning message. */ #define XML_WARNING1(msg) do {\ __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \ diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h index 50e6a83d5..b57012aef 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h @@ -30,7 +30,7 @@ #include #include #include "main/mtypes.h" -#include "drisw_util.h" +#include "dri_util.h" /** diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index beb5e7cab..1a8854b9b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -480,6 +480,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_save_viewport(cso); cso_save_fragment_shader(cso); cso_save_vertex_shader(cso); + cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); cso_save_vertex_buffers(cso); @@ -493,6 +494,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, /* vertex shader state: position + texcoord pass-through */ cso_set_vertex_shader_handle(cso, st->bitmap.vs); + /* geometry shader state: disabled */ + cso_set_geometry_shader_handle(cso, NULL); + /* user samplers, plus our bitmap sampler */ { struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; @@ -556,6 +560,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_restore_viewport(cso); cso_restore_fragment_shader(cso); cso_restore_vertex_shader(cso); + cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); cso_restore_vertex_buffers(cso); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 83802a5ea..19a87aae2 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -246,6 +246,7 @@ clear_with_quad(struct gl_context *ctx, cso_save_clip(st->cso_context); cso_save_fragment_shader(st->cso_context); cso_save_vertex_shader(st->cso_context); + cso_save_geometry_shader(st->cso_context); cso_save_vertex_elements(st->cso_context); cso_save_vertex_buffers(st->cso_context); @@ -321,6 +322,7 @@ clear_with_quad(struct gl_context *ctx, cso_set_clip(st->cso_context, &st->clear.clip); set_fragment_shader(st); set_vertex_shader(st); + cso_set_geometry_shader_handle(st->cso_context, NULL); if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { st_translate_color(ctx->Color.ClearColor.f, @@ -340,6 +342,7 @@ clear_with_quad(struct gl_context *ctx, cso_restore_clip(st->cso_context); cso_restore_fragment_shader(st->cso_context); cso_restore_vertex_shader(st->cso_context); + cso_restore_geometry_shader(st->cso_context); cso_restore_vertex_elements(st->cso_context); cso_restore_vertex_buffers(st->cso_context); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 89e0a73f1..1c44d0d87 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -671,6 +671,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_save_fragment_sampler_views(cso); cso_save_fragment_shader(cso); cso_save_vertex_shader(cso); + cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); cso_save_vertex_buffers(cso); if (write_stencil) { @@ -720,6 +721,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, /* vertex shader state: position + texcoord pass-through */ cso_set_vertex_shader_handle(cso, driver_vp); + /* geometry shader state: disabled */ + cso_set_geometry_shader_handle(cso, NULL); /* texture sampling state: */ { @@ -789,6 +792,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_restore_fragment_sampler_views(cso); cso_restore_fragment_shader(cso); cso_restore_vertex_shader(cso); + cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); cso_restore_vertex_buffers(cso); if (write_stencil) { diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index 86ceb9d78..eff195068 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -230,6 +230,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, cso_save_viewport(cso); cso_save_vertex_shader(cso); + cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); cso_save_vertex_buffers(cso); @@ -238,6 +239,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, semantic_names, semantic_indexes); cso_set_vertex_shader_handle(cso, vs); } + cso_set_geometry_shader_handle(cso, NULL); for (i = 0; i < numAttribs; i++) { velements[i].src_offset = i * 4 * sizeof(float); @@ -278,6 +280,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, /* restore state */ cso_restore_viewport(cso); cso_restore_vertex_shader(cso); + cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); cso_restore_vertex_buffers(cso); } diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index af8cc0476..3563e1d9b 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -555,7 +555,8 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.ARB_vertex_type_2_10_10_10_rev = GL_TRUE; } - if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { + if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, + PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { #if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */ ctx->Extensions.ARB_geometry_shader4 = GL_TRUE; #endif diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 6b841f1e9..529f5f64a 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -79,6 +79,12 @@ extern "C" { (1 << PROGRAM_CONSTANT) | \ (1 << PROGRAM_UNIFORM)) +/** + * Maximum number of temporary registers. + * + * It is too big for stack allocated arrays -- it will cause stack overflow on + * Windows and likely Mac OS X. + */ #define MAX_TEMPS 4096 /* will be 4 for GLSL 4.00 */ @@ -3004,9 +3010,13 @@ glsl_to_tgsi_visitor::remove_output_reads(gl_register_file type) GLint outputMap[VERT_RESULT_MAX]; GLint outputTypes[VERT_RESULT_MAX]; GLuint numVaryingReads = 0; - GLboolean usedTemps[MAX_TEMPS]; + GLboolean *usedTemps; GLuint firstTemp = 0; + usedTemps = new GLboolean[MAX_TEMPS]; + if (!usedTemps) { + return; + } _mesa_find_used_registers(prog, PROGRAM_TEMPORARY, usedTemps, MAX_TEMPS); @@ -3039,6 +3049,8 @@ glsl_to_tgsi_visitor::remove_output_reads(gl_register_file type) } } + delete [] usedTemps; + if (numVaryingReads == 0) return; /* nothing to be done */ @@ -3110,9 +3122,13 @@ get_src_arg_mask(st_dst_reg dst, st_src_reg src) void glsl_to_tgsi_visitor::simplify_cmp(void) { - unsigned tempWrites[MAX_TEMPS]; + unsigned *tempWrites; unsigned outputWrites[MAX_PROGRAM_OUTPUTS]; + tempWrites = new unsigned[MAX_TEMPS]; + if (!tempWrites) { + return; + } memset(tempWrites, 0, sizeof(tempWrites)); memset(outputWrites, 0, sizeof(outputWrites)); @@ -3128,7 +3144,7 @@ glsl_to_tgsi_visitor::simplify_cmp(void) inst->op == TGSI_OPCODE_END || inst->op == TGSI_OPCODE_ENDSUB || inst->op == TGSI_OPCODE_RET) { - return; + break; } if (inst->dst.file == PROGRAM_OUTPUT) { @@ -3153,6 +3169,8 @@ glsl_to_tgsi_visitor::simplify_cmp(void) inst->src[0] = inst->src[1]; } } + + delete [] tempWrites; } /* Replaces all references to a temporary register index with another index. */ @@ -4580,14 +4598,19 @@ st_translate_program( const ubyte outputSemanticIndex[], boolean passthrough_edgeflags) { - struct st_translate translate, *t; + struct st_translate *t; unsigned i; enum pipe_error ret = PIPE_OK; assert(numInputs <= Elements(t->inputs)); assert(numOutputs <= Elements(t->outputs)); - t = &translate; + t = CALLOC_STRUCT(st_translate); + if (!t) { + ret = PIPE_ERROR_OUT_OF_MEMORY; + goto out; + } + memset(t, 0, sizeof *t); t->procType = procType; @@ -4642,7 +4665,8 @@ st_translate_program( break; default: assert(!"fragment shader outputs must be POSITION/STENCIL/COLOR"); - return PIPE_ERROR_BAD_INPUT; + ret = PIPE_ERROR_BAD_INPUT; + goto out; } } } @@ -4823,13 +4847,17 @@ st_translate_program( } out: - FREE(t->insn); - FREE(t->labels); - FREE(t->constants); - FREE(t->immediates); + if (t) { + FREE(t->insn); + FREE(t->labels); + FREE(t->constants); + FREE(t->immediates); + + if (t->error) { + debug_printf("%s: translate error flag set\n", __FUNCTION__); + } - if (t->error) { - debug_printf("%s: translate error flag set\n", __FUNCTION__); + FREE(t); } return ret; diff --git a/mesalib/src/mesa/swrast/s_readpix.c b/mesalib/src/mesa/swrast/s_readpix.c index c36746caf..50422dbd5 100644 --- a/mesalib/src/mesa/swrast/s_readpix.c +++ b/mesalib/src/mesa/swrast/s_readpix.c @@ -305,7 +305,7 @@ static GLboolean fast_read_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height, - GLvoid *dst, int dstStride) + GLubyte *dst, int dstStride) { struct gl_framebuffer *fb = ctx->ReadBuffer; struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; -- cgit v1.2.3