[Interest] QtQuick2 image rendering and custom shader overhead

Sean Harmer sean.harmer at kdab.com
Mon May 6 09:49:05 CEST 2013


On Monday 06 May 2013 06:39:06 Sletta Gunnar wrote:
> On May 5, 2013, at 11:47 AM, Sean Harmer <sean.harmer at kdab.com> wrote:
> > On 04/05/2013 19:30, Preet wrote:
> >> Hi,
> 
> ...
> 
> >> 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.
> 
> This is not quite correct :)

Oops yeah sorry. I was assuming more complex case but even then the FBO pass 
is only done when the input changes not every frame.

Sean




More information about the Interest mailing list