summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-06-06 09:44:34 +0200
committerIago Toral Quiroga <[email protected]>2014-06-30 08:08:50 +0200
commite2dd717616757a74ab2835602dd7c1a6256805ed (patch)
treed5227f6c90cce5be8a1f0719b5cda83b1a7fc990 /src/glsl
parent1e1f071d25d67b7e82ac2248dbda419f992b10d7 (diff)
glsl: Two varyings can't write to the same buffer from different streams.
If this is detected, fail to link. Reviewed-by: Chris Forbes <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/link_varyings.cpp17
1 files changed, 17 insertions, 0 deletions
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,