 @@{
 rtcSetBuffer(EXPR geom,RTC_BUFFER(EXPR type, EXPR slot),EXPR ptr,EXPR offset,EXPR stride)
 =>
-rtcSetBuffer(geom,type,slot,ptr,offset,stride)
+rtcSetSharedGeometryBuffer(geom,type,slot,/* FIXME: put proper format here */,ptr,offset,stride)
 }@@
 
 @@{
 rtcSetBuffer(EXPR geom,EXPR type, EXPR ptr,EXPR offset,EXPR stride)
 =>
-rtcSetBuffer(geom,type,/* FIXME: put proper slot here */,ptr,offset,stride)
-}@@
+rtcSetSharedGeometryBuffer(geom,type,/* FIXME: put proper slot here */,/* FIXME: put proper format here */,ptr,offset,stride)
+}@@
+
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_FACE, EXPR slot, EXPR format, EXPR ptr, EXPR offset, EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_FACE,float,RTC_FORMAT_UINT,ptr,offset,stride)
+}@@
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_LEVEL, EXPR slot, EXPR format, EXPR ptr, EXPR offset, EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_LEVEL,float,RTC_FORMAT_FLOAT,ptr,offset,stride)
+}@@
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX, EXPR slot, EXPR format, EXPR ptr, EXPR offset, EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,float,RTC_FORMAT_UINT2,ptr,offset,stride)
+}@@
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT, EXPR slot, EXPR format, EXPR ptr, EXPR offset, EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,float,RTC_FORMAT_FLOAT,ptr,offset,stride)
+}@@
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX, EXPR slot, EXPR format, EXPR ptr, EXPR offset, EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,float,RTC_FORMAT_UINT,ptr,offset,stride)
+}@@
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT, EXPR slot, EXPR format, EXPR ptr, EXPR offset, EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,float,RTC_FORMAT_FLOAT,ptr,offset,stride)
+}@@
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_HOLE, EXPR slot, EXPR format, EXPR ptr, EXPR offset, EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_HOLE,float,RTC_FORMAT_UINT,ptr,offset,stride)
+}@@
+
+
+
 
 @@{
 rtcEnable(EXPR scene,EXPR geomID)

}@@

@@{
rtcMapBuffer(EXPR scene,EXPR geomID,RTC_BUFFER(EXPR type, EXPR slot))
=>
rtcMapBuffer(rtcGetGeometry(scene,geomID),type,slot)
}@@

@@{
rtcMapBuffer(EXPR scene,EXPR geomID,EXPR type)
=>
rtcMapBuffer(rtcGetGeometry(scene,geomID),type,/* FIXME: put proper slot here */)
}@@

@@{

=>
uniform RTCGeometry geom = rtcNewSubdivisionMesh(device,flags,numPrimitives,numEdges,numVertices,numEdgeCreases,numVertexCreases,numHoles,numTimeSteps);
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_FACE,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_FACE,slot,RTC_FORMAT_UINT,sizeof(uniform int),numPrimitives)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_FACE,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_FACE,slot,RTC_FORMAT_UINT,ptr,offset,stride,numPrimitives)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,RTC_FORMAT_UINT,sizeof(uniform int),numEdges)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,RTC_FORMAT_UINT,ptr,offset,stride,numEdges)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX,slot,RTC_FORMAT_FLOAT3,4*sizeof(uniform float),numVertices)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX,slot,RTC_FORMAT_FLOAT3,ptr,offset,stride,numVertices)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_LEVEL,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_LEVEL,slot,format,sizeof(uniform int),numEdges)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_LEVEL,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_LEVEL,slot,format,ptr,offset,stride,numEdges)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,slot,format,2*sizeof(uniform int),numEdgeCreases)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_INDEX,slot,format,ptr,offset,stride,numEdgeCreases)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,slot,format,sizeof(uniform float),numEdgeCreases)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_EDGE_CREASE_WEIGHT,slot,format,ptr,offset,stride,numEdgeCreases)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,slot,format,sizeof(uniform int),numVertexCreases)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_INDEX,slot,format,ptr,offset,stride,numVertexCreases)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,slot,format,sizeof(uniform float),numVertexCreases)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX_CREASE_WEIGHT,slot,format,ptr,offset,stride,numVertexCreases)
}@@
@@{
rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_HOLE,EXPR slot, EXPR format)
=>
rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_HOLE,slot,format,sizeof(uniform int),numPrimitives)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_HOLE,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_HOLE,slot,format,ptr,offset,stride,numPrimitives)
}@@
@@{
rtcSetSharedGeometryBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
=>
rtcSetSharedGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,slot,format,ptr,offset,stride,numVertices) /* FIXME: verify size of this buffer! */
}@@
}@@

