anchor.diff:              let p = t.GetProperty("Instance", BindingFlags.NonPublic ||| BindingFlags.Public ||| BindingFlags.Static)
               p.GetValue(null) |> unbox<IMod -> IMod<Array>>
           ))
  +
  +    type GeometrySignature =
  +        {
  +            mode                : IndexedGeometryMode
  +            vertexBufferTypes   : Map<Symbol, Type>
  +            uniformTypes        : Map<Symbol, Type>
  +            indexType           : Type
  +        }
  +
  +    type Attributes = Map<Symbol, BufferView>
  +    type Uniforms = Map<Symbol, IMod>
  +
   
       type ManagedBuffer(runtime : IRuntime) =
           inherit DirtyTrackingAdaptiveObject<MappedBufferWriter>()
  
positive.code: open Aardvark.Rendering.NanoVg
  
  module Pooling =
      open System.Collections.Generic
      open System.Runtime.InteropServices
      open System.Reflection
  
negative.code:         interface IMod<IBuffer> with
              member x.GetValue c = x.GetValue c
  
      type LayoutManager<'a>() =
          let manager = MemoryManager.createNop()
          let store = Dict<'a, managedptr>()
          let cnts = Dict<managedptr, 'a * ref<int>>()
  
  
          member x.Alloc(key : 'a, size : int) =
              match store.TryGetValue key with
                  | (true, v) -> 
                      let _,r = cnts.[v]
                      Interlocked.Increment &r.contents |> ignore
                      v
                  | _ ->
                      let v = manager.Alloc size
                      let r = ref 1
                      cnts.[v] <- (key,r)
                      store.[key] <- (v)
                      v
  
          member x.Free(value : managedptr) =
              match cnts.TryGetValue value with
                  | (true, (k,r)) ->
                      if Interlocked.Decrement &r.contents = 0 then
                          cnts.Remove value |> ignore
                          store.Remove k |> ignore
                  | _ ->
                      ()
  
  
      type ManagedPool(runtime : IRuntime, signature : GeometrySignature) =
          let mutable count = 0
          let indexManager = LayoutManager<BufferView>()
          let vertexManager = LayoutManager<Attributes>()
          let instanceManager = LayoutManager<Uniforms>()
  
          let indexBuffer = new ManagedBuffer(runtime)
          let vertexBuffers = SymbolDict<ManagedBuffer>()
          let instanceBuffers = SymbolDict<ManagedBuffer>()
          let isEmpty = Mod.init true
  
  
          let getVertexBuffer (sym : Symbol) =
              vertexBuffers.GetOrCreate(sym, fun sym -> new ManagedBuffer(runtime))
  
          let getInstanceBuffer (sym : Symbol) =
              instanceBuffers.GetOrCreate(sym, fun sym -> new ManagedBuffer(runtime))
  
  
          member x.IsEmpty = isEmpty :> IMod<_>
  
  