Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::BlockedRenderProcess Class Reference

Parallel process for rendering with sampling-based integrators. More...

#include <mitsuba/render/renderproc.h>

+ Inheritance diagram for mitsuba::BlockedRenderProcess:

Public Member Functions

 BlockedRenderProcess (const RenderJob *parent, RenderQueue *queue, int blockSize)
 
void setPixelFormat (Bitmap::EPixelFormat pixelFormat, int channelCount=-1, bool warnInvalid=false)
 Set the pixel format associated with the rendering process. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
Implementation of the ParallelProcess interface
ref< WorkProcessorcreateWorkProcessor () const
 Create an instance of the algorithm responsible for executing the work units of this parallel process. More...
 
void processResult (const WorkResult *result, bool cancelled)
 Called whenever a work unit has been completed. More...
 
void bindResource (const std::string &name, int id)
 Bind a resource to this parallel process. More...
 
EStatus generateWork (WorkUnit *unit, int worker)
 Generate a piece of work. More...
 
Implementation of the ParallelProcess interface
- Public Member Functions inherited from mitsuba::ParallelProcess
virtual void handleCancellation ()
 Called when the parallel process is canceled by Scheduler::cancel(). More...
 
EStatus getReturnStatus () const
 Query the return status of a process after its execution has finished. More...
 
virtual bool isLocal () const
 Is this process strictly local? More...
 
ELogLevel getLogLevel () const
 Return the log level for events associated with this process. More...
 
const ResourceBindingsgetResourceBindings () const
 Return a list of all bound resources. More...
 
virtual std::vector< std::string > getRequiredPlugins ()
 Return a list of plugins required by this parallel process. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::BlockedImageProcess
static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::ParallelProcess
static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

virtual ~BlockedRenderProcess ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from mitsuba::BlockedImageProcess
void init (const Point2i &offset, const Vector2i &size, uint32_t blockSize)
 
 BlockedImageProcess ()
 Protected constructor. More...
 
virtual ~BlockedImageProcess ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from mitsuba::ParallelProcess
 ParallelProcess ()
 Protected constructor. More...
 
virtual ~ParallelProcess ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

ref< RenderQueuem_queue
 
ref< Scenem_scene
 
ref< Filmm_film
 
const RenderJobm_parent
 
int m_resultCount
 
ref< Mutexm_resultMutex
 
ProgressReporterm_progress
 
int m_borderSize
 
Bitmap::EPixelFormat m_pixelFormat
 
int m_channelCount
 
bool m_warnInvalid
 
- Protected Attributes inherited from mitsuba::BlockedImageProcess
Point2i m_offset
 
Vector2i m_size
 
Vector2i m_numBlocks
 
Point2i m_curBlock
 
int m_direction
 
int m_numSteps
 
int m_stepsLeft
 
int m_numBlocksTotal
 
int m_numBlocksGenerated
 
int m_blockSize
 
- Protected Attributes inherited from mitsuba::ParallelProcess
ResourceBindings m_bindings
 
EStatus m_returnStatus
 
ELogLevel m_logLevel
 

Additional Inherited Members

- Public Types inherited from mitsuba::ParallelProcess
enum  EStatus { EUnknown, EPause, ESuccess, EFailure }
 Return codes used by generateWork() and getReturnStatus() More...
 
typedef std::map< std::string,
int > 
ResourceBindings
 Binding from local resource names to global resource IDs. More...
 
- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 
- Protected Types inherited from mitsuba::BlockedImageProcess
enum  EDirection { ERight = 0, EDown, ELeft, EUp }
 

Detailed Description

Parallel process for rendering with sampling-based integrators.

Splits an image into independent rectangular pixel regions, which are then rendered in parallel.

See Also
SamplingIntegrator

Constructor & Destructor Documentation

mitsuba::BlockedRenderProcess::BlockedRenderProcess ( const RenderJob parent,
RenderQueue queue,
int  blockSize 
)
virtual mitsuba::BlockedRenderProcess::~BlockedRenderProcess ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

