Andre
Very cool.... this has been about a week of effort? And they said it couldn't be done. Personally I believe CinCom should implement this kind of backward compatible approach to moving the VW graphics framework forward. It just seems so obvious to me that the the way forward is to provide an interface to Cairo (or some other modern drawing layer)and then implement the existing graphicsContext in terms of this new layer (breaking no, or at least very few applications). I hope you proof of concept work will push CinCom engineering down this road. > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Andre Schnoor > Sent: June 4, 2007 3:07 PM > To: VW-Development List > Subject: [OSX] Compositional Graphics API > > > As mentioned before, I did considerable experimentation and > prototyping w.r.t. a compositional API for modern graphics > platforms (OSX in this case, but also suits others). My goal was to > > 1. get a working solution asap > 2. require only minimal changes to L&F and UI packages 3. > keep existing application code without major changes 4. > increase performance in the 10x - 20x magnitude 5. get and > idea of how future APIs could look like > > I now have a working prototype VM. It implements four new GC > primitives in order to cope with persistent host GCs and > nested graphics compositions. The existing graphics > primitives had to be modified in order to support the new > drawing model. While hacking my way through the code, I also > found some minor bugs (see below). > > Composition and resource management is done by a package > "Graphics-Composition". The necessary changes to the L&F and > UI packages (currently only Chimera L&F and Wrapper) were > minimal. This is how compositional drawing works on the image side: > > aGraphicsContext > compose:[ .... any drawing goes here ... ] > > All drawing that occurs during the execution of the block > (incl. nested recursions and "orphan" copied GCs) are > transparently collected in a composition and flushed to > display when done. The message #compose: is also understood > by GraphicsMedium (Window, Screen) and ApplicationModel for > convenience. > > Optimizing existing packages for use with the compositional > API is simply a matter of wrapping sensible portions of > drawing code into compose:[ ... ] -- that's all. This has > proven to be a rewarding and fun task. For backward > compatibility, #compose: could be provided as a dummy method > (evaluate the block only). > > This is roughly what I've changed with the VM: > > * Host GCs created once and re-used frequently, cached in > GraphicsContext instance variable > * Selective "write-though" and lazy application of parameters > (saves a big deal of redundant calls) > * Resource management supported by finalization > * New ObjC class STGraphicsComposition > * Draw to NSView directly, when surface is a window > (eliminated NSImage > buffering) > * Eliminated the window refresh timer > * Forward view scrolling to window manager (got rid of NSImage copy > operations) > > Current results are quite satisfying. The VM is really snappy now. > Hopefully I fixed the last stability issue today. The Music > Prototyping Studio (which I consider the worst case and > general acid test concerning graphics load) survived the > visualization of Anton Bruckner's 7th symphony in its > entirety (~40,000 graphics ops per page) with scrolling, even > while playing. It could still be a bit faster, though. I'll > see what I can do. > > Without the #compose: construct, the new VM is ridicuously > slow for a standard image (like the current VM without the > refresh timer). After wrapping a few #displayOn: methods, it > gets faster very quickly. As of currently, I identified > approx. 15 sensible spots, making the VM feel really snappy - > almost like on Windows. Double buffering BTW is redundant and > can be eliminated. > > I am currently testing a combined mode that uses a delayed > window refresh (timer based) for "orphan" drawing calls that > aren't wrapped into a composition. This may lead to > acceptable results even on standard images that lack the > "compose:" enhancement. > > Regardless whether these VM modifications will ever get > beyond my development machine: The compositional framework is > definitely useful for all sorts of modern graphics > interfaces, wheter primitive-based or via DLLCC. It's forward > compatible. Upgrading existing code is easy and non-critical, > which makes the proposed scheme a good solution for practical > needs (as opposed to a "perfect solution" which would require > major rewrites of almost all graphics-related packages, the > base image and existing applications otherwise). > > If current directions of VM development point to this > direction, I am willing to further support this idea. > > Andre > > > > |
Hi,
It's wonderful how a different approach can give up astonishing result. Very cool, Andre! Please don't waste this experience (but I think John will not throw it away....) ciao Giorgio
|
In reply to this post by Joerg Beekmann, DeepCove Labs (YVR)
Joerg Beekmann wrote: > Very cool.... this has been about a week of effort? Certainly not. I begun exploration and experimentation a month ago already. The actual prototyping took 10-14 days (14+ hours each). During this period I wasn't distracted by anything else. These conditions are hard to meet by a team that has to support a dozen other platforms (among many other things). BTW: It's a prototype -- not a production engine. > And they said it couldn't be done. They said it was a difficult task to do (which it definitely is). AFAIK, nobody ever said it was impossible. > [...] > It just seems so obvious to me that the the way forward is to provide > an interface to Cairo (or some other modern drawing layer)and then > implement the existing graphicsContext in terms of this new layer > (breaking no, or at least very few applications). > As for the current prototype, no application will be "broken". It will just be utterly slow, because, by default, every drawing action is handled like a composition of its own. Fixing this, though, is very easy as one only has to enclose a number of #displayOn: calls into the #compose: construct. Andre (BTW: my original post was to the dev list - 100% sure) |
Free forum by Nabble | Edit this page |