packages feed

mandulia 0.6 → 0.7

raw patch · 7 files changed

+74/−18 lines, 7 files

Files

ChangeLog view
@@ -1,6 +1,15 @@-ChangeLog exported from Git by claude@zebimus at 2010-07-25T17:25:40+0100+ChangeLog exported from Git by claude@zebimus at 2010-08-14T18:06:44+0100 - (HEAD, tag: v0.6, origin/master, origin/HEAD, master)+ (HEAD, tag: v0.7, origin/master, master)++9e4e399 2010-08-14 18:04:35 +0100 v0.7 smooth-as+0e76ee2 2010-08-14 18:03:44 +0100 disable hardcore optimizations by default+94c746d 2010-08-14 17:59:32 +0100 use logarithmic mandelbrot escape time for smoother gradations+6c2699e 2010-08-01 08:01:52 +0100 log inter-frame timing statistics+                                  reduce jitter by adding one frame latency to swapBuffers+b87cf23 2010-08-01 08:00:15 +0100 copy statistics from Haskell to Lua++ (tag: v0.6)  21b1086 2010-07-25 17:22:39 +0100 v0.6 facepalm 1f9b042 2010-07-25 17:22:00 +0100 bump version
NEWS view
@@ -1,3 +1,14 @@+v0.7 2010-08-14 smooth-as++    Visual quality improvements include reduced jitter (at the cost of+    additional latency of one frame) and smoother colour gradations.+    Portability improvements include disabled optimizations by default,+    add -ffast or -ffast -fSSE4 to re-enable them.  Feature enhancements+    include access of runtime statistics from Lua scripts (for example:+    mandulia.statistics.frame.stddev).++    Source code statistics: 2097 lines, 10174 words, 59218 chars.+ v0.6 2010-07-25 facepalm      The previous version had a bug wherein the program help text was out
TODO view
@@ -10,7 +10,6 @@ Features To Enhance ------------------- -Feature:  script interface should include runtime statistics. Feature:  script interface should include level to radius fading. Feature:  script interface should include view validity testing. Feature:  script interface should include more complete input handling.
mandulia.cabal view
@@ -1,17 +1,20 @@ Name:                mandulia-Version:             0.6+Version:             0.7 Stability:           Provisional Synopsis:            A zooming visualisation of the Mandelbrot Set as many Julia Sets. Description:         Mandulia provides a zooming visualisation of the Mandelbrot Set                      as many Julia Sets.  Featuring a profiled and optimized renderer,                      and a Lua configuration and scripting interface.                      .-                     By default Mandulia compiles using SSE4 instructions.  If your-                     CPU does not support SSE4, you should add "-f-SSE4" to your-                     cabal-install command line.+                     Mandulia supports additional compile-time flags for speed, but by+                     default these are disabled because they don't work on all systems.+                     These flags are "-ffast" for miscellaneous optimizations, and+                     "-ffast -fSSE4" to use SSE4 instructions too.                      .-                     Changes from "mandulia-0.5": the program help text now correctly-                     reflects the implementation, thus avoiding confusion.+                     Changes from "mandulia-0.6": the optimization flags are disabled+                     by default as they were causing problems on some systems; reduced+                     visual jitter for smoother animation; smoother colour gradations;+                     access runtime statistics from Lua scripts. Homepage:            http://gitorious.org/maximus/mandulia Cabal-version:       >=1.6 License:             GPL-3@@ -26,19 +29,27 @@ Data-dir:            config Data-files:          defaults.lua distance.lua main.lua transition.lua +Flag fast+  Description:         Enable optimizations that might break some compilers.+  Default:             False+ Flag SSE4   Description:         Enable optimizations for SSE4 CPUs.-  Default:             True+  Default:             False  Executable mandulia   Build-depends:       base >= 4 && < 5, array, bytestring, containers, directory, filepath, time, GLUT >= 2.2, hslua >= 0.2   Build-tools:         hsc2hs   Extensions:          ForeignFunctionInterface-  if  flag(SSE4) && impl(ghc)+  if !flag(fast) && impl(ghc)+    GHC-options:         -Wall -threaded+    GHC-prof-options:    -Wall -threaded -prof -auto-all+    CC-options:          -std=c99 -Wall -pedantic+  if  flag(fast) &&  flag(SSE4) && impl(ghc)     GHC-options:         -Wall -O3 -threaded -fvia-c -funbox-strict-fields -optc-O3 -optc-march=native -optc-ffast-math -optc-msse4     GHC-prof-options:    -Wall -O3 -threaded -fvia-c -funbox-strict-fields -optc-O3 -optc-march=native -optc-ffast-math -optc-msse4 -prof -auto-all     CC-options:          -std=c99 -Wall -pedantic -O3 -march=native -ffast-math -msse4-  if !flag(SSE4) && impl(ghc)+  if  flag(fast) && !flag(SSE4) && impl(ghc)     GHC-options:         -Wall -O3 -threaded -fvia-c -funbox-strict-fields -optc-O3 -optc-march=native -optc-ffast-math     GHC-prof-options:    -Wall -O3 -threaded -fvia-c -funbox-strict-fields -optc-O3 -optc-march=native -optc-ffast-math -prof -auto-all     CC-options:          -std=c99 -Wall -pedantic -O3 -march=native -ffast-math@@ -73,4 +84,4 @@ Source-repository this   type:                git   location:            git://gitorious.org/maximus/mandulia.git-  tag:                 v0.6+  tag:                 v0.7
src/Interface.hs view
@@ -127,11 +127,26 @@   l <- iLua `fmap` readIORef iR   Lua.close l --- update from Lua   FIXME this should copy iStatistics to Lua-land+-- update from Lua  update :: IORef Interface -> IO () update iR = do   l <- iLua `fmap` readIORef iR+  -- copy statistics from Haskell to Lua+  Lua.getglobal l "mandulia"+  Lua.push l "statistics"+  Lua.newtable l+  iStatistics `fmap` readIORef iR >>= (mapM_ $ \(s,(a,b,c)) -> do+    Lua.push l s+    Lua.newtable l+    forM_ (words "count mean stddev" `zip` [a,b,c]) $ \(n,x) -> do+      Lua.push l n+      Lua.push l x+      Lua.settable l (-3)+    Lua.settable l (-3) )+  Lua.settable l (-3)+  Lua.pop l 1 -- pop mandulia global+  -- copy settings from Lua to Haskell   let g s = do         Lua.getglobal2 l ("mandulia." ++ s)         r <- Lua.peek l (-1)
src/Mandulia.hs view
@@ -23,6 +23,7 @@ import Data.Either (partitionEithers) import Data.IORef import Data.Maybe (isNothing, catMaybes)+import Data.Time (UTCTime, getCurrentTime, diffUTCTime) import Data.Version (showVersion) import System.Environment (getArgs) import System.Exit (exitFailure, exitSuccess)@@ -66,6 +67,7 @@     , images     :: ResourcePool Image     , logStats   :: String -> Double -> IO ()     , getStats   :: IO [(String, (Double, Double, Double))]+    , frameTime  :: Maybe UTCTime     }  main :: IO ()@@ -151,6 +153,7 @@                                  , images = imgpool                                  , logStats = logStats'                                  , getStats = getStats'+                                 , frameTime = Nothing                                  }   initialWindowSize $= Size (fromIntegral winW) (fromIntegral winH)   initialDisplayMode $= [RGBAMode, DoubleBuffered]@@ -266,10 +269,18 @@  display0 :: IORef Mandulia -> IO () display0 mR = do+  swapBuffers+  t1 <- getCurrentTime+  mt0 <- frameTime `fmap` readIORef mR+  modifyIORef' mR $ \m -> m{ frameTime = Just t1 }+  case mt0 of+    Nothing -> return ()+    Just t0 -> do+      let dt = realToFrac (diffUTCTime t1 t0)+      readIORef mR >>= \m -> logStats m "frame" dt   curScore <- update mR   qs <- computeJobs mR curScore   drawQuads qs-  swapBuffers   completeJobs mR curScore   record mR   reportErrors@@ -277,9 +288,9 @@ display :: IORef Mandulia -> IO () display mR = do   m <- readIORef mR-  (dt, r) <- time $ display0 mR+  (dt, ()) <- time $ display0 mR   logStats m "display" dt-  return r+  return ()  computeJobs :: IORef Mandulia -> (Julia -> Double) -> IO [Quad] computeJobs mR curScore = do
src/rjulia.c view
@@ -163,7 +163,7 @@   int n = 0;   int escapes;   R u = mandelbrot1(dcx, dcy);-  u = u > 0 ? u : 0;+  u = u > 0 ? 8 * log2(u) : 0;   do {     escapes = 0;     { // iterate