MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / registerResources

Method registerResources

src/backend/cuda/GraphicsResourceManager.cpp:21–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace arrayfire {
20namespace cuda {
21GraphicsResourceManager::ShrdResVector
22GraphicsResourceManager::registerResources(
23 const std::vector<uint32_t>& resources) {
24 ShrdResVector output;
25
26 auto deleter = [](cudaGraphicsResource_t* handle) {
27 // FIXME Having a CUDA_CHECK around unregister
28 // call is causing invalid GL context.
29 // Moving ForgeManager class singleton as data
30 // member of DeviceManager with proper ordering
31 // of member destruction doesn't help either.
32 // Calling makeContextCurrent also doesn't help.
33 cudaGraphicsUnregisterResource(*handle);
34 delete handle;
35 };
36
37 for (auto id : resources) {
38 cudaGraphicsResource_t r;
39 CUDA_CHECK(cudaGraphicsGLRegisterBuffer(
40 &r, id, cudaGraphicsMapFlagsWriteDiscard));
41 output.emplace_back(new cudaGraphicsResource_t(r), deleter);
42 }
43
44 return output;
45}
46} // namespace cuda
47} // namespace arrayfire

Callers 5

getImageResourcesMethod · 0.45
getPlotResourcesMethod · 0.45
getHistogramResourcesMethod · 0.45
getSurfaceResourcesMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected