Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding some controls to override default number of ray payload registers #197

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions owl/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,20 @@ namespace owl {
}
}

void Context::setNumPayloadValues(size_t numPayloadValues)
{
if (numPayloadValues > 32)
OWL_RAISE
("a payload count > 32 isnt' currently supported in OWL; "
"please see comments on owlSetNumPayloadValues() (owl/owl_host.h)");

for (auto device : getDevices()) {
assert("check programs have not been built"
&& device->allActivePrograms.empty());
}
this->numPayloadValues = (int)numPayloadValues;
}

void Context::enableMotionBlur()
{
motionBlurEnabled = true;
Expand Down
6 changes: 6 additions & 0 deletions owl/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ namespace owl {
to ClosestHit programs. Default 2. Has no effect once programs are built.*/
void setNumAttributeValues(size_t numAttributeValues);

/* Set number of payload registers for passing data between raygen and raytracing
programs. Default 2. Has no effect once programs are built.*/
void setNumPayloadValues(size_t numPayloadValues);

// ------------------------------------------------------------------
// internal mechanichs/plumbling that do the actual work
Expand Down Expand Up @@ -322,6 +325,9 @@ namespace owl {
/* Number of attributes for writing data between Intersection and ClosestHit */
int numAttributeValues = 2;

/* Number of payload registers for writing data between raygen and raytracing programs */
int numPayloadValues = 2;

/*! a set of dummy (ie, empty) launch params. allows us for always
using the same launch code, *with* launch params, even if th
user didn't specify any during launch */
Expand Down
2 changes: 1 addition & 1 deletion owl/DeviceContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ namespace owl {
break;
}
pipelineCompileOptions.usesMotionBlur = parent->motionBlurEnabled;
pipelineCompileOptions.numPayloadValues = 2;
pipelineCompileOptions.numPayloadValues = parent->numPayloadValues;
pipelineCompileOptions.numAttributeValues = parent->numAttributeValues;
pipelineCompileOptions.exceptionFlags = OPTIX_EXCEPTION_FLAG_NONE;
pipelineCompileOptions.pipelineLaunchParamsVariableName = "optixLaunchParams";
Expand Down
7 changes: 7 additions & 0 deletions owl/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ owlContextSetNumAttributeValues(OWLContext _context, size_t numAttributeValues)
checkGet(_context)->setNumAttributeValues(numAttributeValues);
}

OWL_API void
owlContextSetNumPayloadValues(OWLContext _context, size_t numPayloadValues)
{
LOG_API_CALL();
checkGet(_context)->setNumPayloadValues(numPayloadValues);
}

OWL_API void
owlContextSetBoundLaunchParamValues(OWLContext _context,
const OWLBoundValueDecl *_boundValues,
Expand Down
6 changes: 6 additions & 0 deletions owl/include/owl/owl_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ OWL_API void
owlContextSetNumAttributeValues(OWLContext context,
size_t numAttributeValues);

/* Set number of payload registers for passing data between raygen programs and
closesthit / anyhit / miss programs. Default 2. Has no effect once programs are built.*/
OWL_API void
owlContextSetNumPayloadValues(OWLContext context,
size_t numPayloadValues);

/*! tells OptiX to specialize the values of certain launch parameters
when compiling modules, and ignore their values at launch.
See section 6.3.1 of the OptiX 7.2 programming guide.
Expand Down