On Tue, Jan 26, 2010 at 12:11 PM, Keith Whitwell <kei...@vmware.com> wrote: > Luca, > > I would have expected fragment coord conventions to be device state, not > a part of the shader. > > It seems like these new flags are really peers (or replacements?) of the > gl_rasterization_rules flag in pipe_rasterizer_state, and that the > shaders should remain unchanged.
This flags are different from gl_rasterization_rules, as they only affect fragment.position as seen by the shader, while gl_rasterization_rules affects the "trigger point" for rasterization itself only. I quoted the answer to this I already gave at the end of the message. OpenGL makes the convention part of the shader. Of course, we could design Gallium in a different way, but I don't see any advantage that would justify the inconvenience. Also, since the flags only affect the fragment shader (as discussed below), it makes sense for it to be part of it. -- gl_rasterization_rules affects the way fragments are rasterized, i.e. the set of fragments which a primitive is mapped to. Changing it is equivalent to adding/subtracting a subpixel offset to the viewport (which seemingly depends on the primitive type). The pixel center convention instead sets how the values look like in the fragment shader. Changing it is equivalent to adding/subtracting 0.5 to the fragment.position in the fragment shader. In other words, yes, if you set gl_rasterization_rules and the pixel center in a mismatched way, fragment.position will not be the coordinate of the "rasterization center". As another example, suppose you do a blit with the 3D engine using fragment.position to sample from a texture rectangle with bilinear filtering. A wrong rasterization convention may cause 1 pixel black bars at the borders. A wrong pixel center convention will cause a 2x2 blur filter to be applied to the texture. BTW, gl_rasterization_rules is ignored by almost all drivers >From the spec: << The scope of this extension deals *only* with how the fragment coordinate XY location appears during programming fragment processing. Beyond the scope of this extension are coordinate conventions used for rasterization or transformation. >> ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev