Known Bugs in the Shader Subsystem
Here is a list of known bugs, with workarounds:
Problem: Register Allocation.
Problem: nVidia's Cg compiler tries to assign registers to parameters. Under a variety of circumstances, the Cg compiler will assign the same register to two parameters, or to a parameter and to a constant in the program.
Workaround: We have found that if you manually allocate registers by supplying a semantic string for each parameter, this problem is bypassed.
Problem: Bad Target Languages.
Problem: nVidia's Cg compiler will choose one of several different "target" languages to translate the Cg program into. When the Cg compiler tries to translate the program into the VP40/FP40 language, it often produces incorrect output.
Workaround: We have discovered that translation into ARBVP1/ARBFP1 seems to work reliably. Since that language is supported on essentially every video card, it is usually safe to translate into that language. We have provided a config-variable that you can use to suppress bleeding edge stuff:
basic-shaders-only #t
This variable is enabled by default.
At some point, when functionality that is currently flaky becomes reliable,
we may expand the definition of what constitutes 'basic' shaders.
Problem: Cg program too complex for driver.
Problem: Panda will translate the shader into the ARBVP1/ARBFP1 profile by default, for the reason stated above. If instructions are used that are not supported by these profiles, this error will occur.
Workaround: You need to disable the basic-shaders-only flag to allow Panda to translate the shaders into profiles that do support the used instructions:
basic-shaders-only #f
Note that by doing so you might run into the problem above, and it is not recommended to do so unless you really need it.
Problem: Untested/Unfinished DirectX Support.
Problem: Shader development is currently being done in OpenGL. The DirectX support typically lags behind, and is often less fully-tested.
Workaround: The default setting for Panda is to use OpenGL, not DirectX. For now, when using shaders, do not change this setting.