[Mesa-dev] [PATCH 5/8] main: enable NV_primitive_restart extension by default

Ian Romanick idr at freedesktop.org
Fri May 11 10:49:08 PDT 2012


On 05/11/2012 10:35 AM, Marek Olšák wrote:
> On Fri, May 11, 2012 at 7:17 PM, Brian Paul<brianp at vmware.com>  wrote:
>> On 05/11/2012 11:08 AM, Marek Olšák wrote:
>>>
>>> I think a more preferable way to enable an extension for everybody by
>>> default is to do something like this:
>>>
>>>> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
>>>> index a843a40..71b7721 100644
>>>> --- a/src/mesa/main/extensions.c
>>>> +++ b/src/mesa/main/extensions.c
>>>> @@ -298,7 +298,7 @@ static const struct extension extension_table[] = {
>>>>      { "GL_NV_light_max_exponent",
>>>> o(NV_light_max_exponent),                   GL,             1999 },
>>>>      { "GL_NV_packed_depth_stencil",
>>>> o(EXT_packed_depth_stencil),                GL,             2000 },
>>>>      { "GL_NV_point_sprite",                         o(NV_point_sprite),
>>>>                        GL,             2001 },
>>>> -   { "GL_NV_primitive_restart",
>>>>   o(NV_primitive_restart),                    GL,             2002 },
>>>> +   { "GL_NV_primitive_restart",                    o(dummy_true),
>>>>                         GL,             2002 },
>>>>      { "GL_NV_texgen_reflection",
>>>>   o(NV_texgen_reflection),                    GL,             1999 },
>>>>      { "GL_NV_texture_barrier",
>>>>   o(NV_texture_barrier),                      GL,             2009 },
>>>>      { "GL_NV_texture_env_combine4",
>>>> o(NV_texture_env_combine4),                 GL,             1999 },
>>>> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
>>>> index 06ca0d5..8086bb5 100644
>>>> --- a/src/mesa/main/mtypes.h
>>>> +++ b/src/mesa/main/mtypes.h
>>>> @@ -2982,7 +2982,6 @@ struct gl_extensions
>>>>      GLboolean NV_fragment_program_option;
>>>>      GLboolean NV_light_max_exponent;
>>>>      GLboolean NV_point_sprite;
>>>> -   GLboolean NV_primitive_restart;
>>>>      GLboolean NV_texture_barrier;
>>>>      GLboolean NV_texgen_reflection;
>>>>      GLboolean NV_texture_env_combine4;
>>>
>>>
>>> And fixing all occurences of gl_extensions::NV_primitive_restart. Both
>>> ways are equivalent though, so it's really just about whether we
>>> should allow drivers to disable the extension.
>>
>>
>> FWIW, I know of at least one application which performs faster with the
>> vmware driver when NV_primitive_restart is disabled (and the app does it's
>> own work-around) rather than to use the software-based primitive restart
>> path.
>>
>> So setting MESA_EXTENSION_OVERRIDE=-GL_NV_primitive_restart should be an
>> option.  The o(dummy_true) convention might prevent that, but I haven't
>> tested that...
>
> In that case, I think we should disable it in the state tracker if
> there's no driver support. If it's faster for svga, it's very likely
> faster for the other DX9-level drivers too.

I can imagine that it's certainly faster for hardware TNL cards. 
Mapping an index buffer that's probably in VRAM, scanning it on the CPU, 
then submitting multiple draw calls doesn't even sound like it would be 
fast.

It also seems like the pure software paths might want to handle it 
directly in their index processing loop rather than chopping up the draw 
call before hand.

The real value of these software paths is handling cases that the 
hardware can't do.  The GL spec allows any value to be specified for the 
restart index, but some hardware (*cough*) only supports ~0.


More information about the mesa-dev mailing list