Quantcast
Channel: Questions in topic: "hlsl"
Viewing all articles
Browse latest Browse all 206

How to prevent shader optimizations?

$
0
0
I was testing shader instruction performance, and to make results more clear i made a loop, and unrolled it.
[unroll] for(int j = 0; j < TEST_COUNT; j++)
{
	col = tex2D(_MainTex, i.uv.xy);					
}
But compiler optimized it and got rid of the whole loop, here ASM:
 8: mov o1.xyzw, v1.xyxy
 9: sample_l o2.xyzw, v1.xyxx, t0.xyzw, s0, v1.y
10: mov o3.xyzw, l(0.500000,0.500000,0.500000,0.500000)
So i did this:
[unroll] for(int j = 0; j < TEST_COUNT; j++)
{
	[isolate]
	{
		col = tex2D(_MainTex, i.uv.xy);			
	}
}
And compiler said: "**unknown attribute isolate, or attribute invalid for this statement**" Even if i add a little value to uv it doesn't helps

Viewing all articles
Browse latest Browse all 206

Trending Articles