Allen Akin wrote: > > On Fri, Apr 12, 2002 at 07:01:08PM +0100, José Fonseca wrote: > | ... Although doing (p*a+q*(1-a)) >> 8 can > | introduce up to 1 LSB error and worst, it doesn't obey to the rule of > | 255*255 = 255 as 255*255/256 = 254. I know that in Mesa's C blending code > | this special case of a=255 is always checked, but in the MMX code it > | isn't, and glean doesn't complain of that. > > If the expected value is 255 and the OpenGL implementation yields 254, > that's only one LSB of error, so glean probably won't complain about it. > > We could make the test more stringent, but then some reasonable > implementations (especially some hardware implementations) would fail. > Also, maintaining enough accuracy to yield results correct to 1 LSB is > already pretty challenging when color channels are deeper than 8 bits.
This brings up some interesting questions about blending that aren't directly addressed in the OpenGL specification. One might expect that the following identities be true for blending terms: 1.0 * 1.0 == 1.0 1.0 * x == x * 1.0 == x 0.0 * x == x * 0.0 == 0.0 So for 8-bit channels, in fixed point: 255 * 255 == 255 I can easily imagine cases in which applications would depend on these identities being true (in blending and elsewhere). In fact, I have a vague recollection of someone bringing up this issue a few years ago. I'd like to see Mesa satisfy the 255*255=255 identity. Is it hard to implement that in the MMX code? If it is, we could let it go for now and see if anyone complains. > | So how come the Mesa blending code in s_blend.c has coments such as "This > | is pretty close, but Glean complains", "This is slower but satisfies > | Glean", and "This satisfies Glean and should be reasonably fast"...? > > I don't know. It might be related to deep color channels, or possibly > to glean tests other than the basic blending tests. Brian might > remember. It's been at least a year since I touched that code. As far as I can remember the comments are correct. Though I don't remember if it was an issue at 5/6/5 or 8/8/8 color depth, or both. I don't know what else might have changed since then to cause different results with Glean. > Thanks for all your good work, by the way! Yes! -Brian _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel