Merge branch 'llvm-cliptest-viewport'
[mesa.git] / src / mesa / drivers / dri / common / texmem.c
index c9c3324ed92df2ebb67cde9ba9e678f61635bb0b..8eec07d5bcc611494f5e9be6dd46b95afa41d4b4 100644 (file)
  * application.
  */
 
-#include "texmem.h"
-#include "main/simple_list.h"
 #include "main/imports.h"
 #include "main/macros.h"
-#include "main/texformat.h"
-
-#include <assert.h>
-
+#include "main/simple_list.h"
+#include "texmem.h"
 
 
 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;
@@ -1302,8 +1298,8 @@ 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.
  */
 /*@{*/
 gl_format _dri_texformat_rgba8888 = MESA_FORMAT_NONE;
@@ -1312,23 +1308,21 @@ 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_NONE;
-gl_format _dri_texformat_ci8 = MESA_FORMAT_NONE;
-gl_format _dri_texformat_i8 = MESA_FORMAT_NONE;
-gl_format _dri_texformat_l8 = 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) {
+   if (_mesa_little_endian()) {
       _dri_texformat_rgba8888  = MESA_FORMAT_RGBA8888;
       _dri_texformat_argb8888  = MESA_FORMAT_ARGB8888;
       _dri_texformat_rgb565    = MESA_FORMAT_RGB565;