[vtkusers] Invalidating the OpenGL2 shader cache

Ken Martin ken.martin at kitware.com
Wed Oct 17 07:40:43 EDT 2018


Last I heard glGet calls can sometimes stall the pipeline so I have been
trying to avoid them. I usually use the method clearing the shader cache
when mixing opengl codes and that seems to work.

On Tue, Oct 16, 2018 at 9:21 PM, Benjamin Schleimer <BSchleimer at vytronus.com
> wrote:

> Hi,
>
>    I have come across an interesting problem with VTK and I wanted to ask
> if there is another way to work around it.
>
>
> Using the OpenGL2 backend, we have discovered that if another system
> renders to the same opengl context as VTK,
>
> then the shader cache is put into an invalidated state.
>
>
> The root problem is that in Rendering/OpenGL2/vtkOpenGLShaderCache.cxx,
> in vtkOpenGLShaderCache::BindShader(), the lastShaderBound is assumed to
> not change. VTK assumes that it's the only system setting glUseProgram()
> for the opengl context.
>
> So if another system clears the GL_CURRENT_PROGRAM value, then VTK doesn't
> know about it and the following calls to set program uniforms fails with an
> opengl error.
>
>
> A suggested is to add a call to glGetIntegerv(GL_CURRENT_PROGRAM, ...)
> and compare it against this->Handle before returning.
>
>
> I worked around this problem by clearing the shader cache before invoking
> vtkRenderWindow::Render() but this required knowing that the shader cache
> was invalid.
>
>
> Sincerely,
>
> Ben
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
101 East Weaver Street
Carrboro, North Carolina
27510 USA

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181017/4f0b2262/attachment.html>


More information about the vtkusers mailing list