StagingBuffer: add OpenCL buff handles to StimFrames
This commit is contained in:
@@ -2,8 +2,13 @@
|
||||
#define _ATTACHMENT_SUPPORT_STIMULUS_FRAME_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <user/frameAssemblyDesc.h>
|
||||
#include <user/sequenceLock.h>
|
||||
#include <user/compute.h>
|
||||
#include <user/senseApiDesc.h>
|
||||
#define CL_TARGET_OPENCL_VERSION 120
|
||||
#include <CL/cl.h>
|
||||
|
||||
namespace smo {
|
||||
namespace stim_buff {
|
||||
@@ -69,9 +74,30 @@ public:
|
||||
*/
|
||||
StimulusFrame() = default;
|
||||
|
||||
StimulusFrame(const FrameAssemblyDesc::SlotDesc& slotDesc_)
|
||||
StimulusFrame(
|
||||
const FrameAssemblyDesc::SlotDesc& slotDesc_,
|
||||
const SmoCallbacks& callbacks,
|
||||
cl_mem_flags flags)
|
||||
: slotDesc(slotDesc_)
|
||||
{}
|
||||
{
|
||||
if (!callbacks.ComputeManager_createUseHostPtrBuffer)
|
||||
{
|
||||
throw std::runtime_error(std::string(__func__)
|
||||
+ ": StimulusFrame: ComputeManager_createUseHostPtrBuffer "
|
||||
"callback is null");
|
||||
}
|
||||
|
||||
clBuffer = callbacks.ComputeManager_createUseHostPtrBuffer(
|
||||
slotDesc.vaddr, slotDesc.nBytes, flags);
|
||||
|
||||
if (!clBuffer)
|
||||
{
|
||||
throw std::runtime_error(std::string(__func__)
|
||||
+ ": StimulusFrame: failed to create clBuffer");
|
||||
}
|
||||
|
||||
std::cout << __func__ << ": StimulusFrame: created clBuffer with size " << slotDesc.nBytes << " bytes @ " << (const void*)slotDesc.vaddr << std::endl;
|
||||
}
|
||||
|
||||
~StimulusFrame() = default;
|
||||
|
||||
@@ -85,6 +111,7 @@ public:
|
||||
SequenceLock lock;
|
||||
SimultaneityStamp simultaneityStamp;
|
||||
FrameAssemblyDesc::SlotDesc slotDesc;
|
||||
std::shared_ptr<smo::compute::ClBuffer> clBuffer;
|
||||
};
|
||||
|
||||
} // namespace stim_buff
|
||||
|
||||
Reference in New Issue
Block a user