Skip to content

Commit f233bdd

Browse files
committed
ShaderStateComponent : Handle ToGLTextureConverter exceptions
These were thrown if a GLSL shader had bad values for a texture parameter - the case that motivated this was a custom setup in production that would pass a CompoundData with no channels and an empty data window. We can't let the exception propagate because `addParametersToShaderSetup()` is called during drawing and the exception would prevent the rest of the scene drawing and/or lead to a corrupted GL state.
1 parent d7d3769 commit f233bdd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Fixes
55
-----
66

77
- ShaderNetworkAlgo : Fixed crash caused by cyclic connections in `removeUnusedShaders()`.
8+
- ShaderStateComponent : Fixed GL rendering failures caused by unsupported values for texture parameters.
89

910
10.5.7.1 (relative to 10.5.7.0)
1011
========

src/IECoreGL/ShaderStateComponent.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,14 @@ class ShaderStateComponent::Implementation : public IECore::RefCounted
139139
it->second->typeId() == IECore::SplinefColor3fData::staticTypeId()
140140
)
141141
{
142-
texture = IECore::runTimeCast<const Texture>( CachedConverter::defaultCachedConverter()->convert( it->second.get() ) );
142+
try
143+
{
144+
texture = IECore::runTimeCast<const Texture>( CachedConverter::defaultCachedConverter()->convert( it->second.get() ) );
145+
}
146+
catch( const std::exception &e )
147+
{
148+
IECore::msg( IECore::Msg::Error, "ShaderStateComponent", e.what() );
149+
}
143150
}
144151
else if( it->second->typeId() == IECore::StringData::staticTypeId() )
145152
{

0 commit comments

Comments
 (0)