浏览代码

Rewrote sample bias computation to reduce register pressure.

Added new guard to 5x5 filter computation, as in certain combinations it can increase register pressure.
/main
uygar 7 年前
当前提交
b3808fd1
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 7
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Shadow/ShadowAlgorithms.hlsl
  2. 2
      ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Shadow/ShadowSampling.hlsl

7
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Shadow/ShadowAlgorithms.hlsl


float2 EvalShadow_SampleBias_Ortho( ShadowData sd, float3 normalWS )
{
float3 nrm = mul( (float3x3) sd.shadowToWorld, normalWS );
float3x3 view = float3x3( sd.rot0, sd.rot1, sd.rot2 );
float3 nrm = mul( view, normalWS );
nrm.x /= sd.proj[0];
nrm.y /= sd.proj[1];
nrm.z /= sd.proj[2];
nrm.x *= sd.scaleOffset.y;
nrm.y *= sd.scaleOffset.x;

2
ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/Shadow/ShadowSampling.hlsl


SampleShadow_ComputeSamples_Tent_5x5( shadowMapTexture_TexelSize, coord.xy, fetchesWeights, fetchesUV );
#if SHADOW_OPTIMIZE_REGISTER_USAGE == 1
#if SHADOW_OPTIMIZE_REGISTER_USAGE == 1 && SHADOW_USE_SAMPLE_BIASING == 0
// the loops are only there to prevent the compiler form coalescing all 9 texture fetches which increases register usage
int i;
[loop]

正在加载...
取消
保存