std::shared_ptr<LayerRAM> LayerGL2RAMConverter::createFrom( std::shared_ptr<const LayerGL> layerGL) const { auto layerRAM = createLayerRAM(layerGL->getDimensions(), layerGL->getLayerType(), layerGL->getDataFormat()); if (layerRAM) { layerGL->getTexture()->download(layerRAM->getData()); return layerRAM; } else { LogError("Cannot convert format from GL to RAM:" << layerGL->getDataFormat()->getString()); } return nullptr; }
std::shared_ptr<LayerRAM> LayerCL2RAMConverter::createFrom( std::shared_ptr<const LayerCL> layerCL) const { uvec2 dimensions = layerCL->getDimensions(); auto destination = createLayerRAM(dimensions, layerCL->getLayerType(), layerCL->getDataFormat()); if (destination) { layerCL->download(destination->getData()); // const cl::CommandQueue& queue = OpenCL::getInstance()->getQueue(); // queue.enqueueReadLayer(layerCL->getLayer(), true, glm::size3_t(0), // glm::size3_t(dimensions, // 1), 0, 0, layerRAM->getData()); } else { LogError("Invalid conversion or not implemented"); } return destination; }
std::shared_ptr<LayerRepresentation> Layer::createDefaultRepresentation() const { return createLayerRAM(getDimensions(), getLayerType(), getDataFormat()); }