[Interest] QtQuick2 image rendering and custom shader overhead

Sean Harmer sean.harmer at kdab.com
Sun May 5 11:47:41 CEST 2013


On 04/05/2013 19:30, Preet wrote:
> Hi,
>
> I have a couple of questions regarding images in QtQuick2.
>
> 1.
> For a resolution independent application, I tried using several images 
> (all 128x128px) that I scaled as appropriate for target devices. In 
> QtQuick1 this didn't work out so well -- scaling the images was 
> expensive and made the application slow.
>
> Can I expect image resizing/drawing to be much faster in QtQuick2? If 
> the images are directly uploaded as textures to OpenGL without being 
> scaled down CPU-side I'd imagine this to be the case.

Correct, scaling of images should essentially be free as this will be 
performed in hardware.

>
> 2.
> I'd like to use ShaderEffects to apply a somewhat trivial shader to 
> most of the images in my application. The images are black and white 
> icons, and I'd like to use shaders to change the black and white 
> output fragments to different colors (ie maybe blue and green, red and 
> yellow, etc).
>
> The shader itself is super simple and probably adds negligable cost to 
> the pipeline, but I'm concerned about how overall performance would be 
> affected compared to the default method QtQuick uses to render a bunch 
> of images.
>
> Would QtQuick still intelligently batch the images and draw them using 
> only a few calls? Or would it individually bind the same shader and 
> issue a separate draw call for each image?

Using a ShaderEffect item implies rendering the source to a texture via 
an FBO and then applying the effect's shaders to the resulting texture. 
Therefore using many ShaderEffects will produce a performance impact at 
some point. If you really have many of these items to show it would be 
better to implement a custom item using the scene graph api. Take the 
existing QSGSimpleTextureNode or image item as starting points and 
provide a custom material that renders using your colourisation shader.

This way you avoid the FBO pass for each item.

Hope this helps,

Sean

>
>
> Preet
>
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest


-- 
Dr Sean Harmer | sean.harmer at kdab.com | Senior Software Engineer
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130505/ff8f2464/attachment.html>


More information about the Interest mailing list