 =>
 uniform RTCGeometry geom = rtcNewCurveGeometry (device,type,flags,numPrimitives,numVertices,numTimeSteps);
 @@{
-rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot)
-=>
-rtcNewBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,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)
-}@@
-}@@
-
-@@{
-rtcSetBuffer(EXPR geom,EXPR type,EXPR slot,EXPR ptr,EXPR offset,EXPR stride)
-=>
-rtcSetBuffer(geom,type,slot,ptr,offset,stride,/* put buffer size here */)
-}@@
-
-@@{
-rtcUnmapBuffer(EXPR geom, EXPR type);
-=>
-}@@
-
-@@{
-rtcMapBuffer(EXPR geom,EXPR type,EXPR slot)
-=>
-rtcGetGeometryBufferData(geom,type,slot) /* FIXME: check if this should be rtcNewBuffer */
-}@@
-
-
-@@{
-rtcSetIndexBuffer(EXPR geom, RTC_BUFFER(RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE,EXPR vertexSlot) , RTC_BUFFER(RTC_BUFFER_TYPE_INDEX,EXPR indexSlot));
-=>
-rtcSetGeometryVertexAttributeTopology(geom, vertexSlot, indexSlot);
-}@@
-
-@@{
-rtcSetIndexBuffer(EXPR geom, EXPR vertexBuffer, EXPR indexBuffer);
-=>
-rtcSetGeometryVertexAttributeTopology(geom, vertexBuffer, indexBuffer);
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_INDEX,EXPR slot, EXPR format)
+=>
+rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_INDEX,slot,RTC_FORMAT_UINT,sizeof(uniform int),numPrimitives)
+}@@
+@@{
+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,numPrimitives)
+}@@
+@@{
+rtcMapBuffer(EXPR geom,RTC_BUFFER_TYPE_VERTEX,EXPR slot, EXPR format)
+=>
+rtcSetNewGeometryBuffer(geom,RTC_BUFFER_TYPE_VERTEX,slot,RTC_FORMAT_FLOAT4,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_FLOAT4,ptr,offset,stride,numVertices)
+}@@
+@@{
+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)
+}@@
+}@@
+
+
+@@{
+rtcSetSharedGeometryBuffer(EXPR geom,EXPR type,EXPR slot, EXPR format,EXPR ptr,EXPR offset,EXPR stride)
+=>
+rtcSetSharedGeometryBuffer(geom,type,slot,format,ptr,offset,stride,/* put buffer size here */)
+}@@
+
+@@{
+rtcMapBuffer(EXPR geom,EXPR type,EXPR slot, EXPR format)
+=>
+rtcGetGeometryBufferData(geom,type,slot) /* FIXME: check if this should be rtcSetNewGeometryBuffer */
 }@@
 
 

RTC_SUBDIVISION_MODE_PIN_ALL
}@@

@@{
RTCBoundaryMode
=>
RTCSubdivisionMode
}@@

@@{
RTCMatrixType
=>
RTCFormat
}@@

@@{
RTC_MATRIX_ROW_MAJOR
=>
RTC_FORMAT_FLOAT3X4_ROW_MAJOR
}@@

@@{
RTC_MATRIX_COLUMN_MAJOR
=>
RTC_FORMAT_FLOAT3X4_COLUMN_MAJOR
}@@

@@{
RTC_MATRIX_COLUMN_MAJOR_ALIGNED16
=>
RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR
}@@

///////////////////////////////////////////////////////////////////////
// convert filter function callbacks




////////////////////////////////////////////////////////////////////////////////////////
// rtcore_geometry_user.h


@@{
RTCBoundsFunc
=>
RTCBoundsFunction
}@@

