CLWrapper.prototype.release = function () {
if (this._released) {
return;
}
var releaseMethod = this.createReleaseMethod();
if (releaseMethod) {
releaseMethod();
}
this._released = true;
};
CLWrapper.prototype._getInfo = function (elemType, infoName, noCache) {
return this._getInfoWith(this._infoFunction, elemType, infoName, noCache);
};
CLWrapper.prototype._getInfoWith = function (infoFunction, elemType, infoName, noCache) {
var self = this;
return this._cached(
infoName,
function() {
elemType = ref.coerceType(elemType);
var info = ref.alloc(elemType);
var err = infoFunction(self.handle, infoName, elemType.size, info, null);
self.cl.checkError(err);
var result = info.deref();
return result;
},
noCache
);
};
CLWrapper.prototype._getInfo2 = function (elemType, altFunction, device, infoName, noCache) {
var self = this;
return this._cached(
infoName,
function() {
elemType = ref.coerceType(elemType);
var info = ref.alloc(elemType);
var err = altFunction(self.handle, clUtils.toHandle(device), infoName, elemType.size, info, null);
self.cl.checkError(err);
var result = info.deref();
return result;
},
noCache
);
};
CLWrapper.prototype._getArrayInfo = function (elemType, infoName, noCache) {
var self = this;
return this._cached(
infoName,
function() {
var i;
elemType = ref.coerceType(elemType);
var needed = ref.alloc('size_t');
var err = self._infoFunction(self.handle, infoName, 0, null, needed);
self.cl.checkError(err);
var nNeeded = needed.deref();
if (nNeeded === 0) {
License: MIT
Copyright (c) 2014 Gábor Mező aka unbornchikken