Review: LLVM displacement bug fix (issue1894042)


larry...@...
 

Reviewers: ,

Description:
In the course of the merge, I broke displacement subtly when not using
LLVM. This patch copies out P and N correctly for the interpreter, as
we do for the LLVM path, so that the renderer on the other end can count
on it working the same whichever way is in effect.


Please review this at http://codereview.appspot.com/1894042/show

Affected files:
src/liboslexec/context.cpp


Index: src/liboslexec/context.cpp
===================================================================
--- src/liboslexec/context.cpp (revision 787)
+++ src/liboslexec/context.cpp (working copy)
@@ -321,6 +321,31 @@
// there some reason why that won't work?
}

+ // FIXME -- should only do this extra work for disp shaders,
+ // but at the moment we only use ShadUseSurface, even for disp!
+ // if (use == ShadUseDisplacement)
+ {
+ ShaderGlobals& sg = *(globals());
+ Symbol *Psym = symbol (use, Strings::P);
+ Symbol *Nsym = symbol (use, Strings::N);
+#if USE_RUNFLAGS
+ SHADE_LOOP_RUNFLAGS_BEGIN (runflags, 0, m_npoints)
+#elif USE_RUNINDICES
+ SHADE_LOOP_INDICES_BEGIN (indices, nindices)
+#elif USE_RUNSPANS
+ SHADE_LOOP_SPANS_BEGIN (indices, nindices)
+#endif
+ if (Psym) {
+ Vec3 *P = (Vec3 *)symbol_data(*Psym, i);
+ sg.P[i] = P[0];
+ sg.dPdx[i] = P[1];
+ sg.dPdy[i] = P[2];
+ }
+ if (Nsym)
+ sg.N[i] = * (Vec3 *)symbol_data(*Nsym, i);
+ SHADE_LOOP_END
+ }
+
shadingsys().m_layers_executed_uncond += uncond_evals;
shadingsys().m_layers_executed_lazy += m_lazy_evals;
shadingsys().m_layers_executed_never += nlayers - uncond_evals - m_lazy_evals;


cliffo...@...
 

On 2010/07/24 06:10:31, larrygritz wrote:


LGTM

http://codereview.appspot.com/1894042/show