[Mesa-dev] [PATCH] radeonsi: don't call of u_prims_for_vertices for patches and rectangles

eocallaghan at alterapraxis.com eocallaghan at alterapraxis.com
Thu Dec 10 03:19:18 PST 2015


On 2015-12-10 22:15, Marek Olšák wrote:
> On Thu, Dec 10, 2015 at 4:01 AM, Michel Dänzer <michel at daenzer.net> 
> wrote:
>> On 10.12.2015 06:58, Marek Olšák wrote:
>>> From: Marek Olšák <marek.olsak at amd.com>
>>> 
>>> Both caused a crash due to a division by zero in that function.
>>> This is an alternative fix.
>>> 
>>> Cc: 11.0 11.1 <mesa-stable at lists.freedesktop.org>
>>> ---
>>>  src/gallium/drivers/radeonsi/si_state_draw.c | 14 +++++++++++++-
>>>  1 file changed, 13 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
>>> b/src/gallium/drivers/radeonsi/si_state_draw.c
>>> index ee84a1f..e550011 100644
>>> --- a/src/gallium/drivers/radeonsi/si_state_draw.c
>>> +++ b/src/gallium/drivers/radeonsi/si_state_draw.c
>>> @@ -216,6 +216,18 @@ static void si_emit_derived_tess_state(struct 
>>> si_context *sctx,
>>>       radeon_emit(cs, tcs_out_layout | (num_tcs_output_cp << 26));
>>>  }
>>> 
>>> +static unsigned si_num_prims_for_vertices(const struct 
>>> pipe_draw_info *info)
>>> +{
>>> +     switch (info->mode) {
>>> +     case PIPE_PRIM_PATCHES:
>>> +             return info->count / info->vertices_per_patch;
>>> +     case R600_PRIM_RECTANGLE_LIST:
>>> +             return info->count / 3;
>>> +     default:
>>> +             return u_prims_for_vertices(info->mode, info->count);
>>> +     }
>>> +}
>> 
>> I don't suppose it makes sense to handle PIPE_PRIM_PATCHES in
>> u_prims_for_vertices? Either way,
> 
> u_prims_for_vertices has an assertion that fails if mode == PATCHES.
> That's sufficient.
> 
> Marek
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

I prefer this combined solution now. Many thanks,

Reviewed-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>


More information about the mesa-dev mailing list