v3d: Add static asserts for other packed packet sizes.

This commit is contained in:
Eric Anholt
2018-06-08 08:31:58 -07:00
parent 0eef4d7f8f
commit 31548187cf
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -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) {
+6
View File
@@ -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