From: Eric Anholt Date: Fri, 8 Jun 2018 15:31:58 +0000 (-0700) Subject: v3d: Add static asserts for other packed packet sizes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=31548187cf761e27035f36e376da33c338458b2d;p=mesa.git v3d: Add static asserts for other packed packet sizes. --- diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c index 4d872b30ec3..c89ebda2aad 100644 --- a/src/gallium/drivers/v3d/v3dx_draw.c +++ b/src/gallium/drivers/v3d/v3dx_draw.c @@ -278,6 +278,7 @@ v3d_emit_gl_shader_state(struct v3d_context *v3d, attr.maximum_index = 0xffffff; #endif } + STATIC_ASSERT(sizeof(vtx->attrs) >= VC5_MAX_ATTRIBUTES * size); } if (vtx->num_elements == 0) { diff --git a/src/gallium/drivers/v3d/v3dx_state.c b/src/gallium/drivers/v3d/v3dx_state.c index e48e0f3767d..26bd06e4df7 100644 --- a/src/gallium/drivers/v3d/v3dx_state.c +++ b/src/gallium/drivers/v3d/v3dx_state.c @@ -194,6 +194,8 @@ v3d_create_depth_stencil_alpha_state(struct pipe_context *pctx, const struct pipe_stencil_state *back = &cso->stencil[1]; if (front->enabled) { + STATIC_ASSERT(sizeof(so->stencil_front) >= + cl_packet_length(STENCIL_CONFIG)); v3dx_pack(&so->stencil_front, STENCIL_CONFIG, config) { config.front_config = true; /* If !back->enabled, then the front values should be @@ -214,6 +216,8 @@ v3d_create_depth_stencil_alpha_state(struct pipe_context *pctx, } } if (back->enabled) { + STATIC_ASSERT(sizeof(so->stencil_back) >= + cl_packet_length(STENCIL_CONFIG)); v3dx_pack(&so->stencil_back, STENCIL_CONFIG, config) { config.front_config = false; config.back_config = true; @@ -699,6 +703,8 @@ v3d_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc, v3dx_pack(map, TEXTURE_SHADER_STATE, tex) { #else /* V3D_VERSION < 40 */ + STATIC_ASSERT(sizeof(so->texture_shader_state) >= + cl_packet_length(TEXTURE_SHADER_STATE)); v3dx_pack(&so->texture_shader_state, TEXTURE_SHADER_STATE, tex) { #endif