void mitsuba::BlockedRenderProcess::bindResource ( const std::string &  name,
int  id 
)
virtual

Bind a resource to this parallel process.

Takes a resource ID as given by the scheduler and associates it with a name. This name can later be used by the work processor to access the resource data.

Parameters
nameProcess-specific name of the resource
idResource ID as returned by Scheduler::registerResource()
See Also
WorkProcessor::getResource

Reimplemented from mitsuba::ParallelProcess.

ref<WorkProcessor> mitsuba::BlockedRenderProcess::createWorkProcessor ( ) const
virtual

Create an instance of the algorithm responsible for executing the work units of this parallel process.

Implements mitsuba::ParallelProcess.

EStatus mitsuba::BlockedRenderProcess::generateWork ( WorkUnit unit,
int  worker 
)
virtual

Generate a piece of work.

Takes a pre-allocated WorkUnit instance of the appropriate sub-type and size (as specified by ParallelProcess::getWorkUnitName()) and fills it with the appropriate content. Returns ESuccess on success and EFailure or EPause when no more work is left – in that case, the work unit will be ignored and the process completed (EFailure) or temporarily paused (EPause). When EPause was used, resubmission via Scheduler::schedule() will be required once more work is available. In some cases, it is useful to distribute 'nearby' pieces of work to the same processor – the worker parameter can be used to implement this. This function should run as quickly as possible, since it will be executed while the scheduler mutex is held. A thrown exception will lead to the termination of the parallel process.

Parameters
unitWork unit data structure to be filled
workerID of the worker executing this function

Reimplemented from mitsuba::BlockedImageProcess.

virtual const Class* mitsuba::BlockedRenderProcess::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from mitsuba::BlockedImageProcess.

void mitsuba::BlockedRenderProcess::processResult ( const WorkResult result,
bool  cancelled 
)
virtual

Called whenever a work unit has been completed.

Note that this function may concurrently be executed by multiple threads. Also, processing of work results will generally be out of order with respect to the creation in generateWork().

When a work unit is only partially completed due to a call to Scheduler::cancel(), the second parameter is set to true. A thrown exception will lead to the termination of the parallel process.

Parameters
resultWork result to be processed
cancelledWas the associated work unit not fully completed

Implements mitsuba::ParallelProcess.

void mitsuba::BlockedRenderProcess::setPixelFormat ( Bitmap::EPixelFormat  pixelFormat,
int  channelCount = -1,
bool  warnInvalid = false 
)

Set the pixel format associated with the rendering process.

By default, this class works with image blocks that store a set of spectral samples along with an alpha value and an accumulated reconstruction filter weight for each pixel. This method can be used to change this, which is useful when additional information should be returned (e.g. normals or depth values).

Parameters
pixelFormatDesired pixel format (e.g. Bitmap::EMultiChannel)
channelCountNumber of image channels. Only needs to be specified when setting pixelFormat=Bitmap::EMultiChannel
warnInvalidBy default, the rendering process issues a warning when writing negative, infinite or NaN-valued pixels. This flag can be used to turn off the warnings.

Member Data Documentation

int mitsuba::BlockedRenderProcess::m_borderSize
protected
int mitsuba::BlockedRenderProcess::m_channelCount
protected
ref<Film> mitsuba::BlockedRenderProcess::m_film
protected
const RenderJob* mitsuba::BlockedRenderProcess::m_parent
protected
Bitmap::EPixelFormat mitsuba::BlockedRenderProcess::m_pixelFormat
protected
ProgressReporter* mitsuba::BlockedRenderProcess::m_progress
protected
ref<RenderQueue> mitsuba::BlockedRenderProcess::m_queue
protected
int mitsuba::BlockedRenderProcess::m_resultCount
protected
ref<Mutex> mitsuba::BlockedRenderProcess::m_resultMutex
protected
ref<Scene> mitsuba::BlockedRenderProcess::m_scene
protected
Class* mitsuba::BlockedRenderProcess::m_theClass
static
bool mitsuba::BlockedRenderProcess::m_warnInvalid
protected

The documentation for this class was generated from the following file: