sample_unroll.hlsl 933 B

12345678910111213141516171819202122232425262728293031
  1. // RUN: %dxc -E main -T ps_6_0 %s -Od | FileCheck %s
  2. // When we sample texture in a loop, in effort to legalize
  3. // the offsets, an unroll will be done. This tests that
  4. // it still works in Od.
  5. // CHECK: @main
  6. // CHECK: call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60
  7. // CHECK-SAME: i32 -1, i32 -1
  8. // CHECK: call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60
  9. // CHECK-SAME: i32 0, i32 0
  10. // CHECK: call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60
  11. // CHECK-SAME: i32 1, i32 1
  12. // CHECK: call %dx.types.ResRet.f32 @dx.op.sample.f32(i32 60
  13. // CHECK-SAME: i32 2, i32 2
  14. Texture2D tex0 : register(t0);
  15. Texture2D tex1 : register(t1);
  16. SamplerState samp0 : register(s0);
  17. [RootSignature("DescriptorTable(SRV(t0), SRV(t1)), DescriptorTable(Sampler(s0))")]
  18. float4 main(float2 uv : TEXCOORD) : SV_Target {
  19. float4 ret = float4(0,0,0,0);
  20. for (int i = -1; i < 3; i++) {
  21. ret += tex0.Sample(samp0, uv, int2(i,i));
  22. }
  23. return ret;
  24. }