Why hydrax uses tex1D in cg shaders only on WIN32?

heavydist

05-06-2012 01:57:38

In the shader generation code, there are numerous places that look like this:

FragmentProgramData +=
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
"uniform sampler1D uFresnelMap : register(s" + Ogre::StringConverter::toString(TexNum) + ")";
#else
"uniform sampler2D uFresnelMap : register(s" + Ogre::StringConverter::toString(TexNum) + ")";
#endif


Why differentiate between WIN32 and other platforms here? Why not just use sampler2D everywhere and be done with it? Does this improve performance in any significant way, or are there any other legitimate reasons for this, or can I safely remove the distinction?

(Trivia:
The problem is with sampler1D and OpenGL. The texture basically does not work and shader always gets black color instead of actual texture pixels. We (me and people on StackExchange :P) think that this is due to 1-dimensional texture not being initialized properly with GL, with a function like glEnable(GL_TEXTURE_1D). It seems like Hydrax simply adds the fresnel texture normally, like the rest of them, and so Ogre does not initialize this texture in that special way, which OpenGL seem to require to be able to use tex1D in the shader. (But all works fine in DirectX, and that's what HydraX demo uses, probably the reason this was never fixed?)
(One could argue that GLSL shaders should be used when doing OpenGL, but hey, if the worked properly, I would :P)
)