Jump to content
  • Advertisement
Sign in to follow this  
wildboar

Sampling 1x1 texture vs if statements

This topic is 2185 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 am programming for the ipad 3 and my material system currently checks if a texture is applied to a material slot, if its not then it uses default 1x1 white pixel as a sample in the shader. The shader samples 4 textures like this and combines them. Is this an ok way to do it or should I use if statements (if texture 2 is attached then sample).

Also does anyone know why sampling a depth texture is so damn slow on ipad 3? its a 768x768 texture that is a static shadow map. As soon as I enabe sampling of it fps drops by at least 10.

Share this post


Link to post
Share on other sites
Advertisement
A drop by 10 fps may or may not be slow depending on what kind of framerate you were getting beforehand. At the same time, you may have weak non-power-of-two support so padding the texture out to 1024x1024 might enable your driver and/or hardware to take a more optimized path.

Regarding your first question, I'd be inclined to go with the 1x1 texture as it would give you cleaner code and less state changes. You're not clear however on whether the if statement would happen in a shader or in your C/C++ code so it's difficult to form any kind of overall recommendation.

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!