diff options
author | Ian Romanick <[email protected]> | 2012-07-24 20:13:39 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2012-08-24 09:06:31 -0700 |
commit | b042f7a1ff905a7136557f35f368166526fab9ed (patch) | |
tree | 4bd8c34a98c6a75ce69814bacac078d5f0140c18 /src/mesa/main | |
parent | 1a200b68cd57e2aee419e45ac8f1ce32e5cf8951 (diff) |
mesa/es: Validate glGetProgramiv pnames in Mesa code rather than the ES wrapper
v2: Add proper core-profile and GLES3 filtering.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/APIspec.xml | 15 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 39 |
2 files changed, 31 insertions, 23 deletions
diff --git a/src/mesa/main/APIspec.xml b/src/mesa/main/APIspec.xml index 8b5ad0330ef..7efca4d1b3e 100644 --- a/src/mesa/main/APIspec.xml +++ b/src/mesa/main/APIspec.xml @@ -1839,21 +1839,6 @@ <param name="pname" type="GLenum"/> <vector name="params" type="GLtype *" size="dynamic"/> </proto> - - <desc name="pname"> - <value name="GL_DELETE_STATUS"/> - <value name="GL_LINK_STATUS"/> - <value name="GL_VALIDATE_STATUS"/> - <value name="GL_INFO_LOG_LENGTH"/> - <value name="GL_ATTACHED_SHADERS"/> - <value name="GL_ACTIVE_ATTRIBUTES"/> - <value name="GL_ACTIVE_ATTRIBUTE_MAX_LENGTH"/> - <value name="GL_ACTIVE_UNIFORMS"/> - <value name="GL_ACTIVE_UNIFORM_MAX_LENGTH"/> - <value name="GL_PROGRAM_BINARY_LENGTH_OES" category="OES_get_program_binary"/> - - <desc name="params" convert="false"/> - </desc> </template> <template name="GetVertexAttrib" direction="get"> diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 612c1fc64c2..0049e87e1d2 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -473,6 +473,29 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program); +#if FEATURE_EXT_transform_feedback + /* Is transform feedback available in this context? + */ + const bool has_xfb = + (ctx->API == API_OPENGL && ctx->Extensions.EXT_transform_feedback) + || ctx->API == API_OPENGL_CORE + || _mesa_is_gles3(ctx); +#endif + +#if FEATURE_ARB_geometry_shader4 + /* Are geometry shaders available in this context? + */ + const bool has_gs = + _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_geometry_shader4; +#endif + + /* Are uniform buffer objects available in this context? + */ + const bool has_ubo = + (ctx->API == API_OPENGL && ctx->Extensions.ARB_uniform_buffer_object) + || ctx->API == API_OPENGL_CORE + || _mesa_is_gles3(ctx); + if (!shProg) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramiv(program)"); return; @@ -521,34 +544,34 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param } #if FEATURE_EXT_transform_feedback case GL_TRANSFORM_FEEDBACK_VARYINGS: - if (!ctx->Extensions.EXT_transform_feedback) + if (!has_xfb) break; *params = shProg->TransformFeedback.NumVarying; return; case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: - if (!ctx->Extensions.EXT_transform_feedback) + if (!has_xfb) break; *params = longest_feedback_varying_name(shProg) + 1; return; case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: - if (!ctx->Extensions.EXT_transform_feedback) + if (!has_xfb) break; *params = shProg->TransformFeedback.BufferMode; return; #endif #if FEATURE_ARB_geometry_shader4 case GL_GEOMETRY_VERTICES_OUT_ARB: - if (!ctx->Extensions.ARB_geometry_shader4) + if (!has_gs) break; *params = shProg->Geom.VerticesOut; return; case GL_GEOMETRY_INPUT_TYPE_ARB: - if (!ctx->Extensions.ARB_geometry_shader4) + if (!has_gs) break; *params = shProg->Geom.InputType; return; case GL_GEOMETRY_OUTPUT_TYPE_ARB: - if (!ctx->Extensions.ARB_geometry_shader4) + if (!has_gs) break; *params = shProg->Geom.OutputType; return; @@ -557,7 +580,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param unsigned i; GLint max_len = 0; - if (!ctx->Extensions.ARB_uniform_buffer_object) + if (!has_ubo) break; for (i = 0; i < shProg->NumUniformBlocks; i++) { @@ -573,7 +596,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param return; } case GL_ACTIVE_UNIFORM_BLOCKS: - if (!ctx->Extensions.ARB_uniform_buffer_object) + if (!has_ubo) break; *params = shProg->NumUniformBlocks; |