[Mesa-dev] [PATCH 1/3] mesa: Filter glGetProgramiv pnames based on available extensions
Matt Turner
mattst88 at gmail.com
Tue Aug 21 17:51:33 PDT 2012
On Tue, Aug 21, 2012 at 5:09 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Previously you could always glGetProgramiv one of the transform feedback or
> geometry shader enums even if the extension wasn't supported.
>
> In addtion, this reverts part of bda6ad27. I think the hunks involving
> GL_PROGRAM_BINARY_LENGTH_OES were spurious. Mesa has no support for any other
> part of GL_OES_get_program_binary.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: Brian Paul <brianp at vmware.com>
> ---
> src/mesa/main/shaderapi.c | 51 +++++++++++++++++++++++++++-----------------
> 1 files changed, 31 insertions(+), 20 deletions(-)
>
> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
> index caeb965..9ecd7c6 100644
> --- a/src/mesa/main/shaderapi.c
> +++ b/src/mesa/main/shaderapi.c
> @@ -481,28 +481,28 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
> switch (pname) {
> case GL_DELETE_STATUS:
> *params = shProg->DeletePending;
> - break;
> + return;
> case GL_LINK_STATUS:
> *params = shProg->LinkStatus;
> - break;
> + return;
> case GL_VALIDATE_STATUS:
> *params = shProg->Validated;
> - break;
> + return;
> case GL_INFO_LOG_LENGTH:
> *params = shProg->InfoLog ? strlen(shProg->InfoLog) + 1 : 0;
> - break;
> + return;
> case GL_ATTACHED_SHADERS:
> *params = shProg->NumShaders;
> - break;
> + return;
> case GL_ACTIVE_ATTRIBUTES:
> *params = _mesa_count_active_attribs(shProg);
> - break;
> + return;
> case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
> *params = _mesa_longest_attribute_name_length(shProg);
> - break;
> + return;
> case GL_ACTIVE_UNIFORMS:
> *params = shProg->NumUserUniformStorage;
> - break;
> + return;
> case GL_ACTIVE_UNIFORM_MAX_LENGTH: {
> unsigned i;
> GLint max_len = 0;
> @@ -517,32 +517,41 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
> }
>
> *params = max_len;
> - break;
> + return;
> }
> - case GL_PROGRAM_BINARY_LENGTH_OES:
> - *params = 0;
> - break;
> #if FEATURE_EXT_transform_feedback
> case GL_TRANSFORM_FEEDBACK_VARYINGS:
> + if (!ctx->Extensions.EXT_transform_feedback)
> + break;
> *params = shProg->TransformFeedback.NumVarying;
> - break;
> + return;
> case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
> + if (!ctx->Extensions.EXT_transform_feedback)
> + break;
> *params = longest_feedback_varying_name(shProg) + 1;
> - break;
> + return;
> case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
> + if (!ctx->Extensions.EXT_transform_feedback)
> + break;
> *params = shProg->TransformFeedback.BufferMode;
> - break;
> + return;
> #endif
> #if FEATURE_ARB_geometry_shader4
> case GL_GEOMETRY_VERTICES_OUT_ARB:
> + if (!ctx->Extensions.ARB_geometry_shader4)
> + break;
> *params = shProg->Geom.VerticesOut;
> - break;
> + return;
> case GL_GEOMETRY_INPUT_TYPE_ARB:
> + if (!ctx->Extensions.ARB_geometry_shader4)
> + break;
> *params = shProg->Geom.InputType;
> - break;
> + return;
> case GL_GEOMETRY_OUTPUT_TYPE_ARB:
> + if (!ctx->Extensions.ARB_geometry_shader4)
> + break;
> *params = shProg->Geom.OutputType;
> - break;
> + return;
> #endif
> case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: {
> unsigned i;
> @@ -574,9 +583,11 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
> *params = shProg->NumUniformBlocks;
> break;
> default:
> - _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
> - return;
> + break;
> }
> +
> + _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
> + return;
> }
>
>
> --
Last return is unnecessary.
More information about the mesa-dev
mailing list