[Mesa-dev,37/47] clover: Override ret_object.

Submitted by Francisco Jerez on July 4, 2016, 12:51 a.m.

Details

Message ID 20160704005156.5703-38-currojerez@riseup.net
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Francisco Jerez July 4, 2016, 12:51 a.m.
From: Serge Martin <edb+mesa@sigluy.net>

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>
---
 src/gallium/state_trackers/clover/api/util.hpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/gallium/state_trackers/clover/api/util.hpp b/src/gallium/state_trackers/clover/api/util.hpp
index 31e20e4..66bd125 100644
--- a/src/gallium/state_trackers/clover/api/util.hpp
+++ b/src/gallium/state_trackers/clover/api/util.hpp
@@ -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