Results 1 to 2 of 2

Thread: encapsulate context creation

  1. #1

    encapsulate context creation

    Hello,

    I need to use the opencl context and its associated command queues across several classes and therefore i am planning to encapsulate the opencl context creation into a single class and make a singleton instance of it. That instance will be used by several other class objects in the application.

    Is my plan in the right direction ?

    Is it necessary to use the clRetainContext() some where here ?


    Thanks

  2. #2
    Senior Member
    Join Date
    Dec 2011
    Posts
    170
    Seems reasonable.

    As long as your class that holds the context holds it until everyone is done, then you don't need additional retain/release calls since the singleton class holds a reference count.

    If you are using C++ might also investigate using the OpenCL C++ wrapper classes; they offer some convenience over the C API.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •