diff options
author | Matt Turner <[email protected]> | 2012-11-23 00:03:59 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2012-11-27 10:40:49 -0800 |
commit | 7c2060f0f08134e8c4ea00af94f59c18f30d05e2 (patch) | |
tree | 8dbd881de1b352742c2f82006030cdc0d4cdbdc7 /src/mesa/main | |
parent | f65741721bcd7064e428ae2c47811fba150b1480 (diff) |
mesa: Return 0 for XFB_VARYING_MAX_LENGTH if no varyings
v2: Perform this count the same way as elsewhere in this file, per
Brian Paul's review.
Fixes part of es3conform's transform_feedback_init_defaults test.
NOTE: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/shaderapi.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 7271150154a..5c0a923e498 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -180,25 +180,6 @@ validate_shader_target(const struct gl_context *ctx, GLenum type) } -/** - * Find the length of the longest transform feedback varying name - * which was specified with glTransformFeedbackVaryings(). - */ -static GLint -longest_feedback_varying_name(const struct gl_shader_program *shProg) -{ - GLuint i; - GLint max = 0; - for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { - GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]); - if (len > max) - max = len; - } - return max; -} - - - static GLboolean is_program(struct gl_context *ctx, GLuint name) { @@ -538,11 +519,24 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param break; *params = shProg->TransformFeedback.NumVarying; return; - case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: + case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: { + unsigned i; + GLint max_len = 0; if (!has_xfb) break; - *params = longest_feedback_varying_name(shProg) + 1; + + for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) { + /* Add one for the terminating NUL character. + */ + const GLint len = strlen(shProg->TransformFeedback.VaryingNames[i]) + 1; + + if (len > max_len) + max_len = len; + } + + *params = max_len; return; + } case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: if (!has_xfb) break; |