[Mesa-dev] [PATCH 2/6] gallium: implement clamping controls (ARB_color_buffer_float)

Marek Olšák maraeo at gmail.com
Mon Mar 21 09:06:45 PDT 2011


Yeah I moved it from the rasterizer state to the blend state, but then I
realized the rasterizer state had been a better place. The thing is the
fragment color clamping is done right after the fragment shader output is
written, that is before the alpha test, before the depth/stencil test, and
therefore long before blending. So I don't know where to put it. Obviously,
the depth-stencil-alpha state is a better candidate than the blend state.
Also you can do some nasty things with it. For example, you can use the
clamping to clamp the fragment color after the fragment shader and then
multiply it by 2 in the blending stage, effectively outputting a value in
the range [0, 2].

Marek

On Mon, Mar 21, 2011 at 4:36 PM, Keith Whitwell <keithw at vmware.com> wrote:

> On Mon, 2011-03-21 at 16:23 +0100, Christoph Bumiller wrote:
> > On 03/21/2011 02:12 AM, Marek Olšák wrote:
> >
> > > diff --git a/src/gallium/include/pipe/p_state.h
> b/src/gallium/include/pipe/p_state.h
> > > index cf6c5b5..f6ad456 100644
> > > --- a/src/gallium/include/pipe/p_state.h
> > > +++ b/src/gallium/include/pipe/p_state.h
> > > @@ -81,6 +81,8 @@ struct pipe_rasterizer_state
> > >  {
> > >     unsigned flatshade:1;
> > >     unsigned light_twoside:1;
> > > +   unsigned clamp_vertex_color:1;
> > > +   unsigned clamp_fragment_color:1;
> > >     unsigned front_ccw:1;
> > >     unsigned cull_face:2;      /**< PIPE_FACE_x */
> > >     unsigned fill_front:2;     /**< PIPE_POLYGON_MODE_x */
> >
> > Hadn't you put clamp_fragment_color in the blend state initially ?
> > It seems like a more logical place to me.
>
> Indeed you're right.  Fragment color clamping takes place in the part of
> the pipeline governed by the blend CSO.
>
> Keith
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110321/3abf1472/attachment.htm>


More information about the mesa-dev mailing list