浏览代码

Annotate changes needed in Big Tile Shader

Just comments
/main
Robert Srinivasiah 7 年前
当前提交
a9ca9749
共有 1 个文件被更改,包括 21 次插入1 次删除
  1. 22
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-bigtile.compute

22
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-bigtile.compute


uniform float g_fNearPlane;
uniform float g_fFarPlane;
uniform uint g_isOrthographic;
// TODO: These aren't used, we should remove them
uniform int _EnvLightIndexShift;
uniform int _DecalIndexShift;

float3 GetViewPosFromLinDepth(float2 v2ScrPos, float fLinDepth)
{
// XRTODO: Stereo-ize this!
float4x4 g_mScrProjection = g_mScrProjectionArr[0];
bool isOrthographic = g_isOrthographic!=0;

float GetOnePixDiagWorldDistAtDepthOne()
{
// Stereo-ize this
float4x4 g_mScrProjection = g_mScrProjectionArr[0];
float fSx = g_mScrProjection[0].x;

[numthreads(NR_THREADS, 1, 1)]
void BigTileLightListGen(uint threadID : SV_GroupIndex, uint3 u3GroupID : SV_GroupID)
{
// XRTODO: Decode stereo eye index from u3GroupID.z
uint2 tileIDX = u3GroupID.xy;
uint t=threadID;

GroupMemoryBarrierWithGroupSync();
#endif
// Raw pixel coordinates of tile
// 'Normalized' coordinates of tile
// XRTODO: Depending on the eye, make sure you index into the right 'half' of
// g_vBoundsBuffer
// XRTODO: generate a 'real' index into the correct half of g_vBoundsBuffer
// This index should also correspond to the matching structs in _LightVolumeData and
// g_data, so if I just use this 'real' index, everything just might 'work'.
// If I need to look up the real light, I'll have to decode it, but this is fine for now.
const float2 vMi = g_vBoundsBuffer[l].xy;
const float2 vMa = g_vBoundsBuffer[l+g_iNrVisibLights].xy;

if(t==0) lightOffs = 0;
GroupMemoryBarrierWithGroupSync();
int i;
// XRTODO: Fix up check against g_iNrVisibLights to account for stereo
// XRTODO: Fix up the offset into the stereo-ized big tile list
// XRTODO: Do I want to encode the global index, or per-eye-relative index? The light list code later on
// is relative to per-eye, but I'll need the global index anyway. For consistency, it might be worth
// having the per-eye offset happen in the following compute job. Not sure yet.
for(i=t; i<(iNrCoarseLights+1); i+=NR_THREADS)
g_vLightList[MAX_NR_BIG_TILE_LIGHTS_PLUS_ONE*offs + i] = i==0 ? iNrCoarseLights : lightsListLDS[max(i-1, 0)];
}

{
const uint idxCoarse = lightsListLDS[l];
// XRTODO: This will fail for stereo right eye, because it can't be compared against the count for one
// eye.
bool canEnter = idxCoarse<(uint) g_iNrVisibLights;
if(canEnter) canEnter = _LightVolumeData[idxCoarse].lightVolume != LIGHTVOLUMETYPE_SPHERE; // don't bother doing edge tests for sphere lights since these have camera aligned bboxes.
UNITY_BRANCH if(canEnter)

正在加载...
取消
保存