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].<br>
<br>Marek<br><br><div class="gmail_quote">On Mon, Mar 21, 2011 at 4:36 PM, Keith Whitwell <span dir="ltr"><<a href="mailto:keithw@vmware.com" target="_blank">keithw@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On Mon, 2011-03-21 at 16:23 +0100, Christoph Bumiller wrote:<br>
> On 03/21/2011 02:12 AM, Marek Olšák wrote:<br>
><br>
> > diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h<br>
> > index cf6c5b5..f6ad456 100644<br>
> > --- a/src/gallium/include/pipe/p_state.h<br>
> > +++ b/src/gallium/include/pipe/p_state.h<br>
> > @@ -81,6 +81,8 @@ struct pipe_rasterizer_state<br>
> > {<br>
> > unsigned flatshade:1;<br>
> > unsigned light_twoside:1;<br>
> > + unsigned clamp_vertex_color:1;<br>
> > + unsigned clamp_fragment_color:1;<br>
> > unsigned front_ccw:1;<br>
> > unsigned cull_face:2; /**< PIPE_FACE_x */<br>
> > unsigned fill_front:2; /**< PIPE_POLYGON_MODE_x */<br>
><br>
> Hadn't you put clamp_fragment_color in the blend state initially ?<br>
> It seems like a more logical place to me.<br>
<br>
</div>Indeed you're right. Fragment color clamping takes place in the part of<br>
the pipeline governed by the blend CSO.<br>
<font color="#888888"><br>
Keith<br>
<br>
</font></blockquote></div><br>