PerCameraData.bslinc 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. Parameters =
  2. {
  3. float3 gViewDir : auto("ViewDir");
  4. float3 gViewOrigin : auto("ViewOrigin");
  5. mat4x4 gMatViewProj : auto("VP");
  6. mat4x4 gMatView : auto("V");
  7. mat4x4 gMatProj : auto("P");
  8. mat4x4 gMatInvProj : auto("IP");
  9. mat4x4 gMatInvViewProj : auto("IVP");
  10. // Special inverse view-projection matrix that had projection entries that affect z and w eliminated.
  11. // Used to transform a vector(clip_x, clip_y, view_z, view_w), where clip_x/clip_y are in clip space,
  12. // and view_z/view_w in view space, into world space
  13. mat4x4 gMatScreenToWorld : auto("ScreenToWorld");
  14. // Converts device Z to world Z using this formula: worldZ = (1 / (deviceZ + y)) * x
  15. float2 gDeviceZToWorldZ : auto("DeviceToWorldZ");
  16. // x - near plane distance, y - far plane distance
  17. float2 gNearFar : auto("NearFar");
  18. // xy - Viewport offset in pixels
  19. // zw - Viewport width & height in pixels
  20. int4 gViewportRectangle : auto("ViewportRect");
  21. // xy - (Viewport size in pixels / 2) / Target size in pixels
  22. // zw - (Viewport offset in pixels + (Viewport size in pixels / 2) + Optional pixel center offset) / Target size in pixels
  23. float4 gClipToUVScaleOffset : auto("ClipToUVScaleOffset");
  24. };
  25. Blocks =
  26. {
  27. Block PerCamera : auto("PerCamera");
  28. };
  29. Technique : base("PerCameraData") =
  30. {
  31. Language = "HLSL11";
  32. Pass =
  33. {
  34. Common =
  35. {
  36. cbuffer PerCamera
  37. {
  38. float3 gViewDir;
  39. float3 gViewOrigin;
  40. float4x4 gMatViewProj;
  41. float4x4 gMatView;
  42. float4x4 gMatProj;
  43. float4x4 gMatInvProj;
  44. float4x4 gMatInvViewProj;
  45. float4x4 gMatScreenToWorld;
  46. float2 gDeviceZToWorldZ;
  47. float2 gNearFar;
  48. int4 gViewportRectangle;
  49. float4 gClipToUVScaleOffset;
  50. }
  51. };
  52. };
  53. };
  54. Technique : base("PerCameraData") =
  55. {
  56. Language = "GLSL";
  57. Pass =
  58. {
  59. Common =
  60. {
  61. layout(binding = 0, std140) uniform PerCamera
  62. {
  63. vec3 gViewDir;
  64. vec3 gViewOrigin;
  65. mat4 gMatViewProj;
  66. mat4 gMatView;
  67. mat4 gMatProj;
  68. mat4 gMatInvProj;
  69. mat4 gMatInvViewProj;
  70. mat4 gMatScreenToWorld;
  71. vec2 gDeviceZToWorldZ;
  72. vec2 gNearFar;
  73. ivec4 gViewportRectangle;
  74. vec4 gClipToUVScaleOffset;
  75. };
  76. };
  77. };
  78. };