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 <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
1a200b68cd
commit
b042f7a1ff
|
@ -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">
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue