ShaderVariablesFunctions.deprecated.hlsl 734 B

1234567891011121314151617
  1. #ifndef UNITY_SHADER_VARIABLES_FUNCTIONS_DEPRECATED_INCLUDED
  2. #define UNITY_SHADER_VARIABLES_FUNCTIONS_DEPRECATED_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Input.hlsl"
  4. // Deprecated: A confusingly named and duplicate function that scales clipspace to unity NDC range. (-w < x(-y) < w --> 0 < xy < w)
  5. // Use GetVertexPositionInputs().positionNDC instead for vertex shader
  6. // Or a similar function in Common.hlsl, ComputeNormalizedDeviceCoordinatesWithZ()
  7. float4 ComputeScreenPos(float4 positionCS)
  8. {
  9. float4 o = positionCS * 0.5f;
  10. o.xy = float2(o.x, o.y * _ProjectionParams.x) + o.w;
  11. o.zw = positionCS.zw;
  12. return o;
  13. }
  14. #endif // UNITY_SHADER_VARIABLES_FUNCTIONS_DEPRECATED_INCLUDED