Jump to content
  • Advertisement
Sign in to follow this  
cephalo

Sampling Textures in the domain shader. [solved]

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

So I'm ready to try some displacement mapping in my project, and my domain shader is already something of a beast.

 

However, these lines of code:

	float4 rivColor = riverTextures.SampleLevel(samLinear,dout.RiverTexCoord,0.0f);
	position.y -= rivColor.r * 1.02;

Are absolutely KILLING my framerate. It's going from about 60 fps to 3 or 4 fps. sad.png

 

This vid card is not great, but something tells me I'm doing something wrong.

 

EDIT: Argggh, I didn't load the texture into my shader! I guess I need that.

 

EDIT2: Well, unfortunately I fixed that problem, and I can see my samples in the right place, but it is still destroying my framerate. I guess my question is, is texture sampling in a domain shader normally an extremely expensive operation?

 

EDIT3: So I took it home and tried it on a better vid card, with similar bad results. Not only is it terribly slow, but it bubbles and boils when the camera is moved. It's safe to say I do not have a proper scheme for mip selection, but why so slow?

Edited by cephalo

Share this post


Link to post
Share on other sites
Advertisement

Ok, I figured it out. I forgot to set my sampler for the domain shader. Fixed that and my framerate went back up to where it was, phew!

 

I still have a whole lot of ugliness going on, but I have more work to do before I can ask intelligent questions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!