Fixed mtlViewer face-varying evaluation

Updated the mtlViewer to compute correct offsets
for face-varying param and index buffers when using
the Gregory Basis end cap approximation.
This commit is contained in:
David G Yu 2017-07-12 15:20:21 -07:00
parent b3508ed657
commit 1adfda5d79

View File

@ -355,8 +355,8 @@ using PerFrameBuffer = MTLRingBuffer<DataType, FRAME_LAG>;
auto& fvarPatch = pfvarav[i];
assert(sizeof(Osd::PatchParam) == sizeof(int) * 3);
[renderCommandEncoder setVertexBufferOffset:fvarPatch.primitiveIdBase * sizeof(int) * 3 atIndex:OSD_FVAR_PATCHPARAM_BUFFER_INDEX];
[renderCommandEncoder setVertexBufferOffset:fvarPatch.indexBase * sizeof(unsigned) atIndex:OSD_FVAR_INDICES_BUFFER_INDEX];
[renderCommandEncoder setVertexBufferOffset:(fvarPatch.primitiveIdBase+patch.primitiveIdBase) * sizeof(int) * 3 atIndex:OSD_FVAR_PATCHPARAM_BUFFER_INDEX];
[renderCommandEncoder setVertexBufferOffset:(fvarPatch.indexBase+(patch.primitiveIdBase*fvarPatch.desc.GetNumControlVertices())) * sizeof(unsigned) atIndex:OSD_FVAR_INDICES_BUFFER_INDEX];
}
[renderCommandEncoder setVertexBufferOffset:patch.indexBase * sizeof(unsigned) atIndex:INDICES_BUFFER_INDEX];