error X4014: cannot have gradient operations inside loops with divergent flow control
finally got my loops to not unroll in the shader and now ive got a problem that it only lets me use samplelevel, and sample level doesnt seem to work with texture wrap over!!!! is this right?
Im trying to raytrace some fractal noise, is there any solution to my problem?
sorta... got it working, but its going really slow, im float modulating by 1.0f in the texture coordinate, theres got to be a better way than that tho... this should be realtime.
SampleLevel should work fine with wrapping; you just have to pass in a sampler state that sets AddressU and AddressV to Wrap.
You're not getting proper mipmapping this way, of course. You would need to do the texture lookup outside the loop in order for it to work. Regular texturing implicitly uses the UV derivatives to select the mip level. It seems you cannot take derivatives inside a loop or branch...that kinda sucks, but it's understandable. The hardware does derivatives by comparing values across nearby pixels, but if those nearby pixels might take a different execution path through the shader due to loops or branches, it doesn't have anything to compare to.
If you can calculate the UV derivatives yourself, you can use them with SampleGrad to get mipmapping back.
hahahaha oh silly me, i forgot to set the sampler!!!! XD got me... thanks reedbeta.