[Mesa-dev] [PATCH 08/19] gallium: add set_tess_state to configure default tessellation parameters

Ilia Mirkin imirkin at alum.mit.edu
Mon May 4 06:40:03 PDT 2015


FWIW nvidia also does not require a special TCS in this case and can
program the tessellation levels directly from the cmd stream.
[Actually it might need a TCS with only an "exit" instruction, I
should double-check.] However AFAIK Intel hardware requires a more
involved passthrough TCS which handles setting the levels and
potentially copying the per-vertex values over, not sure about the
latter bit. Here is the nvc0 impl:

https://github.com/imirkin/mesa/commit/3b7b3887f2dc106305efc3b49b295551e24d2790#diff-21f2776e5f66dfdae77438adc195ba2aR539

On Mon, May 4, 2015 at 9:33 AM, Marek Olšák <maraeo at gmail.com> wrote:
> Hi Roland,
>
> It depends on the hardware. On Radeon, the tessellation evaluation
> shader can read vertex shader outputs directly. That means the
> tessellation control shader is not necessary if the tessellation
> levels are fixed. set_tess_state sets the fixed tessellation levels
> for exactly this case.
>
> Other hardware may need to generate a pass-through tessellation
> control shader and upload these parameters as constants for the shader
> to use them.
>
> Marek
>
> On Mon, May 4, 2015 at 1:29 PM, Roland Scheidegger <sroland at vmware.com> wrote:
>> Seems a bit awkward that you have to set such state separately. I don't
>> know much about how this is supposed to work though, some quick grep
>> says these parameters are used when there's no tessellation control
>> shader, so I guess that's why it is separate state.
>> How does that actually work in hw, can you just switch tesselation
>> control shaders off or do you have to provide some kind of a default
>> tesselation ctrl shader?
>>
>> Roland
>>
>> Am 02.05.2015 um 22:16 schrieb Ilia Mirkin:
>>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>> ---
>>>  src/gallium/docs/source/context.rst  | 5 +++++
>>>  src/gallium/include/pipe/p_context.h | 4 ++++
>>>  2 files changed, 9 insertions(+)
>>>
>>> diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
>>> index 5861f46..0908ee7 100644
>>> --- a/src/gallium/docs/source/context.rst
>>> +++ b/src/gallium/docs/source/context.rst
>>> @@ -79,6 +79,11 @@ objects. They all follow simple, one-method binding calls, e.g.
>>>    should be the same as the number of set viewports and can be up to
>>>    PIPE_MAX_VIEWPORTS.
>>>  * ``set_viewport_states``
>>> +* ``set_tess_state`` configures the default tessellation parameters:
>>> +  * ``default_outer_level`` is the default value for the outer tessellation
>>> +    levels. This corresponds to GL's ``PATCH_DEFAULT_OUTER_LEVEL``.
>>> +  * ``default_inner_level`` is the default value for the inner tessellation
>>> +    levels. This corresponds to GL's ``PATCH_DEFAULT_INNER_LEVEL``.
>>>
>>>
>>>  Sampler Views
>>> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
>>> index 74c2f2f..afc5d7b 100644
>>> --- a/src/gallium/include/pipe/p_context.h
>>> +++ b/src/gallium/include/pipe/p_context.h
>>> @@ -231,6 +231,10 @@ struct pipe_context {
>>>                               unsigned start_slot, unsigned num_views,
>>>                               struct pipe_sampler_view **);
>>>
>>> +   void (*set_tess_state)(struct pipe_context *,
>>> +                          float default_outer_level[4],
>>> +                          float default_inner_level[2]);
>>> +
>>>     /**
>>>      * Bind an array of shader resources that will be used by the
>>>      * graphics pipeline.  Any resources that were previously bound to
>>>
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list