浏览代码

Help the compiler save VGPR

SubsurfaceScattering.compute:

Before:
; -------- Statistics ---------------------
; SGPRs: 62 out of 104 used
; VGPRs: 42 out of 256 used
; LDS: 6416 out of 32768 bytes used
; 0 bytes scratch space used
; Instructions: 1280 ALU, 264 Control Flow, 75 TFETCH

After:
; -------- Statistics ---------------------
; SGPRs: 62 out of 104 used
; VGPRs: 41 out of 256 used
; LDS: 6416 out of 32768 bytes used
; 0 bytes scratch space used
; Instructions: 1276 ALU, 264 Control Flow, 75 TFETCH
/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
d1dca323
共有 3 个文件被更改,包括 15 次插入0 次删除
  1. 1
      ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl
  2. 7
      ScriptableRenderPipeline/Core/ShaderLibrary/CommonMaterial.hlsl
  3. 7
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.compute

1
ScriptableRenderPipeline/Core/ShaderLibrary/Common.hlsl


#define HALF_PI 1.57079632679
#define INV_HALF_PI 0.636619772367
#define INFINITY asfloat(0x7F800000)
#define LOG2_E 1.44269504089
#define FLT_EPSILON 1.192092896e-07 // Smallest positive number, such that 1.0 + FLT_EPSILON != 1.0
#define FLT_MIN 1.175494351e-38 // Minimum representable positive floating-point number

7
ScriptableRenderPipeline/Core/ShaderLibrary/CommonMaterial.hlsl


// In theory, we should modify the thickness by the inverse of the radius scale of the profile.
// thickness /= radiusScale;
#if 0
#else
// Help the compiler.
float k = (-1.0 / 3.0) * LOG2_E;
float3 p = (k * thickness) * S;
float3 expOneThird = exp2(p);
#endif
// Premultiply & optimize: T = (1/4 * A) * (e^(-t * S) + 3 * e^(-1/3 * t * S))
return volumeAlbedo * (expOneThird * expOneThird * expOneThird + 3 * expOneThird);

7
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.compute


// We can drop the constant (s / (8 * Pi)) due to the subsequent weight renormalization.
float3 DisneyProfilePolar(float r, float3 S)
{
#if 0
#else
// Help the compiler.
float k = (-1.0 / 3.0) * LOG2_E;
float3 p = (k * r) * S;
float3 expOneThird = exp2(p);
#endif
return expOneThird + expOneThird * expOneThird * expOneThird;
}

正在加载...
取消
保存