Skip to content

Commit

Permalink
[Vulkan] Fix compute shader mixup of Root Layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Oct 18, 2021
1 parent 82812b3 commit da8ca4e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions OgreMain/src/OgreHlmsCompute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,22 @@ namespace Ogre
Hash hashVal;
OGRE_HASH128_FUNC( outString.c_str(), outString.size(), IdString::Seed, &hashVal );

const RenderSystemCapabilities *capabilities = mRenderSystem->getCapabilities();

if( capabilities->hasCapability( RSC_EXPLICIT_API ) )
{
// If two shaders have the exact same source code but different
// Root Layout, we should treat them differently
RootLayout rootLayout;
memset( &rootLayout, 0, sizeof( rootLayout ) );
rootLayout.mCompute = true;
job->setupRootLayout( rootLayout );

Hash hashValTmp[2] = { hashVal, Hash() };
OGRE_HASH128_FUNC( &rootLayout, sizeof( rootLayout ), IdString::Seed, &hashValTmp[1] );
OGRE_HASH128_FUNC( hashValTmp, sizeof( hashValTmp ), IdString::Seed, &hashVal );
}

CompiledShaderMap::const_iterator itor = mCompiledShaderCache.find( hashVal );
if( itor != mCompiledShaderCache.end() )
{
Expand Down

0 comments on commit da8ca4e

Please sign in to comment.