Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intel GPU selection investigation #5734

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/GafferUI/StandardStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,6 @@ void StandardStyle::bind( const Style *currentStyle ) const
return;
}

glEnable( GL_BLEND );
glBlendFuncSeparate( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
glUseProgram( shader()->program() );

if( IECoreGL::Selector *selector = IECoreGL::Selector::currentSelector() )
Expand All @@ -592,6 +590,13 @@ void StandardStyle::bind( const Style *currentStyle ) const
selector->pushIDShader( shader() );
}
}
else
{
// Enable blending only for non-selection renders as it can
// corrupt the selection buffer on some graphics hardware.
glEnable( GL_BLEND );
glBlendFuncSeparate( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
}
}

Imath::Box3f StandardStyle::characterBound( TextType textType ) const
Expand Down Expand Up @@ -1129,8 +1134,6 @@ void StandardStyle::renderImage( const Imath::Box2f &box, const IECoreGL::Textur
{
glPushAttrib( GL_COLOR_BUFFER_BIT );

// As the image is already pre-multiplied we need to change our blend mode.
glEnable( GL_BLEND );
if( !IECoreGL::Selector::currentSelector() )
{
// Some users have reported crashes that were traced back to this call
Expand All @@ -1139,6 +1142,9 @@ void StandardStyle::renderImage( const Imath::Box2f &box, const IECoreGL::Textur
// didn't correspond to actual gadgets.
// Don't change it when rendering the selection pass since
// blending should not be applied to an integer buffer anyways.

// As the image is already pre-multiplied we need to change our blend mode.
glEnable( GL_BLEND );
glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA );
}

Expand Down
4 changes: 3 additions & 1 deletion src/GafferUI/ViewportGadget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,9 @@ void ViewportGadget::renderInternal( RenderReason reason, Gadget::Layer filterLa
if( reason != RenderReason::Draw )
{
// We're doing selection so post-processing doesn't matter. Just
// render direct to output buffer.
// render direct to output buffer without blending as that can
// corrupt the selection buffer on some graphics hardware.
glDisable( GL_BLEND );
renderLayerInternal( reason, layer, viewTransform, bound, selector );
continue;
}
Expand Down
Loading