Skip to main content
gamedev.net
🔒 Locked

quick render state question

Started by jlashmet 3 replies 550+ views
Original Post
jlashmet
jlashmet
Lets say I set a texture with the following code: device->SetTexture(myTexture); If I call this line twice in a row, will directx know the second call that the texture is already set and return, or does it still perform the action and eat up processing?
Pipo DeClown
Pipo DeClown
IIRC, it''s the latter.

--
You''re Welcome,
Rick Wong

- sitting in his chair doing the most time-consuming thing..
Agony
Agony
If I recall, it''s partially dependent upon which graphics drivers are installed. If you use the debug build of Direct3D, you''ll notice in the debug output that it often says that it is ignoring rendundant SetRenderState() calls, and similar things. However, I''ve noticed that, at least sometimes, handling redundant settings manually, instead of allowing DirectX to do the work, can noticeably improve performance.

Personally, I would first try to design my engine so that redundant settings aren''t often made in the first place. Then, I would let DirectX handle the settings, while I worked on other things. Finally, after the majority of the engine was in place, if I noticed that the redundant settings were causing performance issues, I would then handle them manually.


Most of the greatest evils that man has inflicted upon man have come through people feeling quite certain about something which, in fact, was false.

-Bertrand Russell, Unpopular Essays, "Ideas That Have Harmed Mankind"
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o
DBX
DBX
Which is the quickest. A simple if statement in your code, or a call into D3D which may or may not do it's own processing before (probably) calling into the (kernel mode) driver.

Edit: Oh yeah, try comparing against just the call on it's own.

[edited by - DBX on April 26, 2004 1:27:10 PM]
Pipo DeClown
Pipo DeClown
What I suggest is, that you take some time and code your own D3Dstates class, and maybe a states_set class.

--
You''re Welcome,
Rick Wong

- sitting in his chair doing the most time-consuming thing..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.