diff options
author | Kenneth Graunke <[email protected]> | 2013-09-06 15:41:19 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2013-09-12 10:19:10 -0700 |
commit | 2b71b3d4666b076ef45d03b9b4b4c527bda21e1c (patch) | |
tree | f56915e1c03885c3aea2157fa177dcb57afb2338 /src/mesa/main/shaderapi.c | |
parent | 9cc74c93f8983f978e7315e021eb59dfaca6404b (diff) |
mesa: Disallow relinking if a program is used by an active XFB object.
Paused transform feedback objects may refer to a program other than the
current program. If any active objects refer to a program, LinkProgram
must reject the request to relink.
The code to detect this is ugly since _mesa_HashWalk is awkward to use,
but unfortunately we can't use hash_table_foreach since there's no way
to get at the underlying struct hash_table (and even then, we'd need to
handle locking somehow).
Fixes the last subcase of Piglit's new ARB_transform_feedback2
api-errors test.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r-- | src/mesa/main/shaderapi.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index a2386fb133e..4c0484aaf0c 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -42,6 +42,7 @@ #include "main/dispatch.h" #include "main/enums.h" #include "main/hash.h" +#include "main/hash_table.h" #include "main/mtypes.h" #include "main/shaderapi.h" #include "main/shaderobj.h" @@ -812,19 +813,19 @@ static void link_program(struct gl_context *ctx, GLuint program) { struct gl_shader_program *shProg; - struct gl_transform_feedback_object *obj = - ctx->TransformFeedback.CurrentObject; shProg = _mesa_lookup_shader_program_err(ctx, program, "glLinkProgram"); if (!shProg) return; - if (obj->Active - && (shProg == ctx->Shader.CurrentVertexProgram - || shProg == ctx->Shader.CurrentGeometryProgram - || shProg == ctx->Shader.CurrentFragmentProgram)) { + /* From the ARB_transform_feedback2 specification: + * "The error INVALID_OPERATION is generated by LinkProgram if <program> is + * the name of a program being used by one or more transform feedback + * objects, even if the objects are not currently bound or are paused." + */ + if (_mesa_transform_feedback_is_using_program(ctx, shProg)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glLinkProgram(transform feedback active)"); + "glLinkProgram(transform feedback is using the program)"); return; } |