PerCameraData.bslinc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. // xy - Viewport offset in pixels
  17. // zw - Viewport width & height in pixels
  18. int4 gViewportRectangle : auto("ViewportRect");
  19. // xy - (Viewport size in pixels / 2) / Target size in pixels
  20. // zw - (Viewport offset in pixels + (Viewport size in pixels / 2) + Optional pixel center offset) / Target size in pixels
  21. float4 gClipToUVScaleOffset : auto("ClipToUVScaleOffset");
  22. };
  23. Blocks =
  24. {
  25. Block PerCamera : auto("PerCamera");
  26. };
  27. Technique : base("PerCameraData") =
  28. {
  29. Language = "HLSL11";
  30. Pass =
  31. {
  32. Common =
  33. {
  34. cbuffer PerCamera
  35. {
  36. float3 gViewDir;
  37. float3 gViewOrigin;
  38. float4x4 gMatViewProj;
  39. float4x4 gMatView;
  40. float4x4 gMatProj;
  41. float4x4 gMatInvProj;
  42. float4x4 gMatInvViewProj;
  43. float4x4 gMatScreenToWorld;
  44. float2 gDeviceZToWorldZ;
  45. int4 gViewportRectangle;
  46. float4 gClipToUVScaleOffset;
  47. }
  48. };
  49. };
  50. };
  51. Technique : base("PerCameraData") =
  52. {
  53. Language = "GLSL";
  54. Pass =
  55. {
  56. Common =
  57. {
  58. layout(binding = 0, std140) uniform PerCamera
  59. {
  60. vec3 gViewDir;
  61. vec3 gViewOrigin;
  62. mat4 gMatViewProj;
  63. mat4 gMatView;
  64. mat4 gMatProj;
  65. mat4 gMatInvProj;
  66. mat4 gMatInvViewProj;
  67. mat4 gMatScreenToWorld;
  68. vec2 gDeviceZToWorldZ;
  69. ivec4 gViewportRectangle;
  70. vec4 gClipToUVScaleOffset;
  71. };
  72. };
  73. };
  74. };