[Mesa-dev] [PATCH 13/20] i915: Use c99 initializers for primitive arrays
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Mon Mar 23 05:47:29 PDT 2015
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Using c99 initializers for the primitive arrays makes things more
readable.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
src/mesa/drivers/dri/i915/intel_render.c | 60 ++++++++++++++++----------------
src/mesa/drivers/dri/i915/intel_tris.c | 40 ++++++++++-----------
2 files changed, 50 insertions(+), 50 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/intel_render.c b/src/mesa/drivers/dri/i915/intel_render.c
index d06f75a..65ecd05 100644
--- a/src/mesa/drivers/dri/i915/intel_render.c
+++ b/src/mesa/drivers/dri/i915/intel_render.c
@@ -70,42 +70,42 @@
#define HAVE_ELTS 0
static const uint32_t hw_prim[GL_POLYGON + 1] = {
- 0,
- PRIM3D_LINELIST,
- PRIM3D_LINESTRIP,
- PRIM3D_LINESTRIP,
- PRIM3D_TRILIST,
- PRIM3D_TRISTRIP,
- PRIM3D_TRIFAN,
- 0,
- 0,
- PRIM3D_POLY
+ [GL_POINTS] = 0,
+ [GL_LINES ] = PRIM3D_LINELIST,
+ [GL_LINE_LOOP] = PRIM3D_LINESTRIP,
+ [GL_LINE_STRIP] = PRIM3D_LINESTRIP,
+ [GL_TRIANGLES] = PRIM3D_TRILIST,
+ [GL_TRIANGLE_STRIP] = PRIM3D_TRISTRIP,
+ [GL_TRIANGLE_FAN] = PRIM3D_TRIFAN,
+ [GL_QUADS] = 0,
+ [GL_QUAD_STRIP] = 0,
+ [GL_POLYGON] = PRIM3D_POLY,
};
static const GLenum reduced_prim[GL_POLYGON + 1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
+ [GL_POINTS] = GL_POINTS,
+ [GL_LINES] = GL_LINES,
+ [GL_LINE_LOOP] = GL_LINES,
+ [GL_LINE_STRIP] = GL_LINES,
+ [GL_TRIANGLES] = GL_TRIANGLES,
+ [GL_TRIANGLE_STRIP] = GL_TRIANGLES,
+ [GL_TRIANGLE_FAN] = GL_TRIANGLES,
+ [GL_QUADS] = GL_TRIANGLES,
+ [GL_QUAD_STRIP] = GL_TRIANGLES,
+ [GL_POLYGON] = GL_TRIANGLES,
};
static const int scale_prim[GL_POLYGON + 1] = {
- 0, /* fallback case */
- 1,
- 2,
- 2,
- 1,
- 3,
- 3,
- 0, /* fallback case */
- 0, /* fallback case */
- 3
+ [GL_POINTS] = 0, /* fallback case */
+ [GL_LINES] = 1,
+ [GL_LINE_LOOP] = 2,
+ [GL_LINE_STRIP] = 2,
+ [GL_TRIANGLES] = 1,
+ [GL_TRIANGLE_STRIP] = 3,
+ [GL_TRIANGLE_FAN] = 3,
+ [GL_QUADS] = 0, /* fallback case */
+ [GL_QUAD_STRIP] = 0, /* fallback case */
+ [GL_POLYGON] = 3,
};
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index 13d60b6..2d91ca8 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -701,16 +701,16 @@ do { \
***********************************************************************/
static const GLuint hw_prim[GL_POLYGON + 1] = {
- PRIM3D_POINTLIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST
+ [GL_POINTS] = PRIM3D_POINTLIST,
+ [GL_LINES] = PRIM3D_LINELIST,
+ [GL_LINE_LOOP] = PRIM3D_LINELIST,
+ [GL_LINE_STRIP] = PRIM3D_LINELIST,
+ [GL_TRIANGLES] = PRIM3D_TRILIST,
+ [GL_TRIANGLE_STRIP] = PRIM3D_TRILIST,
+ [GL_TRIANGLE_FAN] = PRIM3D_TRILIST,
+ [GL_QUADS] = PRIM3D_TRILIST,
+ [GL_QUAD_STRIP] = PRIM3D_TRILIST,
+ [GL_POLYGON] = PRIM3D_TRILIST,
};
#define RASTERIZE(x) intelRasterPrimitive( ctx, x, hw_prim[x] )
@@ -1067,16 +1067,16 @@ intelChooseRenderState(struct gl_context * ctx)
}
static const GLenum reduced_prim[GL_POLYGON + 1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
+ [GL_POINTS] = GL_POINTS,
+ [GL_LINES] = GL_LINES,
+ [GL_LINE_LOOP] = GL_LINES,
+ [GL_LINE_STRIP] = GL_LINES,
+ [GL_TRIANGLES] = GL_TRIANGLES,
+ [GL_TRIANGLE_STRIP] = GL_TRIANGLES,
+ [GL_TRIANGLE_FAN] = GL_TRIANGLES,
+ [GL_QUADS] = GL_TRIANGLES,
+ [GL_QUAD_STRIP] = GL_TRIANGLES,
+ [GL_POLYGON] = GL_TRIANGLES
};
--
2.0.5
More information about the mesa-dev
mailing list