POV-Ray : Newsgroups : povray.programming : Frontend and backend communication : Re: Frontend and backend communication Server Time
20 Apr 2024 08:47:21 EDT (-0400)
  Re: Frontend and backend communication  
From: Thorsten Froehlich
Date: 1 Jul 2011 13:30:34
Message: <4e0e043a@news.povray.org>
On 01.07.11 19:18, Thorsten Froehlich wrote:
> On 01.07.11 12:24, Jack Burton wrote:
>>> I am not sure why you would want to globally share mutexes, and I am not
>>> sure what lists you are referring to specifically, so i cannot really give
>>> you an answer here.
>>
>> I'm referring to the lists (e.g. blockBusyList) and mutexes (e.g.
>> nextBlockMutex) in view.h.
>>
>> The idea of sharing the lists and mutexes is to record which blocks which
>> have
>> been rendered and which blocks are being rendered, so all of the slaves in
>> the
>> distributed setup can render the correct block and avoid duplication of
>> blocks
>> and avoid unnecessary communication. The mutex (as I understand it) is to
>> stop
>> the local threads accessing the lists at the same time, so this would be
>> needed
>> for a distributed scenario, too; basically the lists need to be thread-safe
>> across multiple slaves.
>
> Well, it depends on your radiosity needs, but as you cannot distribute the
> radiosity data anyway, you are restricted to recomputed radiosity samples.
> Thus, you can simply remove those lists and the associated code, they were
> only added to support radiosity sampling at render time in 3.7. Otherwise,
> they serve no purpose.

This is the code really needed. Everything else is non-essential for your 
use-case (sorry for the broken formatting):

bool ViewData::GetNextRectangle(POVRect& rect, unsigned int& serial)
{
	Mutex::ScopedLock lock(nextBlockMutex);

	while(true)
	{
		if(nextBlock >= (blockWidth * blockHeight))
			return false;

		unsigned int blockX = nextBlock % blockWidth;
		unsigned int blockY = nextBlock / blockWidth;

		rect.left = renderArea.left + (blockX * blockSize);
		rect.right = min(renderArea.left + ((blockX + 1) * blockSize) - 1, 
renderArea.right);
		rect.top = renderArea.top + (blockY * blockSize);
		rect.bottom = min(renderArea.top + ((blockY + 1) * blockSize) - 1, 
renderArea.bottom);

		nextBlock++;
	}

	pixelsPending += rect.GetArea();

	serial = nextBlock;
	nextBlock++;

	return true;
}

As for the other code that was added, I am sorry, its not mine, and all I 
know it that it has several issues I will need to fix post-3.7.

As for your question about parsing, indeed you will need to do that in a 
distributed manner.

	Thorsten


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.