Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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: 363

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: 14198

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


It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums




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