Re: [Mesa-dev] [PATCH 05/18] glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0
It may be a bit less confusing to read if I take the inner if out, so I'll rewrite it like this: if (input_var || (prog-SeparateShader consumer == NULL)) { matches.record(output_var, input_var); } if (input_var output_var-data.streamId != 0) { linker_error(prog, ...); return false; } On Thu, 2014-06-12 at 07:43 +1200, Chris Forbes wrote: I had misread it -- yes, this looks correct. On Thu, Jun 12, 2014 at 12:02 AM, Iago Toral ito...@igalia.com wrote: I am a bit confused here: Reading the code it looks like input_var should be NULL if there is no consumer stage. In that case, if this is a separable program and there is no consumer, then input_var must be NULL too, in which case the linker_error would never take place. If input_var is not NULL then there has to be a consumer stage, and in that case we should check that we can link both stages, right? Iago On Wed, 2014-06-11 at 20:48 +1200, Chris Forbes wrote: This would appear to prohibit the use of multiple streams in separable programs entirely. I don't think that's the right thing. On Wed, Jun 11, 2014 at 7:49 PM, Iago Toral Quiroga ito...@igalia.com wrote: Outputs that are linked to inputs in the next stage must be output to stream 0, otherwise we should fail to link. --- src/glsl/link_varyings.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 9883c0b..0066b4e 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1343,6 +1343,13 @@ assign_varying_locations(struct gl_context *ctx, * consumer stage, add the output. */ if (input_var || (prog-SeparateShader consumer == NULL)) { +/* Only stream 0 outputs can be consumed in the next stage */ +if (input_var output_var-data.streamId != 0) { + linker_error(prog, output %s is assigned to stream=%d but +is linked to an input, which requires stream=0, +output_var-name, output_var-data.streamId); + return false; +} matches.record(output_var, input_var); } } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/18] glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0
Outputs that are linked to inputs in the next stage must be output to stream 0, otherwise we should fail to link. --- src/glsl/link_varyings.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 9883c0b..0066b4e 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1343,6 +1343,13 @@ assign_varying_locations(struct gl_context *ctx, * consumer stage, add the output. */ if (input_var || (prog-SeparateShader consumer == NULL)) { +/* Only stream 0 outputs can be consumed in the next stage */ +if (input_var output_var-data.streamId != 0) { + linker_error(prog, output %s is assigned to stream=%d but +is linked to an input, which requires stream=0, +output_var-name, output_var-data.streamId); + return false; +} matches.record(output_var, input_var); } } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/18] glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0
This would appear to prohibit the use of multiple streams in separable programs entirely. I don't think that's the right thing. On Wed, Jun 11, 2014 at 7:49 PM, Iago Toral Quiroga ito...@igalia.com wrote: Outputs that are linked to inputs in the next stage must be output to stream 0, otherwise we should fail to link. --- src/glsl/link_varyings.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 9883c0b..0066b4e 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1343,6 +1343,13 @@ assign_varying_locations(struct gl_context *ctx, * consumer stage, add the output. */ if (input_var || (prog-SeparateShader consumer == NULL)) { +/* Only stream 0 outputs can be consumed in the next stage */ +if (input_var output_var-data.streamId != 0) { + linker_error(prog, output %s is assigned to stream=%d but +is linked to an input, which requires stream=0, +output_var-name, output_var-data.streamId); + return false; +} matches.record(output_var, input_var); } } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/18] glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0
I am a bit confused here: Reading the code it looks like input_var should be NULL if there is no consumer stage. In that case, if this is a separable program and there is no consumer, then input_var must be NULL too, in which case the linker_error would never take place. If input_var is not NULL then there has to be a consumer stage, and in that case we should check that we can link both stages, right? Iago On Wed, 2014-06-11 at 20:48 +1200, Chris Forbes wrote: This would appear to prohibit the use of multiple streams in separable programs entirely. I don't think that's the right thing. On Wed, Jun 11, 2014 at 7:49 PM, Iago Toral Quiroga ito...@igalia.com wrote: Outputs that are linked to inputs in the next stage must be output to stream 0, otherwise we should fail to link. --- src/glsl/link_varyings.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 9883c0b..0066b4e 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1343,6 +1343,13 @@ assign_varying_locations(struct gl_context *ctx, * consumer stage, add the output. */ if (input_var || (prog-SeparateShader consumer == NULL)) { +/* Only stream 0 outputs can be consumed in the next stage */ +if (input_var output_var-data.streamId != 0) { + linker_error(prog, output %s is assigned to stream=%d but +is linked to an input, which requires stream=0, +output_var-name, output_var-data.streamId); + return false; +} matches.record(output_var, input_var); } } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 05/18] glsl: Fail to link if inter-stage input/outputs are not assigned to stream 0
I had misread it -- yes, this looks correct. On Thu, Jun 12, 2014 at 12:02 AM, Iago Toral ito...@igalia.com wrote: I am a bit confused here: Reading the code it looks like input_var should be NULL if there is no consumer stage. In that case, if this is a separable program and there is no consumer, then input_var must be NULL too, in which case the linker_error would never take place. If input_var is not NULL then there has to be a consumer stage, and in that case we should check that we can link both stages, right? Iago On Wed, 2014-06-11 at 20:48 +1200, Chris Forbes wrote: This would appear to prohibit the use of multiple streams in separable programs entirely. I don't think that's the right thing. On Wed, Jun 11, 2014 at 7:49 PM, Iago Toral Quiroga ito...@igalia.com wrote: Outputs that are linked to inputs in the next stage must be output to stream 0, otherwise we should fail to link. --- src/glsl/link_varyings.cpp | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 9883c0b..0066b4e 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -1343,6 +1343,13 @@ assign_varying_locations(struct gl_context *ctx, * consumer stage, add the output. */ if (input_var || (prog-SeparateShader consumer == NULL)) { +/* Only stream 0 outputs can be consumed in the next stage */ +if (input_var output_var-data.streamId != 0) { + linker_error(prog, output %s is assigned to stream=%d but +is linked to an input, which requires stream=0, +output_var-name, output_var-data.streamId); + return false; +} matches.record(output_var, input_var); } } -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev