 =>
 uniform RTCGeometry geom = rtcNewSubdivisionMesh(device,flags,numPrimitives,numEdges,numVertices,numEdgeCreases,numVertexCreases,numHoles,numTimeSteps);
 @@{
-rtcMapBuffer(EXPR geom,RTC_FACE_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_FACE_BUFFER,sizeof(uniform int),numPrimitives)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_FACE_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_FACE_BUFFER,ptr,offset,stride,numPrimitives)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,RTC_INDEX_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_INDEX_BUFFER,sizeof(uniform int),numEdges)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_INDEX_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_INDEX_BUFFER,ptr,offset,stride,numEdges)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,REGEXPR(vertex_buffer,RTC_VERTEX_BUFFER.*))
-=>
-rtcNewBuffer(geom,vertex_buffer,4*sizeof(uniform float),numVertices)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,REGEXPR(vertex_buffer,RTC_VERTEX_BUFFER.*),EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,vertex_buffer,ptr,offset,stride,numVertices)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,RTC_LEVEL_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_LEVEL_BUFFER,sizeof(uniform int),numEdges)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_LEVEL_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_LEVEL_BUFFER,ptr,offset,stride,numEdges)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,RTC_EDGE_CREASE_INDEX_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_EDGE_CREASE_INDEX_BUFFER,2*sizeof(uniform int),numEdgeCreases)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_EDGE_CREASE_INDEX_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_EDGE_CREASE_INDEX_BUFFER,ptr,offset,stride,numEdgeCreases)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,RTC_EDGE_CREASE_WEIGHT_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_EDGE_CREASE_WEIGHT_BUFFER,sizeof(uniform float),numEdgeCreases)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_EDGE_CREASE_WEIGHT_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_EDGE_CREASE_WEIGHT_BUFFER,ptr,offset,stride,numEdgeCreases)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,RTC_VERTEX_CREASE_INDEX_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_VERTEX_CREASE_INDEX_BUFFER,sizeof(uniform int),numVertexCreases)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_VERTEX_CREASE_INDEX_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_VERTEX_CREASE_INDEX_BUFFER,ptr,offset,stride,numVertexCreases)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,RTC_VERTEX_CREASE_WEIGHT_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_VERTEX_CREASE_WEIGHT_BUFFER,sizeof(uniform float),numVertexCreases)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_VERTEX_CREASE_WEIGHT_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_VERTEX_CREASE_WEIGHT_BUFFER,ptr,offset,stride,numVertexCreases)
-}@@
-@@{
-rtcMapBuffer(EXPR geom,RTC_HOLE_BUFFER)
-=>
-rtcNewBuffer(geom,RTC_HOLE_BUFFER,sizeof(uniform int),numPrimitives)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,RTC_HOLE_BUFFER,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,RTC_HOLE_BUFFER,ptr,offset,stride,numPrimitives)
-}@@
-@@{
-rtcSetBuffer(EXPR geom,REGEXPR(user_vertex_buffer,RTC_USER_VERTEX_BUFFER.*),EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,user_vertex_buffer,ptr,offset,stride,numVertices) /* FIXME: verify size of this buffer! */
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_FACE,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_FACE,slot,sizeof(uniform int),numPrimitives)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_FACE,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_FACE,slot,ptr,offset,stride,numPrimitives)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,sizeof(uniform int),numEdges)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,ptr,offset,stride,numEdges)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_VERTEX,slot,4*sizeof(uniform float),numVertices)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_VERTEX,slot,ptr,offset,stride,numVertices)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_LEVEL,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_LEVEL,slot,sizeof(uniform int),numEdges)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_LEVEL,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_LEVEL,slot,ptr,offset,stride,numEdges)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,slot,2*sizeof(uniform int),numEdgeCreases)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,slot,ptr,offset,stride,numEdgeCreases)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,slot,sizeof(uniform float),numEdgeCreases)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,slot,ptr,offset,stride,numEdgeCreases)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,slot,sizeof(uniform int),numVertexCreases)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,slot,ptr,offset,stride,numVertexCreases)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,slot,sizeof(uniform float),numVertexCreases)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,slot,ptr,offset,stride,numVertexCreases)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_HOLE,EXPR slot)
+=>
+rtcNewBuffer(geom,RTC_BUFFER_TYPE_HOLE,slot,sizeof(uniform int),numPrimitives)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_HOLE,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_HOLE,slot,ptr,offset,stride,numPrimitives)
+}@@
+@@{
+rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetBuffer(geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,slot,ptr,offset,stride,numVertices) /* FIXME: verify size of this buffer! */
 }@@
 }@@
 

}@@

@@{
rtcUnmapBuffer(EXPR scene,EXPR geomID,EXPR type)
=>
rtcUnmapBuffer(rtcGetGeometry(scene,geomID),type)

=>
uniform RTCGeometry geom = rtcNewQuadMesh(device,flags,numPrimitives,numVertices,numTimeSteps);
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot)
=>
rtcNewBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,4*sizeof(uniform int),numPrimitives)
}@@
@@{
rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,ptr,offset,stride,numPrimitives)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX,EXPR slot)
=>
rtcNewBuffer(geom,RTC_BUFFER_TYPE_VERTEX,slot,4*sizeof(uniform float),numVertices)
}@@
@@{
rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetBuffer(geom,RTC_BUFFER_TYPE_VERTEX,slot,ptr,offset,stride,numVertices)
}@@
@@{
rtcSetBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetBuffer(geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,slot,ptr,offset,stride,numVertices)
}@@
}@@

