[Mesa-dev] [PATCH 1/2] softpipe: implement some support for multiple viewports

Roland Scheidegger sroland at vmware.com
Fri Dec 11 18:29:01 PST 2015


Hmm actually there were some piglit regressions.
I don't mind the ones from the arb_fragment_layer_viewport group from
skip to pass (up to today they failed in llvmpipe too and we don't have
a cap bit for this functionality separately).
However, this broke some more basic stuff like vs point size output and
and layer output in some cases.

But there's others, like
./piglit/bin/glsl-vs-point-size -auto -fbo
./piglit/bin/gl-3.2-layered-rendering-gl-layer-cube-map -auto -fbo
I'm pretty sure they are due to the code changes below:

>> @@ -135,17 +136,35 @@ softpipe_get_vertex_info(struct
softpipe_context *softpipe)
>>           draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src);
>>        }
>>  
>> -      softpipe->psize_slot = draw_find_shader_output(softpipe->draw,
>> -                                                 TGSI_SEMANTIC_PSIZE, 0);
>> -      if (softpipe->psize_slot >= 0) {
>> -         draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT,
>> -                               softpipe->psize_slot);
>> +      /* Figure out if we need pointsize as well. */
>> +      vs_index = draw_find_shader_output(softpipe->draw,
>> +                                         TGSI_SEMANTIC_PSIZE, 0);
>> +
>> +      if (vs_index >= 0) {
>> +         softpipe->psize_slot = vinfo->num_attribs;
>> +         draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
>> +      }
>> +
>> +      /* Figure out if we need viewport index */
>> +      vs_index = draw_find_shader_output(softpipe->draw,
>> +                                         TGSI_SEMANTIC_VIEWPORT_INDEX,
>> +                                         0);
>> +      if (vs_index >= 0) {
>> +         softpipe->viewport_index_slot = vinfo->num_attribs;
>> +         draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
>> +      } else {
>> +         softpipe->viewport_index_slot = 0;
>>        }
>>  
>> -      softpipe->layer_slot = draw_find_shader_output(softpipe->draw,
>> -                                         TGSI_SEMANTIC_LAYER, 0);
>> -      if (softpipe->layer_slot >= 0) {
>> -         draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, softpipe->layer_slot);
>> +      /* Figure out if we need layer */
>> +      vs_index = draw_find_shader_output(softpipe->draw,
>> +                                         TGSI_SEMANTIC_LAYER,
>> +                                         0);
>> +      if (vs_index >= 0) {
>> +         softpipe->layer_slot = vinfo->num_attribs;
>> +         draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
>> +      } else {
>> +         softpipe->layer_slot = 0;
>>        }

This switches from assigning psize_slot (and layer) the result of
draw_find_shader_output() to assigning vinfo->num_attribs. It is true
that llvmpipe does the latter too, but apparently this doesn't work for
softpipe. Albeit I can't quite tell you how this works with softpipe.
Maybe it doesn't use the post-mapped indices at all for some reason
though I don't quite see how this interacts with draw (fwiw this would
actually also mean that those slots can be zero and still valid since
output doesn't need to be at 0 as it has to if you use
vinfo->num_attribs, albeit I believe you're unlikely to hit such a case
with piglit, but it would be better to use -1 to indicate invalid slots
in this case).

Can you take a look at that?

Roland





More information about the mesa-dev mailing list