public void Execute(int index) //row major { int3 tileIndex; TileLightIndex tileLightIndex = m_lightIndices[index]; tileLightIndex.Reset(); tileIndex.x = index % m_TileCount.x; tileIndex.y = index / m_TileCount.x; m_TileLightIndicesMinMax[index] = new uint2(1024, 0); var lightCount = 0; for (int i = 0; i < m_LightPos.Length; i++) { float3 lightPosition = m_LightPos[i]; var range = m_LightRange[i]; var tileIsLit = PlaneCircleCollision(m_ClusterInfo.ClusterXPlaneNormal[tileIndex.x], m_ClusterInfo.ClusterXPlanePoints[tileIndex.x], lightPosition, range) && // plane left PlaneCircleCollision(-m_ClusterInfo.ClusterXPlaneNormal[tileIndex.x + 1], m_ClusterInfo.ClusterXPlanePoints[tileIndex.x + 1], lightPosition, range) &&// plane right PlaneCircleCollision(m_ClusterInfo.ClusterYPlaneNormal[tileIndex.y], m_ClusterInfo.ClusterYPlanePoints[tileIndex.y], lightPosition, range) && // plane top PlaneCircleCollision(-m_ClusterInfo.ClusterYPlaneNormal[tileIndex.y + 1], m_ClusterInfo.ClusterYPlanePoints[tileIndex.y + 1], lightPosition, range); uint unsignedi = (uint)i; if (tileIsLit) { tileLightIndex.SetIndex(i); m_TileLightIndicesMinMax[index] = new uint2(min(unsignedi, m_TileLightIndicesMinMax[index].x), max(unsignedi, m_TileLightIndicesMinMax[index].y)); lightCount += 1; } } m_lightIndices[index] = tileLightIndex; m_TileLightCount[index] = lightCount; }
public void Execute(int jobId) { int2 tileId = new int2(jobId % m_TileCount.x, jobId / m_TileCount.x); int2 bigTileId = tileId / m_LastPhaseToCurTileScale; int2 bigTileCount = (m_TileCount + m_LastPhaseToCurTileScale - new int2(1, 1)) / m_LastPhaseToCurTileScale; int bigTileBufferID = bigTileId.x + bigTileId.y * bigTileCount.x; int lightCount = 0; m_ResTileLightIndicesMask[jobId].Clear(); BitField32 lightIndicies = new BitField32(); for (int lightIndex = 0; lightIndex < m_LightPos.Length; lightIndex++) { if (m_SrcTileLightIndicesMask[bigTileBufferID].IsSet(lightIndex)) { float3 lightPosition = m_LightPos[lightIndex]; var range = m_LightAffectingRange[lightIndex]; var tileIsLit = CullingUtls.PlaneSphereInclusion(m_ClusterInfo.ClusterXPlaneNormal[tileId.x], m_ClusterInfo.ClusterXPlanePoints[tileId.x], lightPosition, range) && // plane left CullingUtls.PlaneSphereInclusion(-m_ClusterInfo.ClusterXPlaneNormal[tileId.x + 1], m_ClusterInfo.ClusterXPlanePoints[tileId.x + 1], lightPosition, range) &&// plane right CullingUtls.PlaneSphereInclusion(m_ClusterInfo.ClusterYPlaneNormal[tileId.y], m_ClusterInfo.ClusterYPlanePoints[tileId.y], lightPosition, range) && // plane top CullingUtls.PlaneSphereInclusion(-m_ClusterInfo.ClusterYPlaneNormal[tileId.y + 1], m_ClusterInfo.ClusterYPlanePoints[tileId.y + 1], lightPosition, range); uint unsignedLightIndex = (uint)lightIndex; if (tileIsLit) { lightIndicies.SetBits(lightIndex, true); m_TileLightIndicesMinMax[jobId] = new uint2(min(unsignedLightIndex, m_TileLightIndicesMinMax[jobId].x), max(unsignedLightIndex, m_TileLightIndicesMinMax[jobId].y)); lightCount += 1; } } } m_ResTileLightIndicesMask[jobId] = lightIndicies; m_TileLightCount[jobId] = lightCount; }
public uint2x2(uint m00, uint m01, uint m10, uint m11) { this.c0 = new uint2(m00, m10); this.c1 = new uint2(m01, m11); }
public uint2x3(float v) { this.c0 = (uint2)v; this.c1 = (uint2)v; this.c2 = (uint2)v; }
public uint2x3(bool2x3 v) { this.c0 = math.select(new uint2(0u), new uint2(1u), v.c0); this.c1 = math.select(new uint2(0u), new uint2(1u), v.c1); this.c2 = math.select(new uint2(0u), new uint2(1u), v.c2); }
public uint2x3(bool v) { this.c0 = math.select(new uint2(0u), new uint2(1u), v); this.c1 = math.select(new uint2(0u), new uint2(1u), v); this.c2 = math.select(new uint2(0u), new uint2(1u), v); }
public uint2x3(uint2 c0, uint2 c1, uint2 c2) { this.c0 = c0; this.c1 = c1; this.c2 = c2; }
public uint2x2(float2x2 v) { this.c0 = (uint2)v.c0; this.c1 = (uint2)v.c1; }
public float2(uint2 v) { this.x = v.x; this.y = v.y; }
public static float2 float2(uint2 v) { return(new float2(v)); }
public static uint csum(uint2 a) { return(a.x + a.y); }
public static int2 int2(uint2 v) { return(new int2(v)); }
public int2(uint2 v) { this.x = (int)v.x; this.y = (int)v.y; }
public static uint2x4 uint2x4(uint2 c0, uint2 c1, uint2 c2, uint2 c3) { return(new uint2x4(c0, c1, c2, c3)); }
public uint3(uint2 xy, uint z) { this.x = xy.x; this.y = xy.y; this.z = z; }
public static uint2x2 uint2x2(uint2 c0, uint2 c1) { return(new uint2x2(c0, c1)); }
public uint2x2(int v) { this.c0 = (uint2)v; this.c1 = (uint2)v; }
public DebuggerProxy(uint2 v) { x = v.x; y = v.y; }
public uint2x3(double v) { this.c0 = (uint2)v; this.c1 = (uint2)v; this.c2 = (uint2)v; }
public static uint2 uint2(uint2 xy) { return(new uint2(xy)); }
public uint2x3(uint v) { this.c0 = v; this.c1 = v; this.c2 = v; }
public static uint hash(uint2 v) { return(csum(v * uint2(0x4473BBB1u, 0xCBA11D5Fu)) + 0x685835CFu); }
public static uint2x3 uint2x3(uint2 c0, uint2 c1, uint2 c2) { return(new uint2x3(c0, c1, c2)); }
public static uint2 hashwide(uint2 v) { return((v * uint2(0xC3D32AE1u, 0xB966942Fu)) + 0xFE9856B3u); }
public uint2x3(int2x3 v) { this.c0 = (uint2)v.c0; this.c1 = (uint2)v.c1; this.c2 = (uint2)v.c2; }
public static uint shuffle(uint2 a, uint2 b, ShuffleComponent x) { return(select_shuffle_component(a, b, x)); }
public uint2x2(uint2 c0, uint2 c1) { this.c0 = c0; this.c1 = c1; }
public static uint2 shuffle(uint2 a, uint2 b, ShuffleComponent x, ShuffleComponent y) { return(uint2( select_shuffle_component(a, b, x), select_shuffle_component(a, b, y))); }
public uint2x2(uint v) { this.c0 = v; this.c1 = v; }
public uint2x2(double2x2 v) { this.c0 = (uint2)v.c0; this.c1 = (uint2)v.c1; }