----------------------------------------------------------------
-- The program
----------------------------------------------------------------

main :: IO ()
main = runResourceT $ do
  -- Create Instance, PhysicalDevice, Device and Allocator
  inst             <- Main.createInstance
  (phys, pdi, dev) <- Main.createDevice inst
  (_, allocator)   <- withAllocator
    zero { flags            = zero
         , physicalDevice   = physicalDeviceHandle phys
         , device           = deviceHandle dev
         , instance'        = instanceHandle inst
         , vulkanApiVersion = myApiVersion
         }
    allocate

  -- Run our application
  -- Wait for the device to become idle before tearing down any resourecs.
  runV inst phys (pdiComputeQueueFamilyIndex pdi) dev allocator
    . (`finally` deviceWaitIdle')
    $ do
        image <- render
        let filename = "julia.png"
        sayErr $ "Writing " <> filename
        liftIO $ BSL.writeFile filename (JP.encodePng image)

-- Render the Julia set
main :: IO ()
main = runResourceT $ do
  -- Create Instance, PhysicalDevice, Device and Allocator
  inst             <- Main.createInstance
  (phys, pdi, dev) <- Main.createDevice inst
  (_, allocator)   <- withAllocator
    zero { flags            = zero
         , physicalDevice   = physicalDeviceHandle phys
         , device           = deviceHandle dev
         , instance'        = instanceHandle inst
         , vulkanApiVersion = myApiVersion
         }
    allocate

  -- Run our application
  -- Wait for the device to become idle before tearing down any resourecs.
  runV inst phys (pdiComputeQueueFamilyIndex pdi) dev allocator
    . (`finally` deviceWaitIdle')
    $ do
        image <- render
        let filename = "julia.png"
        sayErr $ "Writing " <> filename
        liftIO $ BSL.writeFile filename (JP.encodePng image)

-- Render the Julia set
main = runResourceT $ do
  -- Create Instance, PhysicalDevice, Device and Allocator
  inst             <- Main.createInstance
  (phys, pdi, dev) <- Main.createDevice inst
  (_, allocator)   <- withAllocator
    zero { flags            = zero
         , physicalDevice   = physicalDeviceHandle phys
         , device           = deviceHandle dev
         , instance'        = instanceHandle inst
         , vulkanApiVersion = myApiVersion
         }
    allocate

  -- Run our application
  -- Wait for the device to become idle before tearing down any resourecs.
  runV inst phys (pdiComputeQueueFamilyIndex pdi) dev allocator
    . (`finally` deviceWaitIdle')
    $ do
        image <- render
        let filename = "julia.png"
        sayErr $ "Writing " <> filename
        liftIO $ BSL.writeFile filename (JP.encodePng image)

-- Render the Julia set