glsl/cs: Prohibit mixing of compute and non-compute shaders.
authorPaul Berry <stereotype441@gmail.com>
Wed, 8 Jan 2014 19:40:23 +0000 (11:40 -0800)
committerPaul Berry <stereotype441@gmail.com>
Wed, 5 Feb 2014 17:05:01 +0000 (09:05 -0800)
Fixes piglit test:
spec/ARB_compute_shader/linker/mix_compute_and_non_compute

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/glsl/linker.cpp

index 6a07e4ab0d1e2db17f103c0cde2d51f20787de33..bcd7394768f5c0e997d3edff22981ee55a1f6bb0 100644 (file)
@@ -2109,6 +2109,13 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
       goto done;
    }
 
+   /* Compute shaders have additional restrictions. */
+   if (num_shaders[MESA_SHADER_COMPUTE] > 0 &&
+       num_shaders[MESA_SHADER_COMPUTE] != prog->NumShaders) {
+      linker_error(prog, "Compute shaders may not be linked with any other "
+                   "type of shader\n");
+   }
+
    for (unsigned int i = 0; i < MESA_SHADER_STAGES; i++) {
       if (prog->_LinkedShaders[i] != NULL)
         ctx->Driver.DeleteShader(ctx, prog->_LinkedShaders[i]);