From: Brian Paul Date: Fri, 27 Jul 2012 21:45:27 +0000 (-0600) Subject: st/mesa: use STATIC_ASSERT in a few places X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=322a2938f320f8a39cb6d86f249a339625a8772a;p=mesa.git st/mesa: use STATIC_ASSERT in a few places --- diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c index 2a51100984a..a1a7e003a66 100644 --- a/src/mesa/state_tracker/st_atom_clip.c +++ b/src/mesa/state_tracker/st_atom_clip.c @@ -47,7 +47,7 @@ static void update_clip( struct st_context *st ) const struct gl_context *ctx = st->ctx; bool use_eye = FALSE; - assert(sizeof(clip.ucp) <= sizeof(ctx->Transform._ClipUserPlane)); + STATIC_ASSERT(sizeof(clip.ucp) <= sizeof(ctx->Transform._ClipUserPlane)); /* if we have a vertex shader that writes clip vertex we need to pass the pre-projection transformed coordinates into the driver. */ diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 6c51b1ac1a2..373e1584b85 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -49,16 +49,16 @@ GLuint st_compare_func_to_pipe(GLenum func) { /* Same values, just biased */ - assert(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER); - assert(PIPE_FUNC_LESS == GL_LESS - GL_NEVER); - assert(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER); - assert(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER); - assert(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER); - assert(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER); - assert(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER); - assert(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER); - assert(func >= GL_NEVER); - assert(func <= GL_ALWAYS); + STATIC_ASSERT(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER); + STATIC_ASSERT(PIPE_FUNC_LESS == GL_LESS - GL_NEVER); + STATIC_ASSERT(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER); + STATIC_ASSERT(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER); + STATIC_ASSERT(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER); + STATIC_ASSERT(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER); + STATIC_ASSERT(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER); + STATIC_ASSERT(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER); + STATIC_ASSERT(func >= GL_NEVER); + STATIC_ASSERT(func <= GL_ALWAYS); return func - GL_NEVER; } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 117ea90f80d..6b7c047ed01 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -211,9 +211,9 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, struct dd_function_table funcs; /* Sanity checks */ - assert(MESA_SHADER_VERTEX == PIPE_SHADER_VERTEX); - assert(MESA_SHADER_FRAGMENT == PIPE_SHADER_FRAGMENT); - assert(MESA_SHADER_GEOMETRY == PIPE_SHADER_GEOMETRY); + STATIC_ASSERT(MESA_SHADER_VERTEX == PIPE_SHADER_VERTEX); + STATIC_ASSERT(MESA_SHADER_FRAGMENT == PIPE_SHADER_FRAGMENT); + STATIC_ASSERT(MESA_SHADER_GEOMETRY == PIPE_SHADER_GEOMETRY); memset(&funcs, 0, sizeof(funcs)); st_init_driver_functions(&funcs); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 4dc09e7fb5c..9dc4822cc28 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -153,9 +153,9 @@ static unsigned translate_prim(const struct gl_context *ctx, unsigned prim) { /* GL prims should match Gallium prims, spot-check a few */ - assert(GL_POINTS == PIPE_PRIM_POINTS); - assert(GL_QUADS == PIPE_PRIM_QUADS); - assert(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY); + STATIC_ASSERT(GL_POINTS == PIPE_PRIM_POINTS); + STATIC_ASSERT(GL_QUADS == PIPE_PRIM_QUADS); + STATIC_ASSERT(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY); /* Avoid quadstrips if it's easy to do so: * Note: it's important to do the correct trimming if we change the