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

📄 texformat.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 4 页
字号:
   8,					/* StencilBits */   4,					/* TexelBytes */   _mesa_texstore_z24_s8,		/* StoreTexImageFunc */   NULL,				/* FetchTexel1D */   NULL,				/* FetchTexel2D */   NULL,				/* FetchTexel3D */   fetch_texel_1d_f_z24_s8,		/* FetchTexel1Df */   fetch_texel_2d_f_z24_s8,		/* FetchTexel2Df */   fetch_texel_3d_f_z24_s8,		/* FetchTexel3Df */   store_texel_z24_s8			/* StoreTexel */};const struct gl_texture_format _mesa_texformat_s8_z24 = {   MESA_FORMAT_S8_Z24,			/* MesaFormat */   GL_DEPTH_STENCIL_EXT,		/* BaseFormat */   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */   0,					/* RedBits */   0,					/* GreenBits */   0,					/* BlueBits */   0,					/* AlphaBits */   0,					/* LuminanceBits */   0,					/* IntensityBits */   0,					/* IndexBits */   24,					/* DepthBits */   8,					/* StencilBits */   4,					/* TexelBytes */   _mesa_texstore_s8_z24,		/* StoreTexImageFunc */   NULL,				/* FetchTexel1D */   NULL,				/* FetchTexel2D */   NULL,				/* FetchTexel3D */   fetch_texel_1d_f_s8_z24,		/* FetchTexel1Df */   fetch_texel_2d_f_s8_z24,		/* FetchTexel2Df */   fetch_texel_3d_f_s8_z24,		/* FetchTexel3Df */   store_texel_s8_z24			/* StoreTexel */};const struct gl_texture_format _mesa_texformat_z16 = {   MESA_FORMAT_Z16,			/* MesaFormat */   GL_DEPTH_COMPONENT,			/* BaseFormat */   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */   0,					/* RedBits */   0,					/* GreenBits */   0,					/* BlueBits */   0,					/* AlphaBits */   0,					/* LuminanceBits */   0,					/* IntensityBits */   0,					/* IndexBits */   sizeof(GLushort) * 8,		/* DepthBits */   0,					/* StencilBits */   sizeof(GLushort),			/* TexelBytes */   _mesa_texstore_z16,			/* StoreTexImageFunc */   NULL,				/* FetchTexel1D */   NULL,				/* FetchTexel1D */   NULL,				/* FetchTexel1D */   fetch_texel_1d_f_z16,		/* FetchTexel1Df */   fetch_texel_2d_f_z16,		/* FetchTexel2Df */   fetch_texel_3d_f_z16,		/* FetchTexel3Df */   store_texel_z16			/* StoreTexel */};const struct gl_texture_format _mesa_texformat_z32 = {   MESA_FORMAT_Z32,			/* MesaFormat */   GL_DEPTH_COMPONENT,			/* BaseFormat */   GL_UNSIGNED_NORMALIZED_ARB,		/* DataType */   0,					/* RedBits */   0,					/* GreenBits */   0,					/* BlueBits */   0,					/* AlphaBits */   0,					/* LuminanceBits */   0,					/* IntensityBits */   0,					/* IndexBits */   sizeof(GLuint) * 8,			/* DepthBits */   0,					/* StencilBits */   sizeof(GLuint),			/* TexelBytes */   _mesa_texstore_z32,			/* StoreTexImageFunc */   NULL,				/* FetchTexel1D */   NULL,				/* FetchTexel1D */   NULL,				/* FetchTexel1D */   fetch_texel_1d_f_z32,		/* FetchTexel1Df */   fetch_texel_2d_f_z32,		/* FetchTexel2Df */   fetch_texel_3d_f_z32,		/* FetchTexel3Df */   store_texel_z32			/* StoreTexel */};/*@}*//***************************************************************//** \name Null format (useful for proxy textures) *//*@{*/const struct gl_texture_format _mesa_null_texformat = {   -1,					/* MesaFormat */   0,					/* BaseFormat */   GL_NONE,				/* DataType */   0,					/* RedBits */   0,					/* GreenBits */   0,					/* BlueBits */   0,					/* AlphaBits */   0,					/* LuminanceBits */   0,					/* IntensityBits */   0,					/* IndexBits */   0,					/* DepthBits */   0,					/* StencilBits */   0,					/* TexelBytes */   NULL,				/* StoreTexImageFunc */   fetch_null_texel,			/* FetchTexel1D */   fetch_null_texel,			/* FetchTexel2D */   fetch_null_texel,			/* FetchTexel3D */   fetch_null_texelf,			/* FetchTexel1Df */   fetch_null_texelf,			/* FetchTexel2Df */   fetch_null_texelf,			/* FetchTexel3Df */   store_null_texel			/* StoreTexel */};/*@}*//** * Choose an appropriate texture format given the format, type and * internalFormat parameters passed to glTexImage(). * * \param ctx  the GL context. * \param internalFormat  user's prefered internal texture format. * \param format  incoming image pixel format. * \param type  incoming image data type. * * \return a pointer to a gl_texture_format object which describes the * choosen texture format, or NULL on failure. *  * This is called via dd_function_table::ChooseTextureFormat.  Hardware drivers * will typically override this function with a specialized version. */const struct gl_texture_format *_mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,                         GLenum format, GLenum type ){   (void) format;   (void) type;   switch (internalFormat) {      /* RGBA formats */      case 4:      case GL_RGBA:      case GL_RGB10_A2:      case GL_RGBA12:      case GL_RGBA16:         return &_mesa_texformat_rgba;      case GL_RGBA8:         return &_mesa_texformat_rgba8888;      case GL_RGB5_A1:         return &_mesa_texformat_argb1555;      case GL_RGBA2:         return &_mesa_texformat_argb4444_rev; /* just to test another format*/      case GL_RGBA4:         return &_mesa_texformat_argb4444;      /* RGB formats */      case 3:      case GL_RGB:      case GL_RGB10:      case GL_RGB12:      case GL_RGB16:         return &_mesa_texformat_rgb;      case GL_RGB8:         return &_mesa_texformat_rgb888;      case GL_R3_G3_B2:         return &_mesa_texformat_rgb332;      case GL_RGB4:         return &_mesa_texformat_rgb565_rev; /* just to test another format */      case GL_RGB5:         return &_mesa_texformat_rgb565;      /* Alpha formats */      case GL_ALPHA:      case GL_ALPHA4:      case GL_ALPHA12:      case GL_ALPHA16:         return &_mesa_texformat_alpha;      case GL_ALPHA8:         return &_mesa_texformat_a8;      /* Luminance formats */      case 1:      case GL_LUMINANCE:      case GL_LUMINANCE4:      case GL_LUMINANCE12:      case GL_LUMINANCE16:         return &_mesa_texformat_luminance;      case GL_LUMINANCE8:         return &_mesa_texformat_l8;      /* Luminance/Alpha formats */      case 2:      case GL_LUMINANCE_ALPHA:      case GL_LUMINANCE4_ALPHA4:      case GL_LUMINANCE6_ALPHA2:      case GL_LUMINANCE12_ALPHA4:      case GL_LUMINANCE12_ALPHA12:      case GL_LUMINANCE16_ALPHA16:         return &_mesa_texformat_luminance_alpha;      case GL_LUMINANCE8_ALPHA8:         return &_mesa_texformat_al88;      case GL_INTENSITY:      case GL_INTENSITY4:      case GL_INTENSITY12:      case GL_INTENSITY16:         return &_mesa_texformat_intensity;      case GL_INTENSITY8:         return &_mesa_texformat_i8;      case GL_COLOR_INDEX:      case GL_COLOR_INDEX1_EXT:      case GL_COLOR_INDEX2_EXT:      case GL_COLOR_INDEX4_EXT:      case GL_COLOR_INDEX12_EXT:      case GL_COLOR_INDEX16_EXT:      case GL_COLOR_INDEX8_EXT:         return &_mesa_texformat_ci8;      default:         ; /* fallthrough */   }   if (ctx->Extensions.SGIX_depth_texture ||       ctx->Extensions.ARB_depth_texture) {      switch (internalFormat) {         case GL_DEPTH_COMPONENT:         case GL_DEPTH_COMPONENT24_SGIX:         case GL_DEPTH_COMPONENT32_SGIX:            return &_mesa_texformat_z32;         case GL_DEPTH_COMPONENT16_SGIX:            return &_mesa_texformat_z16;         default:            ; /* fallthrough */      }   }   if (ctx->Extensions.ARB_texture_compression) {      switch (internalFormat) {         case GL_COMPRESSED_ALPHA_ARB:            return &_mesa_texformat_alpha;         case GL_COMPRESSED_LUMINANCE_ARB:            return &_mesa_texformat_luminance;         case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:            return &_mesa_texformat_luminance_alpha;         case GL_COMPRESSED_INTENSITY_ARB:            return &_mesa_texformat_intensity;         case GL_COMPRESSED_RGB_ARB:            if (ctx->Extensions.TDFX_texture_compression_FXT1)               return &_mesa_texformat_rgb_fxt1;            else if (ctx->Extensions.EXT_texture_compression_s3tc ||                     ctx->Extensions.S3_s3tc)               return &_mesa_texformat_rgb_dxt1;            else               return &_mesa_texformat_rgb;         case GL_COMPRESSED_RGBA_ARB:            if (ctx->Extensions.TDFX_texture_compression_FXT1)               return &_mesa_texformat_rgba_fxt1;            else if (ctx->Extensions.EXT_texture_compression_s3tc ||                     ctx->Extensions.S3_s3tc)               return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */            else               return &_mesa_texformat_rgba;         default:            ; /* fallthrough */      }   }   if (ctx->Extensions.MESA_ycbcr_texture) {      if (internalFormat == GL_YCBCR_MESA) {         if (type == GL_UNSIGNED_SHORT_8_8_MESA)            return &_mesa_texformat_ycbcr;         else            return &_mesa_texformat_ycbcr_rev;      }   }   if (ctx->Extensions.TDFX_texture_compression_FXT1) {      switch (internalFormat) {         case GL_COMPRESSED_RGB_FXT1_3DFX:            return &_mesa_texformat_rgb_fxt1;         case GL_COMPRESSED_RGBA_FXT1_3DFX:            return &_mesa_texformat_rgba_fxt1;         default:            ; /* fallthrough */      }   }   if (ctx->Extensions.EXT_texture_compression_s3tc) {      switch (internalFormat) {         case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:            return &_mesa_texformat_rgb_dxt1;         case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:            return &_mesa_texformat_rgba_dxt1;         case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:            return &_mesa_texformat_rgba_dxt3;         case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:            return &_mesa_texformat_rgba_dxt5;         default:            ; /* fallthrough */      }   }   if (ctx->Extensions.S3_s3tc) {      switch (internalFormat) {         case GL_RGB_S3TC:         case GL_RGB4_S3TC:            return &_mesa_texformat_rgb_dxt1;         case GL_RGBA_S3TC:         case GL_RGBA4_S3TC:            return &_mesa_texformat_rgba_dxt3;         default:            ; /* fallthrough */      }   }   if (ctx->Extensions.ARB_texture_float) {      switch (internalFormat) {         case GL_ALPHA16F_ARB:            return &_mesa_texformat_alpha_float16;         case GL_ALPHA32F_ARB:            return &_mesa_texformat_alpha_float32;         case GL_LUMINANCE16F_ARB:            return &_mesa_texformat_luminance_float16;         case GL_LUMINANCE32F_ARB:            return &_mesa_texformat_luminance_float32;         case GL_LUMINANCE_ALPHA16F_ARB:            return &_mesa_texformat_luminance_alpha_float16;         case GL_LUMINANCE_ALPHA32F_ARB:            return &_mesa_texformat_luminance_alpha_float32;         case GL_INTENSITY16F_ARB:            return &_mesa_texformat_intensity_float16;         case GL_INTENSITY32F_ARB:            return &_mesa_texformat_intensity_float32;         case GL_RGB16F_ARB:            return &_mesa_texformat_rgb_float16;         case GL_RGB32F_ARB:            return &_mesa_texformat_rgb_float32;         case GL_RGBA16F_ARB:            return &_mesa_texformat_rgba_float16;         case GL_RGBA32F_ARB:            return &_mesa_texformat_rgba_float32;         default:            ; /* fallthrough */      }   }   if (ctx->Extensions.EXT_packed_depth_stencil) {      switch (internalFormat) {         case GL_DEPTH_STENCIL_EXT:         case GL_DEPTH24_STENCIL8_EXT:            return &_mesa_texformat_z24_s8;         default:            ; /* fallthrough */      }   }#if FEATURE_EXT_texture_sRGB   if (ctx->Extensions.EXT_texture_sRGB) {      switch (internalFormat) {         case GL_SRGB_EXT:         case GL_SRGB8_EXT:            return &_mesa_texformat_srgb8;         case GL_SRGB_ALPHA_EXT:         case GL_SRGB8_ALPHA8_EXT:            return &_mesa_texformat_srgba8;         case GL_SLUMINANCE_EXT:         case GL_SLUMINANCE8_EXT:            return &_mesa_texformat_sl8;         case GL_SLUMINANCE_ALPHA_EXT:         case GL_SLUMINANCE8_ALPHA8_EXT:            return &_mesa_texformat_sla8;         /* NOTE: not supporting any compression of sRGB at this time */         case GL_COMPRESSED_SRGB_EXT:            return &_mesa_texformat_srgb8;         case GL_COMPRESSED_SRGB_ALPHA_EXT:            return &_mesa_texformat_srgba8;         case GL_COMPRESSED_SLUMINANCE_EXT:            return &_mesa_texformat_sl8;         case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:            return &_mesa_texformat_sla8;         case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:            return &_mesa_texformat_srgb8;         case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:         case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:         case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:            return &_mesa_texformat_srgba8;         default:            ; /* fallthrough */      }   }#endif /* FEATURE_EXT_texture_sRGB */   _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");   return NULL;}

⌨️ 快捷键说明

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