Results 1 to 7 of 7

Thread: ClanLib 2.4 CL_SharedGCData

  1. #1
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default ClanLib 2.4 CL_SharedGCData

    Tests/Display/WorkerGC works no problem (with ATI)

    Except when
    WorkerGC worker_gc;

    Is moved after
    CL_DisplayWindow window(desc);

    (It did this before and after my recent patches)

    It falls over in:

    Code:
    void CL_SharedGCData_Impl::remove_provider(CL_GraphicContextProvider *provider)
    {
    	if (graphic_context_providers.size() == 1)
    		dispose_objects();
    Something somewhere is not calling CL_SharedGCData::remove_disposable()

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    The ClanLib OpenGL code has been cleaned up:

    Removed CL_OpenGLWindowProvider. The class interfaced AGL/WGL/GLX was not used directly, and it made debugging tricky. CL_OpenGLWindowProvider_WGL etc is now used directly for CL_DisplayWindowProvider

    Removed CL_RenderWindowProvider. It made ClanLib internals complicated to understand. Also it caused "chicken and egg" destruction order issues. Note: ClanGL1 pbuffers disabled for now, but it's easy to fix

    Made CL_OpenGLGraphicContextProvider inherit and use CL_DisposableObject, so the display window can dispose the graphic context provider - Even when CL_GraphicContext shared pointer exists elsewhere

    Modified "CL_GLFunctions *CL_OpenGL::functions" to use cl_tls_variable

  3. #3
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Bergen, Norway
    Posts
    588

    Default

    Does this mean worker gc's should work?

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    ClanLib does not support worker graphic contexts in the sense of gc_worker = gc.create();

    But you can now create a new hidden CL_DisplayWindow inside of a worker thread, and use its CL_GraphicContext.

    The CL_Textures etc are shared with the main thread.

    I do not know if it will also work for 2 visible display windows, running in seperate threads.

  5. #5
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    I appreciate your work on this, but at least in GameIDE with my Nvidia card it doesn't seem to be working.

    If you want to try it, remove the SINGLE_THREADED define in Engine/Scene/work_queue.h. Here it produces some rather strange looking textures.

  6. #6
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    The WorkerGC example works on ATI

    On NVIDIA, the WorkerGC example does not work.

    Debugging the example on NVidia.
    Calling "glGenTextures(1, &handle);" in both the main thread and worker thread, gives identical handles.

    Maybe the OpenGL context sharing in different threads isn't working on the current NVidia drivers...
    Last edited by rombust; 01-31-2012 at 10:57 AM. Reason: info

  7. #7
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    For GameIDE and WorkerGC example:

    It works on NVIDIA when you create the CL_DisplayWindow in the main thread.

    For example:

    Code:
    	CL_DisplayWindowDescription desc;
    	desc.set_size(CL_Size(320,200), false);
    	desc.set_title("OpenGL Worker Window");
    	desc.set_visible(false);
    	CL_DisplayWindow window(desc);
    	CL_GraphicContext gc = window.get_gc();
    	windows.push_back(window);
    
    	CL_Thread thread;
    	thread.start(this, &WorkQueue::worker_main, gc);
    	threads.push_back(thread);
    Code:
    void WorkQueue::worker_main(CL_GraphicContext gc)
    {
    ...
    
    }

    But ... it crashes ATI!!!!!

    And, in my opinion, this is wrong anyway.
    Last edited by rombust; 01-31-2012 at 12:51 PM.

Bookmarks

Bookmarks

Posting Permissions

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