Well, my disks just spun up for the nightly updatedb cron, so that's my 
cue to go to bed, but I wanted to give you a quick update.  I've got 
scissors and cliprects working, with the exception of overlapping GL 
windows having some problems, but we had that problem before.  I'm 
probably going to commit this tomorrow, but I wanted to experiment a bit 
more and possibly do some cleanup.  I'm not sure that I have all the state 
updates in the right places, I want to make sure that everything is 
updated when it needs to be but not when it doesn't.

I've looked at several drivers for these changes, and they are all a bit 
different.  Anyway, I figured out that the viewport calculation needed the 
x and y offsets to the origin of the window added in.  I did this by 
storing the offsets in 2 context vars, which is what some other drivers 
do.  r128 seems to have a cce register to handle the offsets.  Cliprects 
seem to be working right now with some more changes.  Basically, my 
(most likely somewhat flawed) understanding is this:

Scissors
--------
The scissors are register settings that determine a hardware clipping rect 
in window coords.  Any part of a primitive or other drawing operation that 
extends beyond the scissors is not drawn.  The scissors can be set through 
GL commands.  This has nothing to do with perspective clipping in the 
pipeline, just the final window coordinates.

Cliprects
---------
Cliprects are used to determine what parts of the context/window should be 
redrawn to handle overlapping windows.  The more overlapping windows, the 
more cliprects you have.  These need to be passed to the drm.  It does a 
clear or swap for each cliprect.  Again these are for 2D clipping after 
rasterization and not part of the pipeline.  Things get a bit complicated 
by the fact that there can be separate clip rects for the front and back 
buffers.

Viewport 
-------- 
The viewport array holds values to determine how to translate transformed,
clipped, and projected vertex coordinates into window coordinates.  This
is the last stage of the pipeline.  The values are based on the size and
position of the "drawable", aka the drawing area of the window for the
context.

I'm attaching the diff of my mesa driver directory so you can have a look
before I commit it.  There's also a couple of small changes in the drm for
this (which I didn't include in the diff), to make it use the scissor and
mask values from the sarea register context.

-- 
Leif Delgass 
http://www.retinalburn.net

Attachment: mach64-clipping.diff.gz
Description: mach64-clipping.diff.gz

Reply via email to