detecting autoshader failure


i’m working on a project that is close to be finished. i am using the autoshader generator, where one of the most important features i am using is the shadows. however depending on the hardware i am limited to the amount of lights i can use.

my problem is that the autoshader fails if too many lights are active.

:gobj(error): created-shader: (21) : error C5041: cannot locate suitable resource to bind parameter "l_slightcoord5"
:gobj(error): Shader encountered an error.
... [more similar lines]

i would need a way to detect this error within python and invoke the shader generating system a second time using fewer lights. is there something builtin already or do i need to dig into the code to get this information?


No, right now there is no way to detect failure, as far as I know.

As for the error, it should go away when you set basic-shaders-only to #f.

the error occurs with basic shaders disabled. with basic shaders enabled the error is:

:gobj(error): Cg program too complex for driver: created-shader. Try choosing a different profile.

do you have any hint how i could detect this error (i mean the one described in the first post)?

i’ve found a way to get the errors by parsing the log-messages.

just for reference:

# redirect the log messages to the ss-stringstream
nout = MultiplexStream()
Notify.ptr().setOstreamPtr(nout, 0)
ss = StringStream()
# run a task that updates the global variable MAX_LIGHTS
  txt = ss.getData()
  if txt:
    if 'l_slightcoord' in txt:
      num = int(txt.split('l_slightcoord')[1][0])
      global MAX_LIGHTS
      if num != MAX_LIGHTS:
        print "I: SceneHandler.MAX_LIGHT_UPDATE", num
        MAX_LIGHTS = int(num)
  return task.cont