Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Oct 2011
Offline Last Active Jul 08 2015 05:50 AM

#4920713 Recursive Methods

Posted by Ghosrath on 09 March 2012 - 11:10 AM

i watched the next episode of the tutorial. That will explain in detail what type of error you are gettting and how to solve it!

#4920681 Recursive Methods

Posted by Ghosrath on 09 March 2012 - 09:03 AM

Could you be a bit more specific on where you are stuck and why you are stuck..

What error message do you get?

#4920367 Why can't i use tex2D in loop with HLSL?

Posted by Ghosrath on 08 March 2012 - 02:57 AM

with googling around i found 2 answers:


OK, this is a bit difficult to explain. First, the reason why the second one works, is because it is automatically unrolled. You loop a constant amount of iteration, so the compiler can silently unroll without side effects.

Now, the reason the first doesn't work as expected, is due to the fact that derivatives (as used by a gradient instruction, such as tex2D) are undefined within a conditional statement (such as the one implicitly used by the loop).

You can solve this by either not using derivatives at all (ie. supplying a constant LOD through tex2DLod rather than the tex2D) or by manually computing the derivatives outside of the loop, and supplying them explicitly. If you only want to blur a screen aligned rectangle, then the best method is the former one.




The compiler needs to prove that the loop will terminate within 1024
iterations to target the ps_2_0 profile. Since your index value comes from
a global, no range information can be infered beyond the 32-bit int type.
You can force this by doing something like:

int x = gNum % 1023;
for( int i = 0; i < x; i++ ) ...

resource: http://www.ureader.com/msg/146533.aspx

hope this helps :)