From e2dd717616757a74ab2835602dd7c1a6256805ed Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Fri, 6 Jun 2014 09:44:34 +0200 Subject: 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 --- src/glsl/link_varyings.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/glsl/link_varyings.cpp') 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, -- cgit v1.2.3