Thread overview
GPUFractal-3
Oct 22, 2007
Burton Radons
Oct 23, 2007
Burton Radons
Oct 23, 2007
Burton Radons
October 22, 2007
GPUFractal is a silly little macro-mashing program that computes fractals entirely on a GPU in a single pass with different display options. To run it, call "gpufractal.exe schema-fractal-cg.h" for the Cg version or "gpufractal.exe schema-fracta-glsl.h" for the GLSL version. The program requires a recent powerful graphics card to operate. This is how compatibility seems to be on ATI cards:

	R520 (X1300-X1950) - Should work with a recent driver!
	R420 (X700-X850) - NO. This is new! Does not work, guaranteed! You wouldn't be able to see anything new anyway. :)
	R300 (9500-9800) - Hah! No way.
	R200, R100, Rage, Mach - Err, no.

The NVIDIA functionality seems to be:

	GeForce 8 - Yayyay!
	GeForce 7 - Yay!
	GeForce 6 - Yes! I don't know if it can handle Orbit Traps.
	GeForce 2-5/256, Riva 128/TNT/TNT2, NV1/NV2 - Not likely.
	ASR-33 Teletype - Lacks a processor.

If it's not on this list, the answer is likely "no". If it seems like it should work but it doesn't, your driver is probably years out of date. The current ATI driver reports version "2.0.6956" on the command line. The current NVIDIA driver reports version "2.1.1".

http://members.shaw.ca/burton-radons/GPUFractal-3.7z (executable, 271KB)
http://members.shaw.ca/burton-radons/GPUFractal-3-source.7z (source, 303KB)
http://members.shaw.ca/burton-radons/cg.7z (Cg DLLs if you need them, 627KB)

The interface is exclusively mouse based. Left mouse button to zoom in, right mouse button to zoom out, middle mouse button to scroll. Using the mouse wheel puts you in variable mode. The mouse wheel selects the current variable, dragging the left mouse button changes it (enumerations and floats are changed by dragging to the right or left), clicking the middle mouse button resets to the initial value, and right clicking returns to zoom/scroll mode.

I didn't want to make a new version but looking over it, so many things are different that it's a substantively changed program internally. Here are the changes:

- R420 support has been completely dropped for now.

- Added multisampling global parameter. This has no effect on hardware (such as my ATI X850) where the anti-aliasing is restricted to polygon edges, and only has an effect at 16 and 32 on the NVIDIA 8800, but I don't think I have any mechanism to detect this through an API. I chose to directly destroy and recreate the main window, which is probably not much slower than keeping the rendering in a sub-window, and much simpler to do. Hooray for list sharing!

- Switched to string-based enums a la Ultra Fractal, renamed cfloat to complex for the same reason. Added heading, colour, and function parameters. Changed how gradients are indexed, fixed aspect ratio, and other tweaks to bring the display and processing closer to Ultra Fractal.

- Unified parameters; formula selections are now just parameters, and formulas can be parameters to formulas. Boy howdy was this a big change!

- Added language parameter to formulas. If the language doesn't match the schema language, I attempt to convert it. Naturally the first added language is UltraFractal, which is exactly one bazillion times better at dealing with complex values than Cg or GLSL. This allowed me to dump in the 618-line Orbit Traps mostly unmodified, whereas it would have taken me one or two days to convert it by hand certainly with bugs.

- Added outside formula Triangle Inequality Average. The defaults are set for Mandelbrot; for Julia set the bailout to about 7.84 with default power (2, 0). Then bring the seed to be just on the edge of breaking out into inside regions for some neat effects.

- Added outside formula Orbit Traps which is incredibly complex and a great test of the UltraFractal parser and Cg/GLSL generator. There is no hope at all of this working if your card has any limitations. Cg does NOT like Orbit Traps, producing terrible code; use GLSL instead.

- Got rid of some spurious warnings from Cg.
October 23, 2007
Updated to make the ATI R420 work, as well as various fixes and tweaks. Aaaand... that's it! I'm never updating this again!

If anyone's interested, all the source code is public domain. The files within the fractal subdirectory, however, are not, and shouldn't be used in any derivative works or future versions, if any.
October 23, 2007
More fuel for the Cg vs GLSL debate: I sent the link to the creator of Ultra Fractal and he asked about calculation speed, so I told the program to redraw as fast as possible and turned off vsync in the control panel. A 1024x768 image, Smooth outside and None inside, runs at 82 FPS under Cg on this machine - an NVIDIA 8800 GTX with a 2.66 GHz Intel Dual Core processor on Windows Vista, everything up to date. Under GLSL, the same image runs at 131 FPS, 59% faster. I think it's safe to say that GLSL has eclipsed Cg when doing hardcore numbers of operations on NVIDIA hardware, and even so I know the GLSL optimiser is pretty poor.