hlsl.texture.struct.frag 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. struct s1_t {
  2. float c0;
  3. float2 c1;
  4. float c2;
  5. };
  6. struct s2_t {
  7. float c0;
  8. float3 c1;
  9. };
  10. struct s3_t {
  11. float2 c0;
  12. float1 c1;
  13. };
  14. struct s4_t {
  15. int c0;
  16. int2 c1;
  17. int c2;
  18. };
  19. struct s5_t {
  20. uint c0;
  21. uint c1;
  22. };
  23. SamplerState g_sSamp;
  24. Texture2D <s1_t> g_tTex2s1;
  25. Texture2D <s2_t> g_tTex2s2;
  26. Texture2D <s3_t> g_tTex2s3;
  27. Texture2D <s4_t> g_tTex2s4;
  28. Texture2D <s5_t> g_tTex2s5;
  29. Texture2D <s1_t> g_tTex2s1a; // same type as g_tTex2s1, to test fn signature matching.
  30. // function overloading to test name mangling with textures templatized on structs
  31. s1_t fn1(Texture2D <s1_t> t1) { return t1 . Sample(g_sSamp, float2(0.6, 0.61)); }
  32. s2_t fn1(Texture2D <s2_t> t2) { return t2 . Sample(g_sSamp, float2(0.6, 0.61)); }
  33. float4 main() : SV_Target0
  34. {
  35. s1_t s1 = g_tTex2s1 . Sample(g_sSamp, float2(0.1, 0.11));
  36. s2_t s2 = g_tTex2s2 . Sample(g_sSamp, float2(0.2, 0.21));
  37. s3_t s3 = g_tTex2s3 . Sample(g_sSamp, float2(0.3, 0.31));
  38. s4_t s4 = g_tTex2s4 . Sample(g_sSamp, float2(0.4, 0.41));
  39. s5_t s5 = g_tTex2s5 . Sample(g_sSamp, float2(0.5, 0.51));
  40. s1_t r0 = fn1(g_tTex2s1);
  41. s2_t r1 = fn1(g_tTex2s2);
  42. s1_t r2 = fn1(g_tTex2s1a);
  43. return 0;
  44. }