Skip to content

Commit

Permalink
Reduce shaders variability, avoiding writing to shader code lines lik…
Browse files Browse the repository at this point in the history
…e *** target_envprobe_map 1460524074
  • Loading branch information
eugenegff committed Oct 9, 2024
1 parent 886cdfe commit 4a713b8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1146,9 +1146,16 @@ namespace Ogre
if( getProperty( tid, HlmsBaseProp::Pose ) > 0 )
setProperty( tid, HlmsBaseProp::VertexId, 1 );

const int32 envProbeMapVal = getProperty( tid, PbsProperty::EnvProbeMap );
const bool canUseManualProbe =
envProbeMapVal && envProbeMapVal != getProperty( tid, PbsProperty::TargetEnvprobeMap );
const int32 envProbeMap = getProperty( tid, PbsProperty::EnvProbeMap );
const int32 targetEnvProbeMap = getProperty( tid, PbsProperty::TargetEnvprobeMap );
const bool canUseManualProbe = envProbeMap && envProbeMap != targetEnvProbeMap;

// Reduce shaders variability, reset EnvProbeMap and TargetEnvprobeMap to 1 or 0
// preserving outcome of predicate 'envprobe_map && envprobe_map != target_envprobe_map'
if( envProbeMap )
setProperty( tid, PbsProperty::EnvProbeMap, 1 );
setProperty( tid, PbsProperty::TargetEnvprobeMap, envProbeMap == targetEnvProbeMap );

if( canUseManualProbe || getProperty( tid, PbsProperty::ParallaxCorrectCubemaps ) )
{
setProperty( tid, PbsProperty::UseEnvProbeMap, 1 );
Expand Down Expand Up @@ -1368,8 +1375,6 @@ namespace Ogre
}
}

const int32 envProbeMap = getProperty( tid, PbsProperty::EnvProbeMap );
const int32 targetEnvProbeMap = getProperty( tid, PbsProperty::TargetEnvprobeMap );
if( ( envProbeMap && envProbeMap != targetEnvProbeMap ) || parallaxCorrectCubemaps )
{
if( !envProbeMap || envProbeMap == targetEnvProbeMap )
Expand Down

0 comments on commit 4a713b8

Please sign in to comment.