• Advertisement

Archived

This topic is now archived and is closed to further replies.

Setting the same state twice...

This topic is 5105 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does Direct3D 9 keep a record of what the current render states/textures/materials are? So if I did something like: set texture (1) draw vertices set texture (1) draw vertices set texture (2) draw vertices Would it ignore the middle texture set command, or would it still incur a penalty like I''d switched to a different texture? --------------------------------------- Let''s struggle for our dream of Game! http://andrewporritt.4t.com

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Don''t rely on it, just don''t do it.

Share this post


Link to post
Share on other sites
In general, if you create your D3D device as a PURE device, then most states will not be saved. State changes are passed on to the driver as fast as possible. That means that D3D would not be able to detect if you set a redundant state because it doesn''t keep track of state information.

If you create your D3D device as a NON-PURE device, then D3D will keep track of state and check all state changes for redundancy. It will only pass to the driver those state changes that are not redundant. The problem with this is that it may degrade performance.

The best bet is to use a PURE device and keep track of your own states. That being said, even a PURE device will keep track of *some* states. Thanks to Coder for clearing me up on this issue. A PURE device will keep track of those states that have an associated interface, with the exception of SetPixelShader. For example, calling SetTexture requires you to pass in a pointer to an object of the IDirect3DTexture9 interface. A PURE D3D device will keep track of this and even if you call SetTexture again with the same argument, it will not pass it on to the driver. This applies to other methods that take interfaces as arguements, like SetStreamSource, SetIndices, and SetVertexShader.

But note that this does not apply to SetPixelShader. There are some underlying reasons for this that I think were explained in messages in the DirectXDev mailing list. On a PURE device, SetPixelShader will pass any arguments on to the driver, so you have to take care to not call it redundantly.

Hope this helps,
neneboricua

Share this post


Link to post
Share on other sites
Also run in debug mode with the details set to max, it''ll actually list all the redundant renderstates and other flags... over and over.

Share this post


Link to post
Share on other sites

  • Advertisement