Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1697)

Unified Diff: src/liboslexec/exec.cpp

Issue 186262: Add derivatives to I in shader globals (Closed) Base URL: http://openshadinglanguage.googlecode.com/svn/trunk/
Patch Set: Created 14 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/include/oslexec.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/liboslexec/exec.cpp
===================================================================
--- src/liboslexec/exec.cpp (revision 538)
+++ src/liboslexec/exec.cpp (working copy)
@@ -195,8 +195,16 @@ ShadingExecution::bind (ShadingContext *context, ShaderUse use,
sym.data (globals->P.ptr()); sym.step (globals->P.step());
}
} else if (sym.name() == Strings::I) {
- sym.has_derivs (false);
- sym.data (globals->I.ptr()); sym.step (globals->I.step());
+ if (globals->dIdx.ptr() && globals->dIdy.ptr()) {
+ sym.has_derivs (true);
+ void *addr = m_context->heap_allot (sym, true);
+ VaryingRef<Dual2<Vec3> > I ((Dual2<Vec3> *)addr, sym.step());
+ for (int i = 0; i < npoints(); ++i)
+ I[i].set (globals->I[i], globals->dIdx[i], globals->dIdy[i]);
+ } else {
+ sym.has_derivs (false);
+ sym.data (globals->I.ptr()); sym.step (globals->I.step());
+ }
} else if (sym.name() == Strings::N) {
sym.has_derivs (false);
sym.data (globals->N.ptr()); sym.step (globals->N.step());
« no previous file with comments | « src/include/oslexec.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b