OUT_UPDATE_SZ(compileWgSize[1]);
OUT_UPDATE_SZ(compileWgSize[2]);
/* samplers. */
- if (samplerSet) {
+ if (!samplerSet->empty()) { //samplerSet is always valid, allocated in Function::Function
has_samplerset = 1;
OUT_UPDATE_SZ(has_samplerset);
size_t sz = samplerSet->serializeToBin(outs);
}
/* images. */
- if (imageSet) {
+ if (!imageSet->empty()) { //imageSet is always valid, allocated in Function::Function
has_imageset = 1;
OUT_UPDATE_SZ(has_imageset);
size_t sz = imageSet->serializeToBin(outs);
total_size += sz;
}
+ else
+ samplerSet = NULL;
IN_UPDATE_SZ(has_imageset);
if (has_imageset) {
total_size += sz;
}
+ else
+ imageSet = NULL;
IN_UPDATE_SZ(code_size);
if (code_size) {
samplerSet = from;
}
/*! Get defined sampler size */
- size_t getSamplerSize(void) const { return samplerSet->getDataSize(); }
+ size_t getSamplerSize(void) const { return (samplerSet == NULL ? 0 : samplerSet->getDataSize()); }
/*! Get defined sampler value array */
void getSamplerData(uint32_t *samplers) const { samplerSet->getData(samplers); }
/*! Set image set. */
wg_sz[2] = compileWgSize[2];
}
/*! Get defined image size */
- size_t getImageSize(void) const { return imageSet->getDataSize(); }
+ size_t getImageSize(void) const { return (imageSet == NULL ? 0 : imageSet->getDataSize()); }
/*! Get defined image value array */
void getImageData(ImageInfo *images) const { imageSet->getData(images); }
void operator = (const ImageSet& other) {
regMap.insert(other.regMap.begin(), other.regMap.end());
}
+
+ bool empty() const { return regMap.empty(); }
+
ImageSet(const ImageSet& other) : regMap(other.regMap.begin(), other.regMap.end()) { }
ImageSet() {}
~ImageSet();
samplerMap.insert(other.samplerMap.begin(), other.samplerMap.end());
}
+ bool empty() const { return samplerMap.empty(); }
+
SamplerSet(const SamplerSet& other) : samplerMap(other.samplerMap.begin(), other.samplerMap.end()) { }
SamplerSet() {}