mesa: add bool param to _mesa_free_context_data
[mesa.git] / src / mesa / drivers / dri / i965 / brw_util.c
index 4a303cdcb7495db14bf970531a4c018a6d16b673..90aff43e90a16afc28f0596b98be49819a6ba79a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
 /*
  Copyright (C) Intel Corp.  2006.  All Rights Reserved.
- Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
+ Intel funded Tungsten Graphics to
  develop this 3D driver.
 
  Permission is hereby granted, free of charge, to any person obtaining
  develop this 3D driver.
 
  Permission is hereby granted, free of charge, to any person obtaining
  **********************************************************************/
  /*
   * Authors:
  **********************************************************************/
  /*
   * Authors:
-  *   Keith Whitwell <keith@tungstengraphics.com>
+  *   Keith Whitwell <keithw@vmware.com>
   */
 
 
   */
 
 
-#include <assert.h>
-
-#include "main/mtypes.h"
-#include "program/prog_parameter.h"
 #include "brw_util.h"
 #include "brw_defines.h"
 #include "brw_util.h"
 #include "brw_defines.h"
+#include "compiler/brw_eu_defines.h"
 
 GLuint brw_translate_blend_equation( GLenum mode )
 {
 
 GLuint brw_translate_blend_equation( GLenum mode )
 {
@@ -51,8 +48,7 @@ GLuint brw_translate_blend_equation( GLenum mode )
    case GL_FUNC_REVERSE_SUBTRACT:
       return BRW_BLENDFUNCTION_REVERSE_SUBTRACT;
    default:
    case GL_FUNC_REVERSE_SUBTRACT:
       return BRW_BLENDFUNCTION_REVERSE_SUBTRACT;
    default:
-      assert(0);
-      return BRW_BLENDFUNCTION_ADD;
+      unreachable("not reached");
    }
 }
 
    }
 }
 
@@ -100,7 +96,30 @@ GLuint brw_translate_blend_factor( GLenum factor )
       return BRW_BLENDFACTOR_INV_SRC1_ALPHA;
 
    default:
       return BRW_BLENDFACTOR_INV_SRC1_ALPHA;
 
    default:
-      assert(0);
-      return BRW_BLENDFACTOR_ZERO;
+      unreachable("not reached");
    }
 }
    }
 }
+
+static const GLuint prim_to_hw_prim[GL_TRIANGLE_STRIP_ADJACENCY+1] = {
+   [GL_POINTS] =_3DPRIM_POINTLIST,
+   [GL_LINES] = _3DPRIM_LINELIST,
+   [GL_LINE_LOOP] = _3DPRIM_LINELOOP,
+   [GL_LINE_STRIP] = _3DPRIM_LINESTRIP,
+   [GL_TRIANGLES] = _3DPRIM_TRILIST,
+   [GL_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP,
+   [GL_TRIANGLE_FAN] = _3DPRIM_TRIFAN,
+   [GL_QUADS] = _3DPRIM_QUADLIST,
+   [GL_QUAD_STRIP] = _3DPRIM_QUADSTRIP,
+   [GL_POLYGON] = _3DPRIM_POLYGON,
+   [GL_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ,
+   [GL_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ,
+   [GL_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ,
+   [GL_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ,
+};
+
+uint32_t
+get_hw_prim_for_gl_prim(int mode)
+{
+   assert(mode < ARRAY_SIZE(prim_to_hw_prim));
+   return prim_to_hw_prim[mode];
+}