[HLSL, SM 4.0] Texture Sampling

Started by
4 comments, last by InvalidPointer 14 years, 7 months ago
Hi I just have a quick question about texture sampling in shader model 4.0. I know that the texture and the sampler have been de-coupled like this
float3 Col = gDiffuseMap.Sample(gTriLinearSam, pIn.Tex);

but what about if I want to sample a texture in a dynamic loop? In SM 3.0 I could use tex2Dgrad, but I am unsure how to use that in sm 4.0; as it requires the texture and sampler state to be combined. Can anyone help?
Advertisement
In SM4, the texture also has a SampleGrad method.

Niko Suni

Thanks thats what I wanted to know :D
Also, consider this to be a semi-official request to have stuff like this added to the DirectX docs, or at least made more prominent. (I know some of the DirectX devs actually read the board) All the intrinsics, etc. were pretty easy to find for DX9, but they're kinda briefly glossed over in a few samples and tutorials.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.
Texture object reference, SM4.x [smile]

Niko Suni

Quote:Original post by Nik02
Texture object reference, SM4.x [smile]


Thanks, and rate++. I never would have found that if you hadn't pointed it out.

I still think it would be a good idea to feature this in the "differences from DX9" segment or something.
clb: At the end of 2012, the positions of jupiter, saturn, mercury, and deimos are aligned so as to cause a denormalized flush-to-zero bug when computing earth's gravitational force, slinging it to the sun.

This topic is closed to new replies.

Advertisement