summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-06-08 08:31:58 -0700
committerEric Anholt <[email protected]>2018-06-14 16:52:25 -0700
commit31548187cf761e27035f36e376da33c338458b2d (patch)
tree26868ace47c916b70fa3659436f08b8321a2d861
parent0eef4d7f8fd2fc4d1a0dc0d1a583cbccbd9349d6 (diff)
v3d: Add static asserts for other packed packet sizes.
-rw-r--r--src/gallium/drivers/v3d/v3dx_draw.c1
-rw-r--r--src/gallium/drivers/v3d/v3dx_state.c6
2 files changed, 7 insertions, 0 deletions
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