|
|
|
|
|
|
#ifdef USE_TWO_PASS_TILED_LIGHTING |
|
|
|
const uint log2BigTileToClustTileRatio = firstbithigh(64) - log2TileSize; |
|
|
|
|
|
|
|
// XRTODO: Properly stereo-ize access to g_vBigTileLightList |
|
|
|
// XRTODO - DONE: Properly stereo-ize access to g_vBigTileLightList |
|
|
|
int NrBigTilesX = (nrTilesX+((1<<log2BigTileToClustTileRatio)-1))>>log2BigTileToClustTileRatio; |
|
|
|
const int bigTileIdx = (tileIDX.y>>log2BigTileToClustTileRatio)*NrBigTilesX + (tileIDX.x>>log2BigTileToClustTileRatio); // map the idx to 64x64 tiles |
|
|
|
int nrBigTileLights = g_vBigTileLightList[MAX_NR_BIG_TILE_LIGHTS_PLUS_ONE*bigTileIdx+0]; |
|
|
|
int NrBigTilesX = (nrTilesX + ((1<<log2BigTileToClustTileRatio)-1)) >> log2BigTileToClustTileRatio; |
|
|
|
int NrBigTilesY = (nrTilesY + ((1<<log2BigTileToClustTileRatio)-1)) >> log2BigTileToClustTileRatio; |
|
|
|
const int bigTileBase = eyeIndex * NrBigTilesX * NrBigTilesY; |
|
|
|
const int bigTileIdx = bigTileBase + ((tileIDX.y>>log2BigTileToClustTileRatio)*NrBigTilesX) + (tileIDX.x>>log2BigTileToClustTileRatio); // map the idx to 64x64 tiles |
|
|
|
|
|
|
|
int nrBigTileLights = g_vBigTileLightList[MAX_NR_BIG_TILE_LIGHTS_PLUS_ONE*bigTileIdx+0]; |
|
|
|
for(int l0=(int) t; l0<(int) nrBigTileLights; l0 += NR_THREADS) |
|
|
|
{ |
|
|
|
int l = g_vBigTileLightList[MAX_NR_BIG_TILE_LIGHTS_PLUS_ONE*bigTileIdx+l0+1]; |
|
|
|
|
|
|
|
|
|
|
int iNrCoarseLights = min(lightOffs,MAX_NR_COARSE_ENTRIES); |
|
|
|
|
|
|
|
// XRTODO: Stereo-ize by passing in eyeIndex |
|
|
|
// XRTODO - DONE: Stereo-ize by passing in eyeIndex |
|
|
|
#ifdef PERFORM_SPHERICAL_INTERSECTION_TESTS |
|
|
|
iNrCoarseLights = SphericalIntersectionTests( t, iNrCoarseLights, float2(min(viTilLL.xy+uint2(TILE_SIZE_CLUSTERED/2,TILE_SIZE_CLUSTERED/2), uint2(g_screenSize.x-1, g_screenSize.y-1))), eyeIndex ); |
|
|
|
#endif |
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// XRTODO: Stereo-ize by passing in eyeIndex |
|
|
|
// XRTODO - DONE: Stereo-ize by passing in eyeIndex |
|
|
|
#ifdef EXACT_EDGE_TESTS |
|
|
|
iNrCoarseLights = CullByExactEdgeTests(t, iNrCoarseLights, viTilLL.xy, viTilUR.xy, fTileFarPlane, eyeIndex); |
|
|
|
#endif |
|
|
|
|
|
|
int iSwizzle = e0&0x3; |
|
|
|
|
|
|
|
int i=iSwizzle + (2*(iSection&0x2)); // offset by 4 at section 2 |
|
|
|
// XRTODO: Pass in eyeIndex |
|
|
|
// XRTODO - DONE: Pass in eyeIndex |
|
|
|
vP0 = GetTileVertex(uint2(viTilLL.x, viTilUR.y), uint2(viTilUR.x, viTilLL.y), i, fTileFarPlane, eyeIndex); |
|
|
|
|
|
|
|
#if USE_LEFT_HAND_CAMERA_SPACE |
|
|
|
|
|
|
vE0 = iSection == 0 ? edgeSectionZero : (((iSwizzle & 0x2) == 0 ? 1.0f : (-1.0f)) * ((int)(iSwizzle & 0x1) == (iSwizzle >> 1) ? float3(1, 0, 0) : float3(0, 1, 0))); |
|
|
|
} |
|
|
|
|
|
|
|
// XRTODO: Stereo-ize with eyeIndex, used for indexing _LightVolumeData and g_data, |
|
|
|
// XRTODO - DONE: Stereo-ize with eyeIndex, used for indexing _LightVolumeData and g_data, |
|
|
|
// and with GetFrustEdge and GetTileVertex functions |
|
|
|
int CullByExactEdgeTests(uint threadID, int iNrCoarseLights, uint2 viTilLL, uint2 viTilUR, float fTileFarPlane, uint eyeIndex) |
|
|
|
{ |
|
|
|