Jump to content

  • Log In with Google      Sign In   
  • Create Account

Texturing an object (DX vs Shader)


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

#1 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 14 February 2014 - 07:16 PM

I haven't really thought of this until now..... When rendering a scene with DX9 (no shader) it's not a good practice to change textures very often because state changes are slow. Therefore it's a good idea to render every object in the scene that use the same texture in a group and then change the texture and render objects that use the new texture and repeat, repeat, repeat......

 

The question is: do shaders suffer the same state change "slowdown"?



Sponsor:

#2 lwm   Members   -  Reputation: 1417

Like
5Likes
Like

Posted 14 February 2014 - 11:59 PM

Yes. You still want to switch between textures, shaders, and all other bound resources as little as possible. With DX9, switching between shaders is particularly expensive.


current project: Roa


#3 Hodgman   Moderators   -  Reputation: 30352

Like
5Likes
Like

Posted 15 February 2014 - 12:03 AM

When you're not using shaders, you're actually just asking the driver to use some built-in shaders that have been written for you! So it's he same either way.

#4 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 15 February 2014 - 07:11 AM

Just to be sure you understand my question. It's one or the other-- I'm not asking about mixing DX and shaders.

 

So you are saying switching textures will be a bottleneck regardless?



#5 lwm   Members   -  Reputation: 1417

Like
1Likes
Like

Posted 15 February 2014 - 09:13 AM


So you are saying switching textures will be a bottleneck regardless?

 

There is no way for us to know if it will be a bottleneck in your case. Every state change has a certain cost. How big that cost is (and how relevant that cost is for a given system) depends on lots of different factors, but for DX9 you probably want to sort by shader first, then by texture, then by everything else.


Edited by lwm, 15 February 2014 - 09:14 AM.

current project: Roa


#6 Hawkblood   Members   -  Reputation: 723

Like
0Likes
Like

Posted 15 February 2014 - 10:01 AM

Thanks all. I didn't want to write code for an entire scene just to have to rewrite it because of a bottleneck.






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