2. I notice multiple ARB_occlusion_query should be able to overlap according to spec.

3. Declaring extern variables in a .c file is evil, fix it.
This commit is contained in:
Zou Nan hai 2007-01-18 14:41:38 +08:00
parent a27d3e43fe
commit c171166987
3 changed files with 19 additions and 16 deletions

View file

@ -187,9 +187,17 @@ const struct dri_extension card_extensions[] =
{ NULL, NULL }
};
static const struct dri_extension arb_oc_extension =
const struct dri_extension arb_oc_extension =
{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions};
void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging)
{
struct intel_context *intel = ctx?intel_context(ctx):NULL;
driInitExtensions(ctx, card_extensions, enable_imaging);
if (!ctx || intel->intelScreen->drmMinor >= 8)
driInitSingleExtension (ctx, &arb_oc_extension);
}
static const struct dri_debug_control debug_control[] =
{
{ "fall", DEBUG_FALLBACKS },
@ -251,28 +259,29 @@ static void
intelBeginQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
{
struct intel_context *intel = intel_context( ctx );
GLuint64EXT tmp = 0;
drmI830MMIO io = {
.read_write = MMIO_WRITE,
.reg = MMIO_REGS_PS_DEPTH_COUNT,
.data = &tmp
.data = &q->Result
};
intel->stats_wm = GL_TRUE;
intelFinish(&intel->ctx);
drmCommandWrite(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
}
static void
intelEndQuery(GLcontext *ctx, GLenum target, struct gl_query_object *q)
{
struct intel_context *intel = intel_context( ctx );
GLuint64EXT tmp;
drmI830MMIO io = {
.read_write = MMIO_READ,
.reg = MMIO_REGS_PS_DEPTH_COUNT,
.data = &q->Result
.data = &tmp
};
intelFinish(&intel->ctx);
drmCommandRead(intel->driFd, DRM_I830_MMIO, &io, sizeof(io));
q->Result = tmp - q->Result;
q->Ready = GL_TRUE;
intel->stats_wm = GL_FALSE;
}
@ -412,12 +421,7 @@ GLboolean intelInitContext( struct intel_context *intel,
_mesa_printf("IRQs not active. Exiting\n");
exit(1);
}
driInitExtensions( ctx, card_extensions,
GL_TRUE );
if (intel->intelScreen->drmMinor >= 8)
driInitSingleExtension (ctx, &arb_oc_extension);
intelInitExtensions(ctx, GL_TRUE);
INTEL_DEBUG = driParseDebugString( getenv( "INTEL_DEBUG" ),
debug_control );
@ -696,3 +700,4 @@ void UNLOCK_HARDWARE( struct intel_context *intel )
_glthread_UNLOCK_MUTEX(lockMutex);
}

View file

@ -501,6 +501,7 @@ void intelBitmap(GLcontext * ctx,
const struct gl_pixelstore_attrib *unpack,
const GLubyte * pixels);
void intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging);
#define _NEW_WINDOW_POS 0x40000000
@ -523,6 +524,5 @@ static inline struct intel_texture_image *intel_texture_image( struct gl_texture
return (struct intel_texture_image *)img;
}
#endif

View file

@ -38,6 +38,7 @@
#include "intel_screen.h"
#include "intel_context.h"
#include "intel_tex.h"
#include "intel_span.h"
#include "intel_ioctl.h"
@ -61,8 +62,6 @@ const GLuint __driNConfigOptions = 4;
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
#endif /*USE_NEW_INTERFACE*/
extern const struct dri_extension card_extensions[];
/**
* Map all the memory regions described by the screen.
* \return GL_TRUE if success, GL_FALSE if error.
@ -687,7 +686,6 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
(dri_priv->cpp == 2) ? 16 : 24,
(dri_priv->cpp == 2) ? 0 : 8,
GL_TRUE );
/* Calling driInitExtensions here, with a NULL context pointer, does not actually
* enable the extensions. It just makes sure that all the dispatch offsets for all
* the extensions that *might* be enables are known. This is needed because the
@ -696,7 +694,7 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIsc
*
* Hello chicken. Hello egg. How are you two today?
*/
driInitExtensions( NULL, card_extensions, GL_FALSE );
intelInitExtensions(NULL, GL_FALSE);
}
return (void *) psp;