Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sampling 1x1 texture vs if statements


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 wildboar   Members   -  Reputation: 281

Like
0Likes
Like

Posted 28 July 2012 - 10:01 AM

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.

Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 7969

Like
0Likes
Like

Posted 28 July 2012 - 11:27 AM

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.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS