Text archives Help
- From: boulos@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r1932 - in trunk: Engine/SampleGenerators Interface
- Date: Sun, 16 Dec 2007 15:24:04 -0700 (MST)
Author: boulos
Date: Sun Dec 16 15:24:03 2007
New Revision: 1932
Modified:
trunk/Engine/SampleGenerators/Stratified2D.cc
trunk/Interface/RayPacket.h
Log:
Engine/SampleGenerators/Stratified2D.cc
Interface/RayPacket.h
Updating RayPacket to have a sample_depth per ray instead of per
packet. This will allow for more flexible ray grouping at some point.
Modified: trunk/Engine/SampleGenerators/Stratified2D.cc
==============================================================================
--- trunk/Engine/SampleGenerators/Stratified2D.cc (original)
+++ trunk/Engine/SampleGenerators/Stratified2D.cc Sun Dec 16 15:24:03
2007
@@ -201,9 +201,9 @@
}
void Stratified2D::setupPacket(const RenderContext& context, RayPacket&
rays) {
- rays.sample_depth = 0;
bool constant_region = true;
for (int i = rays.begin(); i < rays.end(); i++) {
+ rays.data->sample_depth[i] = 0;
rays.data->region_id[i] = computeRegion(context, rays, i);
constant_region &= (rays.data->region_id[i] ==
rays.data->region_id[rays.begin()]);
}
@@ -212,8 +212,8 @@
}
void Stratified2D::setupChildPacket(const RenderContext& context, RayPacket&
parent, RayPacket& child) {
- child.sample_depth = parent.sample_depth;
for (int i = parent.begin(); i < parent.end(); i++) {
+ child.data->sample_depth[i] = parent.data->sample_depth[i];
child.data->sample_id[i] = parent.data->sample_id[i];
child.data->region_id[i] = parent.data->region_id[i];
}
@@ -223,7 +223,7 @@
}
void Stratified2D::setupChildRay(const RenderContext& context, RayPacket&
parent, RayPacket& child, int i, int j) {
- child.sample_depth = parent.sample_depth;
+ child.data->sample_depth[j] = parent.data->sample_depth[i];
child.data->sample_id[j] = parent.data->sample_id[i];
child.data->region_id[j] = parent.data->region_id[i];
if (parent.getFlag(RayPacket::ConstantSampleRegion)) {
@@ -232,23 +232,23 @@
}
void Stratified2D::nextSeeds(const RenderContext& context, Packet<float>&
results, RayPacket& rays) {
- if (rays.sample_depth < max_depth) {
- for (int i = rays.begin(); i < rays.end(); i++) {
- results.set(i,
thread_samples[context.proc][rays.data->region_id[i]][spp * rays.sample_depth
+ rays.data->sample_id[i]]);
+ for (int i = rays.begin(); i < rays.end(); i++) {
+ if (rays.data->sample_depth[i] < max_depth) {
+ results.set(i,
thread_samples[context.proc][rays.data->region_id[i]][spp *
rays.data->sample_depth[i] + rays.data->sample_id[i]]);
+ } else {
+ results.set(i, context.rng->nextFloat());
}
- } else {
- context.rng->nextPacket(results, rays);
+ rays.data->sample_depth[i]++;
}
- rays.sample_depth++;
}
void Stratified2D::nextSeeds(const RenderContext& context, Packet<double>&
results, RayPacket& rays) {
- if (rays.sample_depth < max_depth) {
- for (int i = rays.begin(); i < rays.end(); i++) {
- results.set(i,
static_cast<double>(thread_samples[context.proc][rays.data->region_id[i]][spp
* rays.sample_depth + rays.data->sample_id[i]]));
+ for (int i = rays.begin(); i < rays.end(); i++) {
+ if (rays.data->sample_depth[i] < max_depth) {
+ results.set(i,
static_cast<double>(thread_samples[context.proc][rays.data->region_id[i]][spp
* rays.data->sample_depth[i] + rays.data->sample_id[i]]));
+ } else {
+ results.set(i, context.rng->nextDouble());
}
- } else {
- context.rng->nextPacket(results, rays);
+ rays.data->sample_depth[i]++;
}
- rays.sample_depth++;
}
Modified: trunk/Interface/RayPacket.h
==============================================================================
--- trunk/Interface/RayPacket.h (original)
+++ trunk/Interface/RayPacket.h Sun Dec 16 15:24:03 2007
@@ -108,8 +108,9 @@
// Int-based arrays
MANTA_ALIGN(16) int whichEye[MaxSize];
- MANTA_ALIGN(16) int sample_id[MaxSize];
- MANTA_ALIGN(16) int region_id[MaxSize];
+ MANTA_ALIGN(16) unsigned int sample_depth[MaxSize];
+ MANTA_ALIGN(16) unsigned int sample_id[MaxSize];
+ MANTA_ALIGN(16) unsigned int region_id[MaxSize];
MANTA_ALIGN(16) int signs[3][MaxSize]; // 1=negative, 0=zero, positive
// Scratchpad
@@ -175,7 +176,7 @@
// Create a subset of another raypacket
RayPacket(RayPacket& parent, int rayBegin, int rayEnd)
: data(parent.data), rayBegin(rayBegin), rayEnd(rayEnd),
- depth(parent.depth), sample_depth(parent.sample_depth),
+ depth(parent.depth),
flags(parent.flags)
{
shape = parent.shape;
@@ -221,11 +222,11 @@
}
// Sample depth (number of samples taken so far)
- unsigned int getSampleDepth() const {
- return sample_depth;
+ unsigned int getSampleDepth(unsigned int which) const {
+ return data->sample_depth[which];
}
- void setSampleDepth(unsigned int new_depth) {
- sample_depth = new_depth;
+ void setSampleDepth(unsigned int which, unsigned int new_depth) {
+ data->sample_depth[which] = new_depth;
}
// Raypacket iteration
@@ -870,7 +871,6 @@
int rayBegin;
int rayEnd;
int depth;
- unsigned int sample_depth;
int flags;
};
- [Manta] r1932 - in trunk: Engine/SampleGenerators Interface, boulos, 12/16/2007
Archive powered by MHonArc 2.6.16.