Sign in to follow this  

Shadowmapping with shader: tex2D takes incredible resources with my shadowmap

This topic is 4382 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

In my shader, doing a tex2D on my shadowmap takes incredible resources. I have just for the heck of it tried to use some other texture map, just to see if it was the indexing, that did it. And it seems as if it is... What is the reason? The stencil-defined surface? The format I use? My shadowmap's stencil surface is created with: D3DFMT_D24X8. The shadowmap texture is created with: D3DFMT_R32F. Shadowmap texture is furthermore defined as a D3DUSAGE_RENDERTARGET (of course). Is it a data format? Or is it because it is a rendertarget? Or something else that I totally overlook? Do you have similar performance problems indexing into the shadowmap on the shader, compared to indexing into "normal" textures? Edit: My card is ATI Radeon 9600. maybe it has special problems?

Share this post


Link to post
Share on other sites
If you render to your shadow map and then immediately read from it, you could be hitting a stall because the graphics card may not have finished rendering the shadow map in the first place by the time you try to access it.

You're also using a floating point texture format. The 9600 is a first generation SM2.0 card so it may not have the most optimzied floating point texture fetches. Fetching non-floating point textures is usually very fast, but floating point ones may not be as optimized.

neneboricua

Share this post


Link to post
Share on other sites
I have a 9600 here as well and have had real problems with R32F shadow maps as far as I can recall. Do you have the lastest driver available?

What do you mean by "takes incredible resources"? Do you mean the drop in FPS you see?

Also if your shadow map is a non-Pow2 size that may be affecting things.

Quote:
If you render to your shadow map and then immediately read from it, you could be hitting a stall because the graphics card may not have finished rendering the shadow map in the first place by the time you try to access it.


As long as you are not locking your shadow map surface you should not hit a stall as all you are doing is pushing more commands onto the command stream for the gfx card - the commands are executed in order so if you push: "Render To rtX" followed by "Render Using rtX to rtY" there should be no stall because "Render Using rtX" only occurs after "Render To rtX". IIRC.

Hope this helps narrow things down!

Mike.

Share this post


Link to post
Share on other sites
The drop in FPS can be 50% or more, if I render a large area (like fullscreen 1024x768).

If I just index a garbage texture (I try to index the scene texture just to test, visual result is horrible, hehe), the FPS soar up again, barely making it noticable whether I use shadowmaps or not.

So I have concluded so far that it must be the shadowmap itself, and not the tex2D indexing...

I will get a friend to download my demo and test for FPS fullscreen vs. small window to see if he gets similar results. He has a kickass card, I am suspecting that my card is the culprit.

Share this post


Link to post
Share on other sites

This topic is 4382 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this