⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tdfx_context.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 3 页
字号:
	 newFx->width = 0;         tdfxUpdateClipping(newCtx);         tdfxUploadClipping(newFx);	 UNLOCK_HARDWARE( newFx );      } else {	 LOCK_HARDWARE( newFx );	 newFx->Glide.grSstSelect( newFx->Glide.Board );	 newFx->Glide.grGlideSetState( newFx->Glide.State );         tdfxUpdateClipping(newCtx);         tdfxUploadClipping(newFx);	 UNLOCK_HARDWARE( newFx );      }      _mesa_make_current( newCtx,                          (GLframebuffer *) driDrawPriv->driverPrivate,                          (GLframebuffer *) driReadPriv->driverPrivate );   } else {      _mesa_make_current( NULL, NULL, NULL );   }   return GL_TRUE;}/* * Enable this to trace calls to various Glide functions. *//*#define DEBUG_TRAP*/#ifdef DEBUG_TRAPstatic void (*real_grDrawTriangle)( const void *a, const void *b, const void *c );static void (*real_grDrawPoint)( const void *a );static void (*real_grDrawVertexArray)(FxU32 mode, FxU32 Count, void *pointers);static void (*real_grDrawVertexArrayContiguous)(FxU32 mode, FxU32 Count,                                       void *pointers, FxU32 stride);static void (*real_grClipWindow)( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy );static void (*real_grVertexLayout)(FxU32 param, FxI32 offset, FxU32 mode);static void (*real_grGlideGetVertexLayout)( void *layout );static void (*real_grGlideSetVertexLayout)( const void *layout );static void (*real_grTexDownloadMipMapLevel)( GrChipID_t        tmu,                                     FxU32             startAddress,                                     GrLOD_t           thisLod,                                     GrLOD_t           largeLod,                                     GrAspectRatio_t   aspectRatio,                                     GrTextureFormat_t format,                                     FxU32             evenOdd,                                              void              *data );static void debug_grDrawTriangle( const void *a, const void *b, const void *c ){   printf("%s\n", __FUNCTION__);   (*real_grDrawTriangle)(a, b, c);}static void debug_grDrawPoint( const void *a ){   const float *f = (const float *) a;   printf("%s %g %g\n", __FUNCTION__, f[0], f[1]);   (*real_grDrawPoint)(a);}static void debug_grDrawVertexArray(FxU32 mode, FxU32 Count, void *pointers){   printf("%s count=%d\n", __FUNCTION__, (int) Count);   (*real_grDrawVertexArray)(mode, Count, pointers);}static void debug_grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count,                                       void *pointers, FxU32 stride){   printf("%s mode=0x%x count=%d\n", __FUNCTION__, (int) mode, (int) Count);   (*real_grDrawVertexArrayContiguous)(mode, Count, pointers, stride);}static void debug_grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy ){   printf("%s %d,%d .. %d,%d\n", __FUNCTION__,          (int) minx, (int) miny, (int) maxx, (int) maxy);   (*real_grClipWindow)(minx, miny, maxx, maxy);}static void debug_grVertexLayout(FxU32 param, FxI32 offset, FxU32 mode){   (*real_grVertexLayout)(param, offset, mode);}static void debug_grGlideGetVertexLayout( void *layout ){   (*real_grGlideGetVertexLayout)(layout);}static void debug_grGlideSetVertexLayout( const void *layout ){   (*real_grGlideSetVertexLayout)(layout);}static void debug_grTexDownloadMipMapLevel( GrChipID_t        tmu,                                     FxU32             startAddress,                                     GrLOD_t           thisLod,                                     GrLOD_t           largeLod,                                     GrAspectRatio_t   aspectRatio,                                     GrTextureFormat_t format,                                     FxU32             evenOdd,                                     void              *data ){   (*real_grTexDownloadMipMapLevel)(tmu, startAddress, thisLod, largeLod,                                    aspectRatio, format, evenOdd, data);}#endif/* * Examine the context's deviceID to determine what kind of 3dfx hardware * is installed.  dlopen() the appropriate Glide library and initialize * this context's Glide function pointers. * Return:  true/false = success/failure */GLboolean tdfxInitGlide(tdfxContextPtr tmesa){   static const char *defaultGlide = "libglide3.so";   const char *libName;   void *libHandle;   /*    * XXX this code which selects a Glide library filename given the    * deviceID may need to be cleaned up a bit.    * Non-Linux systems may have different filenames, for example.    */   switch (tmesa->fxScreen->deviceID) {   case PCI_CHIP_BANSHEE:   case PCI_CHIP_VOODOO3:      libName = "libglide3-v3.so";      break;   case PCI_CHIP_VOODOO5:   /* same as PCI_CHIP_VOODOO4 */      libName = "libglide3-v5.so";      break;   default:      {         __driUtilMessage("unrecognized 3dfx deviceID: 0x%x",                 tmesa->fxScreen->deviceID);      }      return GL_FALSE;   }   libHandle = dlopen(libName, RTLD_NOW);   if (!libHandle) {      /* The device-specific Glide library filename didn't work, try the       * old, generic libglide3.so library.       */      libHandle = dlopen(defaultGlide, RTLD_NOW);       if (!libHandle) {         __driUtilMessage(            "can't find Glide library, dlopen(%s) and dlopen(%s) both failed.",            libName, defaultGlide);         __driUtilMessage("dlerror() message: %s", dlerror());         return GL_FALSE;      }      libName = defaultGlide;   }   {      const char *env = getenv("LIBGL_DEBUG");      if (env && strstr(env, "verbose")) {         fprintf(stderr, "libGL: using Glide library %s\n", libName);      }   }         #define GET_FUNCTION(PTR, NAME)						\   tmesa->Glide.PTR = dlsym(libHandle, NAME);				\   if (!tmesa->Glide.PTR) {						\      __driUtilMessage("couldn't find Glide function %s in %s.",	\              NAME, libName);						\   }   GET_FUNCTION(grDrawPoint, "grDrawPoint");   GET_FUNCTION(grDrawLine, "grDrawLine");   GET_FUNCTION(grDrawTriangle, "grDrawTriangle");   GET_FUNCTION(grVertexLayout, "grVertexLayout");   GET_FUNCTION(grDrawVertexArray, "grDrawVertexArray");   GET_FUNCTION(grDrawVertexArrayContiguous, "grDrawVertexArrayContiguous");   GET_FUNCTION(grBufferClear, "grBufferClear");   /*GET_FUNCTION(grBufferSwap, "grBufferSwap");*/   GET_FUNCTION(grRenderBuffer, "grRenderBuffer");   GET_FUNCTION(grErrorSetCallback, "grErrorSetCallback");   GET_FUNCTION(grFinish, "grFinish");   GET_FUNCTION(grFlush, "grFlush");   GET_FUNCTION(grSstWinOpen, "grSstWinOpen");   GET_FUNCTION(grSstWinClose, "grSstWinClose");#if 0   /* Not in V3 lib, and not used anyway. */   GET_FUNCTION(grSetNumPendingBuffers, "grSetNumPendingBuffers");#endif   GET_FUNCTION(grSelectContext, "grSelectContext");   GET_FUNCTION(grSstOrigin, "grSstOrigin");   GET_FUNCTION(grSstSelect, "grSstSelect");   GET_FUNCTION(grAlphaBlendFunction, "grAlphaBlendFunction");   GET_FUNCTION(grAlphaCombine, "grAlphaCombine");   GET_FUNCTION(grAlphaControlsITRGBLighting, "grAlphaControlsITRGBLighting");   GET_FUNCTION(grAlphaTestFunction, "grAlphaTestFunction");   GET_FUNCTION(grAlphaTestReferenceValue, "grAlphaTestReferenceValue");   GET_FUNCTION(grChromakeyMode, "grChromakeyMode");   GET_FUNCTION(grChromakeyValue, "grChromakeyValue");   GET_FUNCTION(grClipWindow, "grClipWindow");   GET_FUNCTION(grColorCombine, "grColorCombine");   GET_FUNCTION(grColorMask, "grColorMask");   GET_FUNCTION(grCullMode, "grCullMode");   GET_FUNCTION(grConstantColorValue, "grConstantColorValue");   GET_FUNCTION(grDepthBiasLevel, "grDepthBiasLevel");   GET_FUNCTION(grDepthBufferFunction, "grDepthBufferFunction");   GET_FUNCTION(grDepthBufferMode, "grDepthBufferMode");   GET_FUNCTION(grDepthMask, "grDepthMask");   GET_FUNCTION(grDisableAllEffects, "grDisableAllEffects");   GET_FUNCTION(grDitherMode, "grDitherMode");   GET_FUNCTION(grFogColorValue, "grFogColorValue");   GET_FUNCTION(grFogMode, "grFogMode");   GET_FUNCTION(grFogTable, "grFogTable");   GET_FUNCTION(grLoadGammaTable, "grLoadGammaTable");   GET_FUNCTION(grSplash, "grSplash");   GET_FUNCTION(grGet, "grGet");   GET_FUNCTION(grGetString, "grGetString");   GET_FUNCTION(grQueryResolutions, "grQueryResolutions");   GET_FUNCTION(grReset, "grReset");   GET_FUNCTION(grGetProcAddress, "grGetProcAddress");   GET_FUNCTION(grEnable, "grEnable");   GET_FUNCTION(grDisable, "grDisable");   GET_FUNCTION(grCoordinateSpace, "grCoordinateSpace");   GET_FUNCTION(grDepthRange, "grDepthRange");   GET_FUNCTION(grStippleMode, "grStippleMode");   GET_FUNCTION(grStipplePattern, "grStipplePattern");   GET_FUNCTION(grViewport, "grViewport");   GET_FUNCTION(grTexCalcMemRequired, "grTexCalcMemRequired");   GET_FUNCTION(grTexTextureMemRequired, "grTexTextureMemRequired");   GET_FUNCTION(grTexMinAddress, "grTexMinAddress");   GET_FUNCTION(grTexMaxAddress, "grTexMaxAddress");   GET_FUNCTION(grTexNCCTable, "grTexNCCTable");   GET_FUNCTION(grTexSource, "grTexSource");   GET_FUNCTION(grTexClampMode, "grTexClampMode");   GET_FUNCTION(grTexCombine, "grTexCombine");   GET_FUNCTION(grTexDetailControl, "grTexDetailControl");   GET_FUNCTION(grTexFilterMode, "grTexFilterMode");   GET_FUNCTION(grTexLodBiasValue, "grTexLodBiasValue");   GET_FUNCTION(grTexDownloadMipMap, "grTexDownloadMipMap");   GET_FUNCTION(grTexDownloadMipMapLevel, "grTexDownloadMipMapLevel");   GET_FUNCTION(grTexDownloadMipMapLevelPartial, "grTexDownloadMipMapLevelPartial");   GET_FUNCTION(grTexDownloadTable, "grTexDownloadTable");   GET_FUNCTION(grTexDownloadTablePartial, "grTexDownloadTablePartial");   GET_FUNCTION(grTexMipMapMode, "grTexMipMapMode");   GET_FUNCTION(grTexMultibase, "grTexMultibase");   GET_FUNCTION(grTexMultibaseAddress, "grTexMultibaseAddress");   GET_FUNCTION(grLfbLock, "grLfbLock");   GET_FUNCTION(grLfbUnlock, "grLfbUnlock");   GET_FUNCTION(grLfbConstantAlpha, "grLfbConstantAlpha");   GET_FUNCTION(grLfbConstantDepth, "grLfbConstantDepth");   GET_FUNCTION(grLfbWriteColorSwizzle, "grLfbWriteColorSwizzle");   GET_FUNCTION(grLfbWriteColorFormat, "grLfbWriteColorFormat");   GET_FUNCTION(grLfbWriteRegion, "grLfbWriteRegion");   GET_FUNCTION(grLfbReadRegion, "grLfbReadRegion");   GET_FUNCTION(grGlideInit, "grGlideInit");   GET_FUNCTION(grGlideShutdown, "grGlideShutdown");   GET_FUNCTION(grGlideGetState, "grGlideGetState");   GET_FUNCTION(grGlideSetState, "grGlideSetState");   GET_FUNCTION(grGlideGetVertexLayout, "grGlideGetVertexLayout");   GET_FUNCTION(grGlideSetVertexLayout, "grGlideSetVertexLayout");   /* Glide utility functions */   GET_FUNCTION(guFogGenerateExp, "guFogGenerateExp");   GET_FUNCTION(guFogGenerateExp2, "guFogGenerateExp2");   GET_FUNCTION(guFogGenerateLinear, "guFogGenerateLinear");   /* DRI functions */   GET_FUNCTION(grDRIOpen, "grDRIOpen");   GET_FUNCTION(grDRIPosition, "grDRIPosition");   /*GET_FUNCTION(grDRILostContext, "grDRILostContext");*/   GET_FUNCTION(grDRIImportFifo, "grDRIImportFifo");   GET_FUNCTION(grDRIInvalidateAll, "grDRIInvalidateAll");   GET_FUNCTION(grDRIResetSAREA, "grDRIResetSAREA");   GET_FUNCTION(grDRIBufferSwap, "grDRIBufferSwap");   /*    * Extension functions:    * Just use dlysm() because we want a NULL pointer if the function is    * not found.    */   /* PIXEXT extension */   tmesa->Glide.grStencilFunc = dlsym(libHandle, "grStencilFunc");   tmesa->Glide.grStencilMask = dlsym(libHandle, "grStencilMask");   tmesa->Glide.grStencilOp = dlsym(libHandle, "grStencilOp");   tmesa->Glide.grBufferClearExt = dlsym(libHandle, "grBufferClearExt");   tmesa->Glide.grColorMaskExt = dlsym(libHandle, "grColorMaskExt");   /* COMBINE extension */   tmesa->Glide.grColorCombineExt = dlsym(libHandle, "grColorCombineExt");   tmesa->Glide.grTexColorCombineExt = dlsym(libHandle, "grTexColorCombineExt");   tmesa->Glide.grAlphaCombineExt = dlsym(libHandle, "grAlphaCombineExt");   tmesa->Glide.grTexAlphaCombineExt = dlsym(libHandle, "grTexAlphaCombineExt");   tmesa->Glide.grAlphaBlendFunctionExt = dlsym(libHandle, "grAlphaBlendFunctionExt");   tmesa->Glide.grConstantColorValueExt = dlsym(libHandle, "grConstantColorValueExt");   /* Texus 2 */   tmesa->Glide.txImgQuantize = dlsym(libHandle, "txImgQuantize");   tmesa->Glide.txImgDequantizeFXT1 = dlsym(libHandle, "_txImgDequantizeFXT1");   tmesa->Glide.txErrorSetCallback = dlsym(libHandle, "txErrorSetCallback");   #ifdef DEBUG_TRAP   /* wrap the drawing functions so we can trap them */   real_grDrawTriangle = tmesa->Glide.grDrawTriangle;   tmesa->Glide.grDrawTriangle = debug_grDrawTriangle;   real_grDrawPoint = tmesa->Glide.grDrawPoint;   tmesa->Glide.grDrawPoint = debug_grDrawPoint;   real_grDrawVertexArray = tmesa->Glide.grDrawVertexArray;   tmesa->Glide.grDrawVertexArray = debug_grDrawVertexArray;   real_grDrawVertexArrayContiguous = tmesa->Glide.grDrawVertexArrayContiguous;   tmesa->Glide.grDrawVertexArrayContiguous = debug_grDrawVertexArrayContiguous;   real_grClipWindow = tmesa->Glide.grClipWindow;   tmesa->Glide.grClipWindow = debug_grClipWindow;   real_grVertexLayout = tmesa->Glide.grVertexLayout;   tmesa->Glide.grVertexLayout = debug_grVertexLayout;   real_grGlideGetVertexLayout = tmesa->Glide.grGlideGetVertexLayout;   tmesa->Glide.grGlideGetVertexLayout = debug_grGlideGetVertexLayout;   real_grGlideSetVertexLayout = tmesa->Glide.grGlideSetVertexLayout;   tmesa->Glide.grGlideSetVertexLayout = debug_grGlideSetVertexLayout;   real_grTexDownloadMipMapLevel = tmesa->Glide.grTexDownloadMipMapLevel;   tmesa->Glide.grTexDownloadMipMapLevel = debug_grTexDownloadMipMapLevel;#endif   return GL_TRUE;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -