hlsl.samplecmplevelzero.offset.dx10.frag 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. SamplerComparisonState g_sSamp : register(s0);
  2. uniform Texture1D <float4> g_tTex1df4 : register(t0);
  3. Texture1D <int4> g_tTex1di4;
  4. Texture1D <uint4> g_tTex1du4;
  5. Texture2D <float4> g_tTex2df4;
  6. Texture2D <int4> g_tTex2di4;
  7. Texture2D <uint4> g_tTex2du4;
  8. Texture3D <float4> g_tTex3df4;
  9. Texture3D <int4> g_tTex3di4;
  10. Texture3D <uint4> g_tTex3du4;
  11. TextureCube <float4> g_tTexcdf4;
  12. TextureCube <int4> g_tTexcdi4;
  13. TextureCube <uint4> g_tTexcdu4;
  14. Texture1DArray <float4> g_tTex1df4a;
  15. Texture1DArray <int4> g_tTex1di4a;
  16. Texture1DArray <uint4> g_tTex1du4a;
  17. Texture2DArray <float4> g_tTex2df4a;
  18. Texture2DArray <int4> g_tTex2di4a;
  19. Texture2DArray <uint4> g_tTex2du4a;
  20. TextureCubeArray <float4> g_tTexcdf4a;
  21. TextureCubeArray <int4> g_tTexcdi4a;
  22. TextureCubeArray <uint4> g_tTexcdu4a;
  23. struct PS_OUTPUT
  24. {
  25. float4 Color : SV_Target0;
  26. float Depth : SV_Depth;
  27. };
  28. PS_OUTPUT main()
  29. {
  30. PS_OUTPUT psout;
  31. // 1D
  32. float r01 = g_tTex1df4 . SampleCmpLevelZero(g_sSamp, 0.1, 0.75, 2);
  33. float r03 = g_tTex1di4 . SampleCmpLevelZero(g_sSamp, 0.1, 0.75, 2);
  34. float r05 = g_tTex1du4 . SampleCmpLevelZero(g_sSamp, 0.1, 0.75, 2);
  35. // 2D
  36. float r21 = g_tTex2df4 . SampleCmpLevelZero(g_sSamp, float2(0.1, 0.2), 0.75, int2(2,3));
  37. float r23 = g_tTex2di4 . SampleCmpLevelZero(g_sSamp, float2(0.1, 0.2), 0.75, int2(2,3));
  38. float r25 = g_tTex2du4 . SampleCmpLevelZero(g_sSamp, float2(0.1, 0.2), 0.75, int2(2,3));
  39. // *** There's no SampleCmpLevelZero on 3D textures
  40. // This page: https://msdn.microsoft.com/en-us/library/windows/desktop/bb509696(v=vs.85).aspx
  41. // claims offset is supported for cube textures, but FXC does not accept it, and that does
  42. // not match other methods, so it may be a documentation bug. Those lines are commented
  43. // out below.
  44. // Cube
  45. // float r51 = g_tTexcdf4 . SampleCmpLevelZero(g_sSamp, float3(0.1, 0.2, 0.3), 0.75, int2(2,3));
  46. // float r53 = g_tTexcdi4 . SampleCmpLevelZero(g_sSamp, float3(0.1, 0.2, 0.3), 0.75, int2(2,3));
  47. // float r55 = g_tTexcdu4 . SampleCmpLevelZero(g_sSamp, float3(0.1, 0.2, 0.3), 0.75, int2(2,3));
  48. psout.Color = 1.0;
  49. psout.Depth = 1.0;
  50. return psout;
  51. }