From 5f37c6b3ca7b447ad8a4dc5fd84604342e32e59d Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 9 Nov 2009 21:59:13 -0500 Subject: Raytrace one row of pixels per thread. The theory is that if the next ray shot is closer to the previous ray, the k-D splay tree will work better because we're more likely to hit the same object. --- libdimension/raytrace.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'libdimension/raytrace.c') diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c index 74bfefc..3a266a2 100644 --- a/libdimension/raytrace.c +++ b/libdimension/raytrace.c @@ -227,12 +227,9 @@ dmnsn_raytrace_scene_impl(dmnsn_progress *progress, dmnsn_scene *scene, width = scene->canvas->x; height = scene->canvas->y; - /* Initialize `x' */ - x = width + index; - /* Iterate through each pixel */ - for (y = 0; y < height; ++y) { - for (x -= width; x < width; x += threads) { + for (y = index; y < height; y += threads) { + for (x = 0; x < width; ++x) { /* Set the pixel to the background color */ color = scene->background; -- cgit v1.2.3