 			cur.w = n + path.samples;
 		}
 	}
-#endif
 
 	surf2Dwrite(
 		cur,
 		outSurface,
 		ix * sizeof(float4), iy,
 		cudaBoundaryModeTrap);
+#else
+	float4 cur = make_float4(path.contrib.x, path.contrib.y, path.contrib.z, 0);
+
+	if (path.samples > 0) {
+		cur /= path.samples;
+		cur.w = 1;
+
+		if (isInsideX && isInsideY) {
+			int px = (int)(prevPos.x * (width - 1) + 0.5f);
+			int py = (int)(prevPos.y * (height - 1) + 0.5f);
+
+			px = min(px, width - 1);
+			py = min(py, height - 1);
+
+			const auto pidx = getIdx(px, py, width);
+
+			const auto prevAov = prevAOVs[pidx];
+			const auto prevDepth = aten::clamp(prevAov.y, CAMERA_NEAR, CAMERA_FAR);
+
+			if (abs(centerDepth - prevDepth) <= 0.1f
+				&& aov.x == prevAov.x)
+			{
+				float4 prev;
+				surf2Dread(&prev, outSurface, px * sizeof(float4), py);
+
+				int n = (int)prev.w;
+
+				// TODO
+				//n = min(16, n);
+
+				cur = prev * n + cur;
+				cur /= (float)(n + 1);
+				cur.w = n + 1;
+			}
+		}
+	}
+	else {
+		if (isInsideX && isInsideY) {
+			int px = (int)(prevPos.x * (width - 1) + 0.5f);
+			int py = (int)(prevPos.y * (height - 1) + 0.5f);
+
+			px = min(px, width - 1);
+			py = min(py, height - 1);
+
+			const auto pidx = getIdx(px, py, width);
+
+			const auto prevAov = prevAOVs[pidx];
+			const auto prevDepth = aten::clamp(prevAov.y, CAMERA_NEAR, CAMERA_FAR);
+
+			if (abs(centerDepth - prevDepth) <= 0.1f
+				&& aov.x == prevAov.x)
+			{
+				float4 prev;
+				surf2Dread(&prev, outSurface, px * sizeof(float4), py);
+
+				cur = prev;
+			}
+		}
+	}
+
+	surf2Dwrite(
+		cur,
+		outSurface,
+		ix * sizeof(float4), iy,
+		cudaBoundaryModeTrap);
+#endif
+
+	
 }
 #endif
 
 __global__ void makePathMask(
+	idaten::PathTracing::Path* paths,
+	aten::ray* rays,
+	int width, int height,
+	int sample, int maxSamples,
+	int seed,
+	const aten::CameraParameter* __restrict__ camera,
 	const float4* __restrict__ aovs,
 	const float4* __restrict__ prevAOVs,
-	const aten::mat4* __restrict__ mtxs,
-	int* hitbools,
-	int width, int height)
+	const aten::mat4* __restrict__ mtxs)
 {
 	const auto ix = blockIdx.x * blockDim.x + threadIdx.x;
 	const auto iy = blockIdx.y * blockDim.y + threadIdx.y;

					cam.ptr(),
					m_hitidxTemporal.ptr(),
					hitcount);

				m_mtxs.reset();
			}

				texVtxPos);
		}
		else {
#if 0
			if (sample == 0) {
				PathTracingGeometryRendering::renderAOVs(
					width, height,
					sample, maxSamples,
					seed,
					texVtxPos);
			}
#else
			if (sample == 0) {
				PathTracingGeometryRendering::onGenPath(
					width, height,
					sample, maxSamples,
					seed,
					texVtxPos);
			}
			else
#endif

			{
				// 2t[ڈȍ~́Ae|vWFNV̌Ԃ݂̂ɔ΂.

				int cur = m_curAOV;
				int prev = 1 - cur;
