Jump to content
  • Advertisement
Sign in to follow this  
Stanza

No textures: fixed-function vs shaders

This topic is 4149 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an older app I'm revising to use shaders in place of fixed-function. One trick I used in that app was to disable texturing by assigning a NULL pointer for textures. This caused all geometry to be rendered in greyscale, making the results of lighting and shadows easy to see. However, with shaders, if no texture is assigned to a shader, the color is defaulting to black instead of white. Is this a difference between fixed-func and shaders, or am I missing some config setting? If this is an inherent difference between fixed-func and shaders, I can assign an all-white texture when in this mode. Was hoping to avoid the extra code changes that would require.

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure the behaviour is defined. I've seen cards return black, white, or just terminate the shader right then and there, returning whatever happened to be in R0.

Things may have matured a bit in the years since I noticed that behaviour, and something standard might now exist, but I'm not aware of any standard behaviour.

Share this post


Link to post
Share on other sites
IIRC, last time I tried this, NVIDIA used white and ATI used black. The best thing to do here is to create a couple procedural 1x1 textures and use those explicitly.

Share this post


Link to post
Share on other sites

Over here is some more info on this, but it seems fairly consistent with what's mentioned above. In addition to the tip Promit provided, this seems solid advice:

Quote:
The best advice is to avoid doing this. Write your Pixel Shaders or TextureStageState setups to do what you want to do, and no more. If that means you need a different shader/TSS for the "NULL texture" case, then do it. Usually that shader/TSS will run a lot faster than using a NULL texture, and it will be a lot more predictable. This is one of those odd little corners of the D3D spec that are very badly supported - best to avoid it.

Share this post


Link to post
Share on other sites
Inconsistent results across vendors.

Okay, that's the big red warning for me. So much for judging behavior based on the NVidia cards in all of my systems.

Thanks for the info.

Share this post


Link to post
Share on other sites
remigius' advice is good. If you need functionality, in this case no texturing, set up your texture stages or pixel shader accordingly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!