diff options
author | Iago Toral Quiroga <[email protected]> | 2014-06-05 10:47:01 +0200 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2014-06-30 08:08:49 +0200 |
commit | b908e85ed3f1c7601c2e56f85ff676b606af10b5 (patch) | |
tree | 3fa27e710c7da6565c8685479df2851a9f66aa84 /src/glsl | |
parent | 37d795317edd2086a4962416c627dfadfc497f78 (diff) |
glsl: Assign GLSL StreamIds to transform feedback outputs.
Inter-shader outputs must be on stream 0, which is the default.
Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/link_varyings.cpp | 12 | ||||
-rw-r--r-- | src/glsl/link_varyings.h | 7 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index f765d37fc73..9725a434f45 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -291,6 +291,7 @@ tfeedback_decl::init(struct gl_context *ctx, const void *mem_ctx, this->skip_components = 0; this->next_buffer_separator = false; this->matched_candidate = NULL; + this->stream_id = 0; if (ctx->Extensions.ARB_transform_feedback3) { /* Parse gl_NextBuffer. */ @@ -355,8 +356,8 @@ tfeedback_decl::is_same(const tfeedback_decl &x, const tfeedback_decl &y) /** - * Assign a location for this tfeedback_decl object based on the transform - * feedback candidate found by find_candidate. + * Assign a location and stream ID for this tfeedback_decl object based on the + * transform feedback candidate found by find_candidate. * * If an error occurs, the error is reported through linker_error() and false * is returned. @@ -437,6 +438,11 @@ tfeedback_decl::assign_location(struct gl_context *ctx, return false; } + /* Only transform feedback varyings can be assigned to non-zero streams, + * so assign the stream id here. + */ + this->stream_id = this->matched_candidate->toplevel_var->data.stream; + return true; } @@ -495,7 +501,7 @@ tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog, info->Outputs[info->NumOutputs].ComponentOffset = location_frac; info->Outputs[info->NumOutputs].OutputRegister = location; info->Outputs[info->NumOutputs].NumComponents = output_size; - info->Outputs[info->NumOutputs].StreamId = 0; + info->Outputs[info->NumOutputs].StreamId = stream_id; info->Outputs[info->NumOutputs].OutputBuffer = buffer; info->Outputs[info->NumOutputs].DstOffset = info->BufferStride[buffer]; ++info->NumOutputs; diff --git a/src/glsl/link_varyings.h b/src/glsl/link_varyings.h index 6fa26817677..a80ca8831cb 100644 --- a/src/glsl/link_varyings.h +++ b/src/glsl/link_varyings.h @@ -210,6 +210,13 @@ private: * data structure that was found. Otherwise NULL. */ const tfeedback_candidate *matched_candidate; + + /** + * StreamId assigned to this varying (defaults to 0). Can only be set to + * values other than 0 in geometry shaders that use the stream layout + * modifier. Accepted values must be in the range [0, MAX_VERTEX_STREAMS-1]. + */ + unsigned stream_id; }; |