From f29f0ae8383888a6493b615edc3bab254cf6df39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 22 May 2007 12:26:02 -0400 Subject: [PATCH] Move new texOffset extension to the new extension mechanism. --- include/GL/internal/dri_interface.h | 29 ++++++++++++--------- src/mesa/drivers/dri/common/dri_util.c | 3 --- src/mesa/drivers/dri/radeon/radeon_screen.c | 14 +++++++--- src/mesa/drivers/dri/radeon/radeon_screen.h | 2 +- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 46f1f441d01..1efae11d621 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -63,6 +63,7 @@ typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; typedef struct __DRIallocateExtensionRec __DRIallocateExtension; typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension; typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension; +typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; /*@}*/ @@ -169,6 +170,22 @@ struct __DRImediaStreamCounterExtensionRec { }; +#define __DRI_TEX_OFFSET "DRI_TexOffset" +struct __DRItexOffsetExtensionRec { + __DRIextension base; + + /** + * Method to override base texture image with a driver specific 'offset'. + * The depth passed in allows e.g. to ignore the alpha channel of texture + * images where the non-alpha components don't occupy a whole texel. + * + * For GLX_EXT_texture_from_pixmap with AIGLX. + */ + void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, + unsigned long long offset, GLint depth, GLuint pitch); +}; + + /** * Macros for building symbol and strings. Standard CPP two step... */ @@ -379,18 +396,6 @@ struct __DRIscreenRec { int render_type, __DRIcontext *shared, drm_context_t hwContext, __DRIcontext *pctx); - - /** - * Method to override base texture image with a driver specific 'offset'. - * The depth passed in allows e.g. to ignore the alpha channel of texture - * images where the non-alpha components don't occupy a whole texel. - * - * For GLX_EXT_texture_from_pixmap with AIGLX. - * - * \since Internal API version 20070121. - */ - void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, - unsigned long long offset, GLint depth, GLuint pitch); }; /** diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 20fee27f0a2..22093219785 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -752,9 +752,6 @@ void * __DRI_CREATE_NEW_SCREEN( int scrn, __DRIscreen *psc, psc->createNewDrawable = driCreateNewDrawable; psc->createNewContext = driCreateNewContext; - if (internal_api_version >= 20070121) - psc->setTexOffset = psp->DriverAPI.setTexOffset; - *driver_modes = __driDriverInitScreen(psp); if (*driver_modes == NULL) { _mesa_free(psp); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 269620cec47..84c6885d50f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -333,14 +333,19 @@ radeonFillInModes( unsigned pixel_bits, unsigned depth_bits, } #if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200) - static const __DRIallocateExtension r200AllocateExtension = { { __DRI_ALLOCATE }, r200AllocateMemoryMESA, r200FreeMemoryMESA, r200GetMemoryOffsetMESA }; +#endif +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) +static const __DRItexOffsetExtension r300texOffsetExtension = { + { __DRI_TEX_OFFSET }, + r300SetTexOffset, +}; #endif /* Create the device specific screen private data struct. @@ -755,6 +760,10 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv ) screen->extensions[i++] = &r200AllocateExtension.base; #endif +#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) + screen->extensions[i++] = &r300texOffsetExtension.base; +#endif + screen->extensions[i++] = NULL; sPriv->extensions = screen->extensions; @@ -956,9 +965,6 @@ static struct __DriverAPIRec radeonAPI = { .WaitForSBC = NULL, .SwapBuffersMSC = NULL, .CopySubBuffer = radeonCopySubBuffer, -#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300) - .setTexOffset = r300SetTexOffset, -#endif }; #else static const struct __DriverAPIRec r200API = { diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h b/src/mesa/drivers/dri/radeon/radeon_screen.h index 68755c985a6..184b0d225ef 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.h +++ b/src/mesa/drivers/dri/radeon/radeon_screen.h @@ -104,7 +104,7 @@ typedef struct { /* Configuration cache with default values for all contexts */ driOptionCache optionCache; - const __DRIextension *extensions[7]; + const __DRIextension *extensions[8]; } radeonScreenRec, *radeonScreenPtr; #define IS_R100_CLASS(screen) \ -- 2.30.2