Module: Mesa Branch: master Commit: 4db8b171a5118d3ea6c773c62a40fc9cec03b1ed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4db8b171a5118d3ea6c773c62a40fc9cec03b1ed
Author: Marek Olšák <[email protected]> Date: Fri Jan 1 12:13:28 2021 -0500 mesa: add STATIC_ASSERTs to the STATE_LIGHT_ATTRIBS case Reviewed-by: Zoltán Böszörményi <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8017> --- src/mesa/program/prog_statevars.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c index e2c9039e67d..f3b5d3b07b8 100644 --- a/src/mesa/program/prog_statevars.c +++ b/src/mesa/program/prog_statevars.c @@ -134,13 +134,19 @@ fetch_state(struct gl_context *ctx, const gl_state_index16 state[], value[0] = ctx->Light.LightSource[ln].SpotCutoff; return; } - case STATE_LIGHT_ATTRIBS: + case STATE_LIGHT_ATTRIBS: { + /* This must be exact because it must match the gl_LightSource layout + * in GLSL. + */ + STATIC_ASSERT(sizeof(struct gl_light_uniforms) == 29 * 4); + STATIC_ASSERT(ARRAY_SIZE(ctx->Light.LightSourceData) == 29 * MAX_LIGHTS); /* state[1] is the index of the first value */ /* state[2] is the number of values */ assert(state[1] + state[2] <= ARRAY_SIZE(ctx->Light.LightSourceData)); memcpy(value, &ctx->Light.LightSourceData[state[1]], state[2] * sizeof(float)); return; + } case STATE_LIGHTMODEL_AMBIENT: COPY_4V(value, ctx->Light.Model.Ambient); return; _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
