浏览代码

Various warning fix

/main
sebastienlagarde 6 年前
当前提交
985e604a
共有 5 个文件被更改,包括 22 次插入20 次删除
  1. 14
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Color.hlsl
  2. 5
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Common.hlsl
  3. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDAssetFactory.cs
  4. 20
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Handles.cs
  5. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/DeferredDirectionalShadow.compute

14
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Color.hlsl


// Gamma22
real Gamma22ToLinear(real c)
{
return pow(c, 2.2);
return PositivePow(c, 2.2);
return pow(c.rgb, real3(2.2, 2.2, 2.2));
return PositivePow(c.rgb, real3(2.2, 2.2, 2.2));
}
real4 Gamma22ToLinear(real4 c)

real LinearToGamma22(real c)
{
return pow(c, 0.454545454545455);
return PositivePow(c, 0.454545454545455);
return pow(c.rgb, real3(0.454545454545455, 0.454545454545455, 0.454545454545455));
return PositivePow(c.rgb, real3(0.454545454545455, 0.454545454545455, 0.454545454545455));
}
real4 LinearToGamma22(real4 c)

real3 SRGBToLinear(real3 c)
{
real3 linearRGBLo = c / 12.92;
real3 linearRGBHi = pow((c + 0.055) / 1.055, real3(2.4, 2.4, 2.4));
real3 linearRGBHi = PositivePow((c + 0.055) / 1.055, real3(2.4, 2.4, 2.4));
real3 linearRGB = (c <= 0.04045) ? linearRGBLo : linearRGBHi;
return linearRGB;
}

real3 LinearToSRGB(real3 c)
{
real3 sRGBLo = c * 12.92;
real3 sRGBHi = (pow(c, real3(1.0/2.4, 1.0/2.4, 1.0/2.4)) * 1.055) - 0.055;
real3 sRGBHi = (PositivePow(c, real3(1.0/2.4, 1.0/2.4, 1.0/2.4)) * 1.055) - 0.055;
real3 sRGB = (c <= 0.0031308) ? sRGBLo : sRGBHi;
return sRGB;
}

real3 FastLinearToSRGB(real3 c)
{
return saturate(1.055 * pow(abs(c), 0.416666667) - 0.055);
return saturate(1.055 * PositivePow(c, 0.416666667) - 0.055);
}
real4 FastLinearToSRGB(real4 c)

5
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Common.hlsl


// Using pow often result to a warning like this
// "pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them"
// PositivePow remove this warning when you know the value is positive and avoid inf/NAN.
TEMPLATE_2_REAL(PositivePow, base, power, return pow(max(abs(base), FLT_EPS), power))
// PositivePow remove this warning when you know the value is positive or 0 and avoid inf/NAN.
// Note: https://msdn.microsoft.com/en-us/library/windows/desktop/bb509636(v=vs.85).aspx pow(0, >0) == 0
TEMPLATE_2_REAL(PositivePow, base, power, return pow(abs(base), power))
// Composes a floating point value with the magnitude of 'x' and the sign of 's'.
// See the comment about FastSign() below.

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDAssetFactory.cs


// Load default renderPipelineResources / Material / Shader
string HDRenderPipelinePath = HDEditorUtils.GetHDRenderPipelinePath();
string PostProcessingPath = HDEditorUtils.GetPostProcessingPath();
string CorePath = HDEditorUtils.GetCorePath();
newAsset.defaultDiffuseMaterial = Load<Material>(HDRenderPipelinePath + "RenderPipelineResources/DefaultHDMaterial.mat");

20
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Handles.cs


{
partial class PlanarReflectionProbeUI
{
#if false
#endif
static readonly Color k_GizmoMirrorPlaneCamera = new Color(128f / 255f, 128f / 255f, 233f / 255f, 128f / 255f);
public static void DrawHandles(PlanarReflectionProbeUI s, PlanarReflectionProbe d, Editor o)

{
case EditBaseShape:
InfluenceVolumeUI.DrawGizmos(
s.influenceVolume,
d.influenceVolume,
mat,
InfluenceVolumeUI.HandleType.Base,
s.influenceVolume,
d.influenceVolume,
mat,
InfluenceVolumeUI.HandleType.Base,
s.influenceVolume,
d.influenceVolume,
s.influenceVolume,
d.influenceVolume,
InfluenceVolumeUI.HandleType.Influence,
InfluenceVolumeUI.HandleType.Influence,
s.influenceVolume,
s.influenceVolume,
InfluenceVolumeUI.HandleType.InfluenceNormal,
InfluenceVolumeUI.HandleType.InfluenceNormal,
InfluenceVolumeUI.HandleType.All);
break;
default:

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/DeferredDirectionalShadow.compute


float _DirectionalShadowIndex;
float3 _LightDirection;
float4 _ScreenSpaceShadowsParameters;
uint _SampleCount;
int _SampleCount;
CBUFFER_END
#define _ContactShadowLength _ScreenSpaceShadowsParameters.x

正在加载...
取消
保存