Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


performance question


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
2 replies to this topic

#1 lomateron   Members   -  Reputation: 389

Like
0Likes
Like

Posted 08 February 2013 - 09:42 PM

Is it bad for performance if when rendering to every texel of a texture, in the pixel shader method I read 8 different texels of another texture to combine them and return a value.



Sponsor:

#2 Polarist   Members   -  Reputation: 160

Like
0Likes
Like

Posted 09 February 2013 - 12:39 AM

It's not necessarily worse than any other approach  (it will be approximately 8x slower than 1 texture read, for obvious reasons).  For instance, if you wanted to implement an edge-detection kernel, you might need to sample from the 8 surrounding texels of that same texture.

 

There are ways to improve performance though, for instance calculating those texcoords in the vertex shader rather than the pixel shader.

 

Perhaps if you attached your code it would be easier to say whether you're being wasteful of resources or not.



#3 L. Spiro   Crossbones+   -  Reputation: 18892

Like
0Likes
Like

Posted 09 February 2013 - 03:32 AM

It depends on why you are doing it.

Do you think you are achieving better results on your standard 3D models in your scene?  Yes, it is wasteful.  Anything you gain in quality, which will probably be nothing but a blurrier texture, won’t be worth the extra texture samples.

 

Are you trying to make a special effect that require 8 texture reads?  Then your performance is exactly what it has to be for that effect, and that effect is twice as costly (roughly) as an effect that requires only 4 reads.  You have to decide how much performance you are going to put into your effects.

 

Dependent texture reads (what you are doing, unless you are doing as suggested above in which the texture coordinates are all calculated in the vertex shader) are slow.  Independent texture reads can be cached up-front and thus are fast enough to replace some heavy equations.  That should give you a general idea of the overhead involved in texture reads.

 

 

L. Spiro






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