X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fcommon%2Ftexmem.c;h=8eec07d5bcc611494f5e9be6dd46b95afa41d4b4;hb=cd6a31cd4a9ea6deef4778c2eaef2d47240c3a6e;hp=b4af7c96e385845c67fe87bb517cc9a02df62dbe;hpb=cc7dd4fc1b3c765ca1ecd943d189bb156dae529d;p=mesa.git diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index b4af7c96e38..8eec07d5bcc 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -42,14 +42,10 @@ * application. */ +#include "main/imports.h" +#include "main/macros.h" +#include "main/simple_list.h" #include "texmem.h" -#include "simple_list.h" -#include "imports.h" -#include "macros.h" -#include "texformat.h" - -#include - static unsigned dummy_swap_counter; @@ -93,7 +89,7 @@ driLog2( GLuint n ) */ GLboolean -driIsTextureResident( GLcontext * ctx, +driIsTextureResident( struct gl_context * ctx, struct gl_texture_object * texObj ) { driTextureObject * t; @@ -1051,7 +1047,7 @@ driCalculateMaxTextureLevels( driTexHeap * const * heaps, * \param targets Bit-mask of value texture targets */ -void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, +void driInitTextureObjects( struct gl_context *ctx, driTextureObject * swapped, GLuint targets ) { struct gl_texture_object *texObj; @@ -1063,31 +1059,31 @@ void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, ctx->Texture.CurrentUnit = i; if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current1D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_1D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current2D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_2D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current3D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_3D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) { - texObj = ctx->Texture.Unit[i].CurrentCubeMap; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_CUBE_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) { - texObj = ctx->Texture.Unit[i].CurrentRect; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_RECT_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } @@ -1302,46 +1298,44 @@ driCalculateTextureFirstLastLevel( driTextureObject * t ) /** - * \name DRI texture formats. Pointers initialized to either the big- or - * little-endian Mesa formats. + * \name DRI texture formats. These vars are initialized to either the + * big- or little-endian Mesa formats. */ /*@{*/ -const struct gl_texture_format *_dri_texformat_rgba8888 = NULL; -const struct gl_texture_format *_dri_texformat_argb8888 = NULL; -const struct gl_texture_format *_dri_texformat_rgb565 = NULL; -const struct gl_texture_format *_dri_texformat_argb4444 = NULL; -const struct gl_texture_format *_dri_texformat_argb1555 = NULL; -const struct gl_texture_format *_dri_texformat_al88 = NULL; -const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8; -const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8; -const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8; -const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8; +gl_format _dri_texformat_rgba8888 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb8888 = MESA_FORMAT_NONE; +gl_format _dri_texformat_rgb565 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb4444 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb1555 = MESA_FORMAT_NONE; +gl_format _dri_texformat_al88 = MESA_FORMAT_NONE; +gl_format _dri_texformat_a8 = MESA_FORMAT_A8; +gl_format _dri_texformat_ci8 = MESA_FORMAT_CI8; +gl_format _dri_texformat_i8 = MESA_FORMAT_I8; +gl_format _dri_texformat_l8 = MESA_FORMAT_L8; /*@}*/ /** - * Initialize little endian target, host byte order independent texture formats + * Initialize _dri_texformat_* vars according to whether we're on + * a big or little endian system. */ void driInitTextureFormats(void) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); - - if (littleEndian) { - _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888; - _dri_texformat_argb8888 = &_mesa_texformat_argb8888; - _dri_texformat_rgb565 = &_mesa_texformat_rgb565; - _dri_texformat_argb4444 = &_mesa_texformat_argb4444; - _dri_texformat_argb1555 = &_mesa_texformat_argb1555; - _dri_texformat_al88 = &_mesa_texformat_al88; + if (_mesa_little_endian()) { + _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888; + _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888; + _dri_texformat_rgb565 = MESA_FORMAT_RGB565; + _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444; + _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555; + _dri_texformat_al88 = MESA_FORMAT_AL88; } else { - _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev; - _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev; - _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev; - _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev; - _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev; - _dri_texformat_al88 = &_mesa_texformat_al88_rev; + _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888_REV; + _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888_REV; + _dri_texformat_rgb565 = MESA_FORMAT_RGB565_REV; + _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444_REV; + _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555_REV; + _dri_texformat_al88 = MESA_FORMAT_AL88_REV; } }