Friday, February 27, 2009

optimal performance in exclusive mode

1. Image size should match screen
2. Turn "Fit to window" OFF
3. Hide the Levels bar (calculating the histogram takes ~12 ms for 1024 x 768 @ 2x AA)

Thumbnail creation takes ~15 ms for 1024 x 758, due to the horrendous performance of stretch blit in halftone mode, but there's nothing to be done about that for the moment.

Friday, February 20, 2009

invalid argument

NET version: "an invalid argument was encountered" dialog, repeats many times, occurs in dual monitor exclusive mode, after double-clicking a new snapshot in "cats eyes directdraw test.frp", i.e. a snapshot that has an image but no escape times. Fairly repeatable, try aborting a render by double-clicking a couple of snaps with escape times first, and then double-click one without escape times. Also occurs when transitioning into Exclusive mode. This is a bummer because Exclusive is nearly impossible to debug with the debugger. Disabling mirror, origin motion and color cycling has no effect! Does not prevent render from completing, but makes it take much longer than usual. The resulting image appears to be OK. By the time the render completes, approximately 50 dialogs (49?) have piled up. Switching between non-escape snaps works OK, switching between escape snaps works OK, the problem only occurs when switching from an escape snap to a non-escape snap. During the dialog display loop, the timer loop is blocked, so the rendering speeds up. Bizarre, it's only happening when the non-escape snap and escape snap are NOT related, i.e. going from a parent escape snap to its child non-escape snap doesn't show the problem.

MYSTERY SOLVED. Problem is due to *lowering* quality during a render. This causes the RGB palette to become smaller, but the escape frame still contains escape times from the previous RGB palette, some of which will inevitably be illegal indices for the new RGB palette, i.e. you will be reading beyond the end of the new RGB palette, causing some type of access violation. It only happens in Exclusive because normally you don't remap the color until the render is completed! The only imaginable solution is, when lowering quality, defer generating the RGB palette until after the render completes. When *increasing* quality, the current scheme is required, i.e. the RGB palette must be generated *before* the render to avoid an access violation. Very tricky.