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

📄 sis_tex.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 2 页
字号:
	  &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555;   case GL_RGBA4:   case GL_RGBA2:      return &_mesa_texformat_argb4444;   case GL_RGB5_A1:      return &_mesa_texformat_argb1555;   case GL_RGB8:   case GL_RGB10:   case GL_RGB12:   case GL_RGB16:      return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565;   case GL_RGB5:   case GL_RGB4:      return &_mesa_texformat_rgb565;   case GL_R3_G3_B2:      return &_mesa_texformat_rgb332;   case GL_ALPHA:   case GL_ALPHA4:		/* FIXME: This could use its own texstore */   case GL_ALPHA8:   case GL_ALPHA12:   case GL_ALPHA16:   case GL_COMPRESSED_ALPHA:      return &_mesa_texformat_a8;   case 1:   case GL_LUMINANCE:   case GL_LUMINANCE4:		/* FIXME: This could use its own texstore */   case GL_LUMINANCE8:   case GL_LUMINANCE12:   case GL_LUMINANCE16:   case GL_COMPRESSED_LUMINANCE:      return &_mesa_texformat_l8;   case 2:   case GL_LUMINANCE_ALPHA:   case GL_LUMINANCE4_ALPHA4:	/* FIXME: This could use its own texstore */   case GL_LUMINANCE6_ALPHA2:	/* FIXME: This could use its own texstore */   case GL_LUMINANCE8_ALPHA8:   case GL_LUMINANCE12_ALPHA4:	/* FIXME: This could use its own texstore */   case GL_LUMINANCE12_ALPHA12:   case GL_LUMINANCE16_ALPHA16:   case GL_COMPRESSED_LUMINANCE_ALPHA:      return &_mesa_texformat_al88;   case GL_INTENSITY:   case GL_INTENSITY4:   case GL_INTENSITY8:   case GL_INTENSITY12:   case GL_INTENSITY16:   case GL_COMPRESSED_INTENSITY:      return &_mesa_texformat_i8;   case GL_YCBCR_MESA:      if (type == GL_UNSIGNED_SHORT_8_8_APPLE ||          type == GL_UNSIGNED_BYTE)         return &_mesa_texformat_ycbcr;      else         return &_mesa_texformat_ycbcr_rev;   default:      _mesa_problem(ctx, "unexpected format in sisDDChooseTextureFormat: %d",         internalFormat);      return NULL;   }}static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level,			     GLint internalFormat,			     GLint width, GLint border,			     GLenum format, GLenum type, const GLvoid *pixels,			     const struct gl_pixelstore_attrib *packing,			     struct gl_texture_object *texObj,			     struct gl_texture_image *texImage ){   sisContextPtr smesa = SIS_CONTEXT(ctx);   sisTexObjPtr t;   if ( texObj->DriverData == NULL )      sisAllocTexObj( texObj );   t = texObj->DriverData;   /* Note, this will call sisChooseTextureFormat */   _mesa_store_teximage1d( ctx, target, level, internalFormat,			   width, border, format, type,			   pixels, packing, texObj, texImage );   /* Allocate offscreen space for the texture */   sisFreeTexImage(smesa, t, level);   sisAllocTexImage(smesa, t, level, texImage);   /* Upload the texture */   WaitEngIdle(smesa);   memcpy(t->image[level].Data, texImage->Data, t->image[level].size);      if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)   {      smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;      smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;   }   smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;}static void sisTexSubImage1D( GLcontext *ctx,				GLenum target,				GLint level,				GLint xoffset,				GLsizei width,				GLenum format, GLenum type,				const GLvoid *pixels,				const struct gl_pixelstore_attrib *packing,				struct gl_texture_object *texObj,				struct gl_texture_image *texImage ){   sisContextPtr smesa = SIS_CONTEXT(ctx);   sisTexObjPtr t;   GLuint copySize;   GLint texelBytes;   const char *src;   GLubyte *dst;   if ( texObj->DriverData == NULL )      sisAllocTexObj( texObj );   t = texObj->DriverData;   _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,			     format, type, pixels, packing, texObj,			     texImage);   /* Allocate offscreen space for the texture */   sisFreeTexImage(smesa, t, level);   sisAllocTexImage(smesa, t, level, texImage);   /* Upload the texture */   WaitEngIdle(smesa);   texelBytes = texImage->TexFormat->TexelBytes;   copySize = width * texelBytes;   src = (char *)texImage->Data + xoffset * texelBytes;   dst = t->image[level].Data + xoffset * texelBytes;   memcpy( dst, src, copySize );   smesa->clearTexCache = GL_TRUE;   if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)   {      smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;      smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;   }   smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;}static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level,			     GLint internalFormat,			     GLint width, GLint height, GLint border,			     GLenum format, GLenum type, const GLvoid *pixels,			     const struct gl_pixelstore_attrib *packing,			     struct gl_texture_object *texObj,			     struct gl_texture_image *texImage ){   sisContextPtr smesa = SIS_CONTEXT(ctx);   sisTexObjPtr t;   if ( texObj->DriverData == NULL )      sisAllocTexObj( texObj );   t = texObj->DriverData;   /* Note, this will call sisChooseTextureFormat */   _mesa_store_teximage2d(ctx, target, level, internalFormat,                          width, height, border, format, type, pixels,                          &ctx->Unpack, texObj, texImage);   /* Allocate offscreen space for the texture */   sisFreeTexImage(smesa, t, level);   sisAllocTexImage(smesa, t, level, texImage);   /* Upload the texture */   WaitEngIdle(smesa);   memcpy(t->image[level].Data, texImage->Data, t->image[level].size);      if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)   {      smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;      smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;   }   smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;}static void sisTexSubImage2D( GLcontext *ctx,				GLenum target,				GLint level,				GLint xoffset, GLint yoffset,				GLsizei width, GLsizei height,				GLenum format, GLenum type,				const GLvoid *pixels,				const struct gl_pixelstore_attrib *packing,				struct gl_texture_object *texObj,				struct gl_texture_image *texImage ){   sisContextPtr smesa = SIS_CONTEXT(ctx);   sisTexObjPtr t;   GLuint copySize;   GLint texelBytes;   const char *src;   GLubyte *dst;   int j;   GLuint soffset;   if ( texObj->DriverData == NULL )      sisAllocTexObj( texObj );   t = texObj->DriverData;   _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,			     height, format, type, pixels, packing, texObj,			     texImage);   /* Allocate offscreen space for the texture */   sisFreeTexImage(smesa, t, level);   sisAllocTexImage(smesa, t, level, texImage);   /* Upload the texture */   WaitEngIdle(smesa);   texelBytes = texImage->TexFormat->TexelBytes;   copySize = width * texelBytes;   src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) *      texelBytes;   dst = t->image[level].Data + (xoffset + yoffset * texImage->Width) *      texelBytes;   soffset = texImage->Width * texelBytes;   for (j = yoffset; j < yoffset + height; j++) {      memcpy( dst, src, copySize );      src += soffset;      dst += soffset;   }   smesa->clearTexCache = GL_TRUE;   if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format)   {      smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV;      smesa->PrevTexFormat[ctx->Texture.CurrentUnit] = t->format;   }   smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURING;}/** * Allocate a new texture object. * Called via ctx->Driver.NewTextureObject. * Note: this function will be called during context creation to * allocate the default texture objects. * Note: we could use containment here to 'derive' the driver-specific * texture object from the core mesa gl_texture_object.  Not done at this time. */static struct gl_texture_object *sisNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ){   struct gl_texture_object *obj;   obj = _mesa_new_texture_object(ctx, name, target);   return obj;}void sisInitTextureFuncs( struct dd_function_table *functions ){   functions->TexEnv			= sisTexEnv;   functions->ChooseTextureFormat	= sisChooseTextureFormat;   functions->TexImage1D		= sisTexImage1D;   functions->TexSubImage1D		= sisTexSubImage1D;   functions->TexImage2D		= sisTexImage2D;   functions->TexSubImage2D		= sisTexSubImage2D;   functions->TexParameter		= sisTexParameter;   functions->BindTexture		= sisBindTexture;   functions->NewTextureObject		= sisNewTextureObject;   functions->DeleteTexture		= sisDeleteTexture;   functions->IsTextureResident	= sisIsTextureResident;}

⌨️ 快捷键说明

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