浏览代码

Remove EvaluateBSDF_Area()

BEFORE
; Disassembly for GCN (Pitcairn)
; -------- Statistics ---------------------
; SGPRs: 100 out of 104 used
; VGPRs: 156 out of 256 used
; LDS: 0 out of 32768 bytes used
; 0 bytes scratch space used
; Instructions: 2652 ALU, 178 Control Flow, 78 TFETCH

AFTER
; Disassembly for GCN (Pitcairn)
; -------- Statistics ---------------------
; SGPRs: 100 out of 104 used
; VGPRs: 156 out of 256 used
; LDS: 0 out of 32768 bytes used
; 0 bytes scratch space used
; Instructions: 2651 ALU, 160 Control Flow, 82 TFETCH

There are 2 extra texture fetches (at the end of one of the area light loops) rather than 4 - the statistics are being pessimistic. These are repeated texture fetches and are a 100% cache hit.
/main
Evgenii Golubev 7 年前
当前提交
93a7de37
共有 2 个文件被更改,包括 19 次插入27 次删除
  1. 32
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl
  2. 14
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

32
ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl


i = 0;
if (areaLightCount > 0)
{
uint areaIndex = FetchIndex(areaLightStart, 0);
uint lightType = _LightDatas[areaIndex].lightType;
uint lastIndex = areaLightCount - 1;
LightData lightData = _LightDatas[FetchIndex(areaLightStart, 0)];
while (i < areaLightCount && lightType == GPULIGHTTYPE_LINE)
while (i <= lastIndex && lightData.lightType == GPULIGHTTYPE_LINE)
DirectLighting lighting = EvaluateBSDF_Area(context, V, posInput, preLightData, _LightDatas[areaIndex], bsdfData, bakeLightingData, GPULIGHTTYPE_LINE);
DirectLighting lighting = EvaluateBSDF_Line(context, V, posInput, preLightData, lightData, bsdfData, bakeLightingData);
i++;
areaIndex = i < areaLightCount ? FetchIndex(areaLightStart, i) : 0;
lightType = i < areaLightCount ? _LightDatas[areaIndex].lightType : 0xFF;
lightData = _LightDatas[FetchIndex(areaLightStart, min(++i, lastIndex))];
while (i < areaLightCount && lightType == GPULIGHTTYPE_RECTANGLE)
while (i <= lastIndex && lightData.lightType == GPULIGHTTYPE_RECTANGLE)
DirectLighting lighting = EvaluateBSDF_Area(context, V, posInput, preLightData, _LightDatas[areaIndex], bsdfData, bakeLightingData, GPULIGHTTYPE_RECTANGLE);
DirectLighting lighting = EvaluateBSDF_Rect(context, V, posInput, preLightData, lightData, bsdfData, bakeLightingData);
i++;
areaIndex = i < areaLightCount ? FetchIndex(areaLightStart, i) : 0;
lightType = i < areaLightCount ? _LightDatas[areaIndex].lightType : 0xFF;
lightData = _LightDatas[FetchIndex(areaLightStart, min(++i, lastIndex))];
}
}

{
DirectLighting lighting = EvaluateBSDF_Area(context, V, posInput, preLightData, _LightDatas[i], bsdfData, bakeLightingData, _LightDatas[i].lightType);
DirectLighting lighting;
if (_LightDatas[i].lightType == GPULIGHTTYPE_LINE)
{
lighting = EvaluateBSDF_Line(context, V, posInput, preLightData, _LightDatas[i], bsdfData, bakeLightingData);
}
else // GPULIGHTTYPE_RECTANGLE
{
lighting = EvaluateBSDF_Rect(context, V, posInput, preLightData, _LightDatas[i], bsdfData, bakeLightingData);
}
AccumulateDirectLighting(lighting, aggregateLighting);
}

14
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


return lighting;
}
DirectLighting EvaluateBSDF_Area( LightLoopContext lightLoopContext,
float3 V, PositionInputs posInput,
PreLightData preLightData, LightData lightData, BSDFData bsdfData, BakeLightingData bakeLightingData, int GPULightType)
{
if (GPULightType == GPULIGHTTYPE_LINE)
{
return EvaluateBSDF_Line(lightLoopContext, V, posInput, preLightData, lightData, bsdfData, bakeLightingData);
}
else
{
return EvaluateBSDF_Rect(lightLoopContext, V, posInput, preLightData, lightData, bsdfData, bakeLightingData);
}
}
//-----------------------------------------------------------------------------
// EvaluateBSDF_SSLighting for screen space lighting
// ----------------------------------------------------------------------------

正在加载...
取消
保存