Skip to content

Commit

Permalink
Fix crash when runing compute shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Sep 11, 2020
1 parent 18d6f9c commit fef202a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions OgreMain/src/OgreHlmsCompute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ namespace Ogre
psoCache.setProperties.swap( job->mSetProperties );
this->mSetProperties = job->mSetProperties;

// Uset the HlmsComputePso, as the ptr may be cached by the
// RenderSystem and this could be invalidated
mRenderSystem->_setComputePso( 0 );

size_t newCacheEntryIdx = mComputeShaderCache.size();
if( mFreeShaderCacheEntries.empty() )
mComputeShaderCache.push_back( ComputePsoCache() );
Expand All @@ -469,10 +473,6 @@ namespace Ogre
if( shaderParams )
psoCache.paramsProfileUpdateCounter = shaderParams->getUpdateCounter();

// Uset the HlmsComputePso, as the ptr may be cached by the RenderSystem
// and this could be invalidated
mRenderSystem->_setComputePso( 0 );

mComputeShaderCache[newCacheEntryIdx] = psoCache;

//The PSO in the cache doesn't have the properties. Make a hard copy.
Expand Down

0 comments on commit fef202a

Please sign in to comment.