Monday, May 21, 2012

Playing HoN with Xorg Edgers and open source ATI drivers

Let start off with my setup, I'm running x64 Ubuntu 12.04 with Xorg Edgers. Ive got a Radeon 5850, and  a Phenom II X6 1100T.

If you just try and run the installed HoN using this setup you will see the screen go to funny colored blocks and pop back having failed to run. If you run it from the command prompt you can see this message  "LibGL error: failed to load driver: r600".  So set LIBGL_DEBUG=verbose and try again.
warning: The VAD has been replaced by a hack pending a complete rewrite
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/r600_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
libGL error: dlopen /usr/lib/x86_64-linux-gnu/dri/r600_dri.so failed (/home/hippiehunter/HoN/libs-x86_64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/dri/r600_dri.so))
libGL error: unable to load driver: r600_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: r600
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL error: dlopen /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so failed (/home/hippiehunter/HoN/libs-x86_64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so))
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
K2 - Fatal Error: ARB_vertex_buffer_object not available.
 alright, that gives us something to work with, it looks like the C++ runtime libraries that were linked into Xorg Edgers are a higher version then the ones shipped with HoN. Easy fix go delete ~/HoN/libs-x86_64/libstdc++.so.6. Problem solved, HoN now runs at an acceptable framerate and doesnt seem to have any graphical glitches or crashes.

Tuesday, May 1, 2012

Using C++11 lambdas with boost::spirit::qi semantic actions

here is a micro example

 typedef rule<Iterator, Label*(), space_type> label_rule_type;  
 label = lit(':') > symbol[[&](string& name, typename label_rule_type::context_type& context)   
          {   
           boost::fusion::at_c<0>(context.attributes) = _ast->addLabel(name);  
          }];  

the most important part here is the typedef and its context_type. If you just want to use C++11 lambdas to do very simple things with your passed attribute things are very easy, but if you want access to the locals or the qi::_val, you'll have to use the context parameter. context is a very templated instance of boost::spirit::context that gives you access to two boost::fusion sequences; attributes and locals.

Monday, February 21, 2011

Vector arg to map conj must be a pair

One of my least favorite things about working in clojure is the error messages. Often you will end up with an error that makes perfect sense if you're looking at the problem but is nearly useless when trying to find it. Here is one example that I ran into today and wasn't able to find a direct solution by searching the error message it manifestsed itself to me in leiningen but its really a clojure error message. Sometimes when using leiningen you'll run into "Vector arg to map conj must be a pair". Its caused when you try to pass more then 2 elements as a vector instead of as a map.

Example in code -
(conj {} [:something "something" :dark "side"]) -- Fails
(conj {} [:something "something"]) -- Succeeds

The second conj succeeds and reveals why this can be masked, passing a vector with 2 elements into the conj of a map will succeed.

Example when using lein-js


(defproject myexample "1.0.0-SNAPSHOT"
  :js { :prod-options [:process-closure-primitives true
                                 :compilation-level :advanced-optimizations]})



should be


(defproject myexample "1.0.0-SNAPSHOT"
  :js { :prod-options {:process-closure-primitives true
                                 :compilation-level :advanced-optimizations}})