[Development] Qt3D on windows

Sean Harmer sean.harmer at kdab.com
Mon Oct 13 10:47:01 CEST 2014


Hey Gunnar,

On 13/10/2014 06:48, Gunnar Sletta wrote:
> On 12 Oct 2014, at 22:18, Sean Harmer <sean.harmer at kdab.com> wrote:
>
>> On 12/10/2014 21:08, Ray Donnelly wrote:
>>> On Sun, Oct 12, 2014 at 8:56 PM, Sean Harmer <sean.harmer at kdab.com> wrote:
>>>> Hi,
>>>>
>>>> just a quick heads up that Qt3D's wip/newapi branch now displays content
>>>> usign threaded rendering on windows. I've tested with MSVC 2012 OpenGL
>>>> x86_64 build with nVidia driver. Your mileage may vary with other
>>>> drivers, compilers and OpenGL configurations. I wouldn't be surprised to
>>>> find a few places need tweaks with a dynamic OpenGL build.
>>> Angle doesn't do multithreaded rendering, will it be possible to use
>>> Qt3D on Angle?
>> Well, we're only doing actual GL calls on a single thread, it just
>> happens that it's not the main thread.
> Does that include the QOpenGLContext creation? We've thus far required that QOpenGLContext gets created on the GUI thread and then moved to the rendering thread.

Yes, this includes creating the context on a non-GUI thread. Before 
tackling this in Qt3D I made a simple QtGui + OpenGL example that loops 
a number of times and in each loop creates a QWindow (on the GUI thread) 
and spawns a QThread subclass which creates a QOpenGLContext and then 
renders with it.

Without any synchronisation I was getting strange crashes inside the QPA 
which iirc may be related to the use of the static context inside the 
QPA. However, as long as I serialise the QWindow::create() and the 
QOpenGLContext::create() calls between the two threads it works 
perfectly having the GL context created on a non-gui thread.

I'll see if this is also the case on other platforms (i.e. if it's a 
limitation of the windows QPA). From the MSDN docs and reading around it 
looks like it should be fine to create hDCs on additional threads as 
long as each hDC is only used on one thread at a time. The window hWND 
has affinity with the creating thread which must be the GUI thread in Qt.

I'll see about extracting the example I was using and adding it to QtGui.

Cheers,

Sean

>
> cheers,
> Gunnar
>
>> If ANGLE supports that then yes,
>> we have an ES 2 backend that can be used. If not we'll need to try to
>> come up with an alternative solution but to be honest we have enough
>> variations dealing with real OpenGL implementations so we shall see how
>> much of a time sink it becomes.
>>
>> Cheers,
>>
>> Sean
>>
>> -- 
>> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
>> Klarälvdalens Datakonsult AB, a KDAB Group company
>> Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
>> KDAB - Qt Experts - Platform-independent software solutions
>>
>> _______________________________________________
>> Development mailing list
>> Development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development


-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions




More information about the Development mailing list