@@{
void EXPR RTCBoundsFunc(void* ID geomUserPtr_in, size_t ID primID_in, RTCBounds& ID bounds_out)
{
=>
void RTCBoundsFunc(const uniform RTCBoundsFunctionArguments* const uniform args)
{
  COMMENT void* uniform userPtr = args->userPtr;
  void* uniform geomUserPtr_in = args->geomUserPtr;
  uniform size_t primID_in = args->primID;
  COMMENT uniform unsigned int time = args->time;
  uniform RTCBounds& bounds_out = *args->bounds_o;
}@@

@@{
RTCBoundsFunc2
=>
RTCBoundsFunction
}@@

@@{
void EXPR RTCBoundsFunc2(void* ID userPtr_in, void* ID geomUserPtr_in, size_t ID primID_in, RTCBounds& ID bounds_out)
{
=>
void RTCBoundsFunc2(const uniform RTCBoundsFunctionArguments* const uniform args)
{
  void* uniform userPtr_in = args->userPtr;
  void* uniform geomUserPtr_in = args->geomUserPtr;
  uniform size_t primID_in = args->primID;
  COMMENT uniform size_t time = args->time;
  uniform RTCBounds& bounds_out = *args->bounds_o;
}@@

@@{
RTCBoundsFunc3
=>
RTCBoundsFunction
}@@

@@{
void EXPR RTCBoundsFunc3(void* ID userPtr_in, void* ID geomUserPtr_in, size_t ID primID_in, size_t ID time_in, RTCBounds& ID bounds_out)
{
=>
void RTCBoundsFunc3(const uniform RTCBoundsFunctionArguments* const uniform args)
{
  void* uniform userPtr_in = args->userPtr;
  void* uniform geomUserPtr_in = args->geomUserPtr;
  uniform size_t primID_in = args->primID;
  uniform size_t time_in = args->time;
  uniform RTCBounds& bounds_out = *args->bounds_o;
}@@

@@{
RTCIntersectFunc
=>
RTCIntersectFunctionN
}@@

@@{
RTCOccludedFunc
=>
RTCOccludedFunctionN
}@@

@@{
void EXPR RTCIntersectFunc(void* ID geomUserPtr_in, RTCRay& ID ray_in, size_t ID primID_in)
{
=>
unmasked void RTCIntersectFunc(const uniform RTCIntersectFunctionNArguments* const uniform args) // FIXME: may also be RTCOccludedFunctionNArguments
{
  void* uniform valid_in = args->valid;
  varying int* uniform vvalid_in = (varying int* uniform ) valid_in;
  void* uniform geomUserPtr_in = args->geomUserPtr;
  COMMENT RTCIntersectContext* uniform context_in = args->context;
  varying RTCRay* uniform ray_ptr_in = (varying RTCRay* uniform ) args->ray;
  varying RTCRay& ray_in = *ray_ptr_in;
  uniform unsigned int N_in = args->N;
  uniform unsigned int primID_in = args->primID;
  assert(N_in == __programCount);
  if (*vvalid_in != -1) return;
}@@

@@{
RTCIntersectFunc4
=>
RTCIntersectFunctionN
}@@

@@{
RTCOccludedFunc4
=>
RTCOccludedFunctionN
}@@

@@{
void EXPR RTCIntersectFunc4(const void* ID valid_in, void* ID geomUserPtr_in, RTCRay4& ID ray_in, size_t ID primID_in)
{
=>
void RTCIntersectFunc4(const uniform RTCIntersectFunctionNArguments* const uniform args) // FIXME: may also be RTCOccludedFunctionNArguments
{
  const void* valid_in = args->valid;
  void* geomUserPtr_in = args->geomUserPtr;
  COMMENT RTCIntersectContext* context_in = args->context;
  RTCRay4& ray_in = *(RTCRay4*) args->ray;
  unsigned int N_in = args->N;
  unsigned int primID_in = args->primID;
  assert(N_in == 4);
}@@

@@{
RTCIntersectFunc8
=>
RTCIntersectFunctionN
}@@

@@{
RTCOccludedFunc8
=>
RTCOccludedFunctionN
}@@

@@{
void EXPR RTCIntersectFunc8(const void* ID valid_in, void* ID geomUserPtr_in, RTCRay8& ID ray_in, size_t ID primID_in)
{
=>
void RTCIntersectFunc8(const uniform RTCIntersectFunctionNArguments* const uniform args) // FIXME: may also be RTCOccludedFunctionNArguments
{
  const void* valid_in = args->valid;
  void* geomUserPtr_in = args->geomUserPtr;
  COMMENT RTCIntersectContext* context_in = args->context;
  RTCRay8& ray_in = *(RTCRay8*) args->ray;
  unsigned int N_in = args->N;
  unsigned int primID_in = args->primID;
  assert(N_in == 8);
}@@

@@{
RTCIntersectFunc16
=>
RTCIntersectFunctionN
}@@

@@{
RTCOccludedFunc16
=>
RTCOccludedFunctionN
}@@

@@{
void EXPR RTCIntersectFunc16(const void* ID valid_in, void* ID geomUserPtr_in, RTCRay16& ID ray_in, size_t ID primID_in)
{
=>
void RTCIntersectFunc16(const uniform RTCIntersectFunctionNArguments* const uniform args) // FIXME: may also be RTCOccludedFunctionNArguments
{
  const void* valid_in = args->valid;
  void* geomUserPtr_in = args->geomUserPtr;
  COMMENT RTCIntersectContext* context_in = args->context;
  RTCRay16& ray_in = *(RTCRay16*) args->ray;
  unsigned int N_in = args->N;
  unsigned int primID_in = args->primID;
  assert(N_in == 16);
}@@

@@{
RTCIntersectFuncN
=>
RTCIntersectFunctionN
}@@

@@{
RTCOccludedFuncN
=>
RTCOccludedFunctionN
}@@

@@{
void EXPR RTCIntersectFuncN(const int* ID valid_in, void* ID geomUserPtr_in, const RTCIntersectContext* ID context_in, RTCRayN* ID ray_in, size_t ID N_in, size_t ID primID_in)
{
=>
void RTCIntersectFuncN(const uniform RTCIntersectFunctionNArguments* const uniform args) // FIXME: may also be RTCOccludedFunctionNArguments
{
  const int* uniform valid_in = args->valid;
  void* uniform geomUserPtr_in = args->geomUserPtr;
  RTCIntersectContext* uniform context_in = args->context;
  RTCRayN* uniform ray_in = args->ray;
  uniform unsigned int N_in = args->N;
  uniform unsigned int primID_in = args->primID;
}@@


@@{
rtcSetBoundsFunction(EXPR scene,EXPR geomID,EXPR func)
=>
