From: Iago Toral Quiroga Date: Fri, 6 Jun 2014 07:44:34 +0000 (+0200) Subject: glsl: Two varyings can't write to the same buffer from different streams. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e2dd717616757a74ab2835602dd7c1a6256805ed;p=mesa.git glsl: Two varyings can't write to the same buffer from different streams. If this is detected, fail to link. Reviewed-by: Chris Forbes Reviewed-by: Ian Romanick --- diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 3b20594873c..3d5a6807cdd 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -635,10 +635,27 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog, } else { /* GL_INVERLEAVED_ATTRIBS */ + int buffer_stream_id = -1; for (unsigned i = 0; i < num_tfeedback_decls; ++i) { if (tfeedback_decls[i].is_next_buffer_separator()) { num_buffers++; + buffer_stream_id = -1; continue; + } else if (buffer_stream_id == -1) { + /* First varying writing to this buffer: remember its stream */ + buffer_stream_id = (int) tfeedback_decls[i].get_stream_id(); + } else if (buffer_stream_id != + (int) tfeedback_decls[i].get_stream_id()) { + /* Varying writes to the same buffer from a different stream */ + linker_error(prog, + "Transform feedback can't capture varyings belonging " + "to different vertex streams in a single buffer. " + "Varying %s writes to buffer from stream %u, other " + "varyings in the same buffer write from stream %u.", + tfeedback_decls[i].name(), + tfeedback_decls[i].get_stream_id(), + buffer_stream_id); + return false; } if (!tfeedback_decls[i].store(ctx, prog,