• "Bite off more than you can chew and then chew like hell." - Peter Brock
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Thrustmaster 24 Hours of Le Mans (LIVE)
Click the cross to dismiss this video
Dear fan, please make sure to like the video and subscribe to our channel to be eligible to win this round's prize provided by our sponsor.

error C1101: ambigous overloaded function reference "max(int,int)"

Discussion in 'Racer Problems & Fixes' started by HellFire, Dec 30, 2011.

  1. HellFire



    I just downloaded racer 0.8.37 from main site.

    racer.exe starts normal, but when I click "Free Driving" or "Select car" game crash with shader error:

    Window title: "Fatal error - the program will exit"
    in window lot of warnings and error:
    data/renderer/shaders/shadowmapping.cg(87) : error C1101: ambiguous overloaded function reference "max(int,int)"

    My config is:
    Windows 7
    i5 processor
    Intel HD Graphics (Sandybridge)
    Graphics driver
  2. HellFire


    I worarounded that max() function, but there are many others problems related to Cg shaders.

    data/renderer/shaders/standard_xtree_f.cg(88) : error C3004: function "float ddx(float);" not supported in this profile

    I also checked latest Intel driver (2559) and there is same problem

    any ideas?
  3. KS95

    RACER Moderator

    You need a proper graphics card, preferably nVidia.
  4. twister77


    KS95 is right, stand alone graphics card will take care of your problem. nVidia GTX 550 Ti or higher for good performance of Racer..
  5. HellFire


    I checked it on NVidia driver and as it works.
    But I think that fault is not caused by graphics card, but there are rather SW bugs in Racer code.

    I workarounded Cg related errors, and now Racer starts on Intel, geometry looks ok, but there is no textures at all.

    I am rather not experienced as Cg programmer, but some parts of that program looks suspicious for me.

    File: shadowmapping.cg:88
    int iSqrtSamples=max((iSqrtSamples-index),2);

    It looks like use of unintialized variable iSqrtSamples, and whole line rather doesn't make sense.
    Another problem is that max function is not defined for (int,int) arguments (according to NVidia docs at http://http.developer.nvidia.com/Cg/max.html ).
    Of course not-strict std library can implement max(int,int) function, but using such undocumented functions is risky (at least for performance, even when it works).

    There also set of suspicious warnings and errors related to use not suported functions in used profiles - but because my first contact with Cg language was few hours ago, I still don't understand it.
    But it also looks like use some undocumented features that should not be used.

    Maybe somebody who wrote that programs (or know more about Cg) should review that code once more?

    I'll also try to check why I don't see textures.
    I am experienced in OpenGL apps debugging, but maybe I could find what is wrong also here.
    I think it should not be much work to run racer also on Intel GPU.
    Intel should support Cg and all necessary extensions to run Racer.
  6. DavidI


    Cg in complex form is only available to nVidia GPU's, unless someone wants to write a Cg profile for their GPU. Racer one day will use GLSL which is the open source equivalent of Cg. Then most recent GPU's with GLSL enabled drivers will all be able to use the complex shaders. Until then, it's just not worth the effort.