clover: Override ret_object.
authorSerge Martin <edb+mesa@sigluy.net>
Tue, 17 May 2016 14:03:09 +0000 (16:03 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 12 Jul 2016 03:34:34 +0000 (20:34 -0700)
Return an API object from an intrusive reference to a Clover object,
incrementing the reference count of the object.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
src/gallium/state_trackers/clover/api/util.hpp

index 31e20e424b93d02a84c7c25c47665a1052cc725b..66bd12597c64819c4e7dd0851043e97637349556 100644 (file)
@@ -68,6 +68,17 @@ namespace clover {
          *p = desc(v());
       }
    }
+
+   ///
+   /// Return an API object from an intrusive reference to a Clover object,
+   /// incrementing the reference count of the object.
+   ///
+   template<typename T>
+   typename T::descriptor_type *
+   ret_object(const intrusive_ref<T> &v) {
+      v().retain();
+      return desc(v());
+   }
 }
 
 #endif