[Mesa-dev] [PATCH 1/7] draw/tgsi: implement geom shader invocation support.

Roland Scheidegger sroland at vmware.com
Wed May 27 04:55:52 PDT 2015


Am 27.05.2015 um 13:47 schrieb Ilia Mirkin:
> On Wed, May 27, 2015 at 7:42 AM, Roland Scheidegger <sroland at vmware.com> wrote:
>> Am 27.05.2015 um 09:45 schrieb Dave Airlie:
>>> From: Dave Airlie <airlied at redhat.com>
>>>
>>> This is just for softpipe, llvmpipe won't work without
>>> some changes.
>>>
>>> Signed-off-by: Dave Airlie <airlied at redhat.com>
>>> ---
>>>  src/gallium/auxiliary/draw/draw_gs.c   | 47 +++++++++++++++++++++-------------
>>>  src/gallium/auxiliary/draw/draw_gs.h   |  2 ++
>>>  src/gallium/auxiliary/tgsi/tgsi_scan.c |  2 ++
>>>  src/gallium/auxiliary/tgsi/tgsi_scan.h |  1 +
>>>  4 files changed, 34 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
>>> index 6375d41..755e527 100644
>>> --- a/src/gallium/auxiliary/draw/draw_gs.c
>>> +++ b/src/gallium/auxiliary/draw/draw_gs.c
>>> @@ -190,9 +190,15 @@ static void tgsi_gs_prepare(struct draw_geometry_shader *shader,
>>>                              const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS])
>>>  {
>>>     struct tgsi_exec_machine *machine = shader->machine;
>>> -
>>> +   int j;
>>>     tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
>>>                                    constants, constants_size);
>>> +
>>> +   if (shader->info.uses_invocationid) {
>>> +      unsigned i = machine->SysSemanticToIndex[TGSI_SEMANTIC_INVOCATIONID];
>>> +      for (j = 0; j < TGSI_QUAD_SIZE; j++)
>>> +         machine->SystemValue[i].i[j] = shader->invocation_id;
>>> +   }
>>>  }
>>>
>>>  static unsigned tgsi_gs_run(struct draw_geometry_shader *shader,
>>> @@ -555,7 +561,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
>>>      * overflown vertices into some area where they won't harm anyone */
>>>     unsigned total_verts_per_buffer = shader->primitive_boundary *
>>>        num_in_primitives;
>>> -
>>> +   unsigned invocation;
>>>     //Assume at least one primitive
>>>     max_out_prims = MAX2(max_out_prims, 1);
>>>
>>> @@ -564,7 +570,7 @@ int draw_geometry_shader_run(struct draw_geometry_shader *shader,
>>>     output_verts->stride = output_verts->vertex_size;
>>>     output_verts->verts =
>>>        (struct vertex_header *)MALLOC(output_verts->vertex_size *
>>> -                                     total_verts_per_buffer);
>>> +                                     total_verts_per_buffer * shader->num_invocations);
>> This can't get very large, right?
> 
> With ARB_gpu_shader5, it has to be at least 32. In mesa, it's always
> defined as 32.
> 
I was more wondering if the buffer without the num_invocations mul was
already defined somewhere to not exceed some limit. Probably should be
ok though...

Roland




More information about the mesa-dev mailing list