 	*prevPos = *prevPos * 0.5 + 0.5;	// [-1, 1] -> [0, 1]
 }
 
-#ifdef ENABLE_DEBUG
-// For debug.
 __global__ void temporalReprojection(
 	const idaten::PathTracing::Path* __restrict__ paths,
-	const float4* __restrict__ aovs,
-	const float4* __restrict__ prevAOVs,
-	const aten::mat4* __restrict__ mtxs,
-	cudaSurfaceObject_t outSurface,
-	int width, int height)
-{
-	const auto ix = blockIdx.x * blockDim.x + threadIdx.x;
-	const auto iy = blockIdx.y * blockDim.y + threadIdx.y;
-
-	if (ix >= width && iy >= height) {
-		return;
-	}
-
-	const auto idx = getIdx(ix, iy, width);
-
-	const auto path = paths[idx];
-
-	float4 cur = make_float4(path.contrib.x, path.contrib.y, path.contrib.z, 0) / path.samples;
-	cur.w = 1;
-
-	surf2Dwrite(
-		cur,
-		outSurface,
-		ix * sizeof(float4), iy,
-		cudaBoundaryModeTrap);
-}
-#else
-__global__ void temporalReprojection(
-	const idaten::PathTracing::Path* __restrict__ paths,
+	const aten::CameraParameter* __restrict__ camera,
 	const float4* __restrict__ aovs,
 	const float4* __restrict__ prevAOVs,
 	const aten::mat4* __restrict__ mtxs,

		cudaTextureObject_t texVtxPos,
		cudaTextureObject_t texVtxNml)
	{
#ifndef ENABLE_DEBUG
		PathTracing::onShade(
			outputSurf,
			hitcount,
			width, height,
			bounce, rrBounce,
			texVtxPos, texVtxNml);
#endif
	}

	void PathTracingTemporalReprojection::onGather(

		const auto pidx = getIdx(px, py, width);

		const auto prevAov = prevAOVs[pidx];
		const auto prevDepth = aten::clamp(prevAov.y, camera->znear, camera->zfar);

		// Õt[Ƃ̐[x͈͓ && }eAIDǂ.
		if (abs(1 - prevDepth / centerDepth) < 0.05
