Skip to content

Commit

Permalink
Merge branch 'OGRECave:master' into patch-7
Browse files Browse the repository at this point in the history
  • Loading branch information
mosfet80 authored Nov 8, 2024
2 parents 2ace348 + b262400 commit 6ed2143
Show file tree
Hide file tree
Showing 84 changed files with 654 additions and 620 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ syntax: glob
*.rule
*.sdf
.DS_Store
Dependencies/*
Dependencies
iOSDependencies
build/*
SDK/OSX/sdk_contents
Expand All @@ -28,4 +28,4 @@ AndroidBuild/
AndroidDependencies/
Build/
EmscriptenDependencies
EmscriptenBuild
EmscriptenBuild
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ endif ()
# OgreAddTargets and OgreConfigTargets make use of OGRE_NEXT and OGRE_NEXT_PREFIX
option(OGRE_USE_NEW_PROJECT_NAME
"Libraries containing Ogre name will be called OgreNext, e.g. 'OgreNext.dll' instead of 'Ogre.dll'"
FALSE)
TRUE)

if( OGRE_USE_NEW_PROJECT_NAME )
set( OGRE_NEXT "OgreNext" )
Expand Down Expand Up @@ -559,7 +559,7 @@ set( OGRE_DEBUG_LEVEL_DEBUG 3 CACHE STRING
3 - High. We perform intensive validation without concerns for performance."
)
set( OGRE_DEBUG_LEVEL_RELEASE 0 CACHE STRING
"Specify debug level for Release, RelWithDebInfo and MinSizeRel builds. See OGRE_MAX_DEBUG_LEVEL_DEBUG" )
"Specify debug level for Release, RelWithDebInfo and MinSizeRel builds. See OGRE_DEBUG_LEVEL_DEBUG" )

cmake_dependent_option(OGRE_CONFIG_CONTAINERS_USE_CUSTOM_ALLOCATOR "STL containers in Ogre use the custom allocator" TRUE "" FALSE)
if( OGRE_CONFIG_ALLOCATOR EQUAL 0 )
Expand Down
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
2 changes: 1 addition & 1 deletion Components/SceneFormat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ file(

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

include_directories(${CMAKE_SOURCE_DIR}/Components/Hlms/Common/include)
include_directories(${OGRE_SOURCE_DIR}/Components/Hlms/Common/include)
ogre_add_component_include_dir(Hlms/Pbs)

add_definitions( -DOgreSceneFormat_EXPORTS )
Expand Down
6 changes: 2 additions & 4 deletions OgreMain/include/Animation/OgreBone.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace Ogre
ArrayMatrixAf4x3 const *RESTRICT_ALIAS mReverseBind;
BoneTransform mTransform;

#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
mutable bool mCachedTransformOutOfDate;
Node *mDebugParentNode;
bool mInitialized;
Expand Down Expand Up @@ -281,9 +281,7 @@ namespace Ogre
*/
FORCEINLINE const SimpleMatrixAf4x3 &_getLocalSpaceTransform() const
{
#if OGRE_DEBUG_MODE
assert( !mCachedTransformOutOfDate );
#endif
OGRE_ASSERT_MEDIUM( !mCachedTransformOutOfDate );
return mTransform.mDerivedTransform[mTransform.mIndex];
}

Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/Animation/OgreBone.inl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ THE SOFTWARE.
-----------------------------------------------------------------------------
*/

#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
#define CACHED_TRANSFORM_OUT_OF_DATE() this->setCachedTransformOutOfDate()
#else
#define CACHED_TRANSFORM_OUT_OF_DATE() ((void)0)
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/Compositor/OgreCompositorWorkspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace Ogre
/// Only valid workspaces can update without crashing
bool isValid() const { return mValid; }

void setEnabled( bool bEnabled ) { mEnabled = bEnabled; }
void setEnabled( bool bEnabled );
bool getEnabled() const { return mEnabled; }

/** When building with OGRE_PROFILING enabled, setting this option to true
Expand Down
50 changes: 43 additions & 7 deletions OgreMain/include/OgreAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#define _OgreAssert_H_

#include "OgrePrerequisites.h"
#include "debugbreak/debugbreak.h"

namespace Ogre
{
Expand All @@ -57,7 +56,46 @@ namespace Ogre
} // namespace Assert
} // namespace Ogre

#define OGRE_HALT() debug_break()
// We want to halt using macro + builtin rather than inline function, to generate debug information
// with assertion line number rather than halting machinery line number. Inspired by
// https://github.com/nemequ/portable-snippets/blob/master/debug-trap/debug-trap.h
// https://github.com/scottt/debugbreak/blob/master/debugbreak.h
#if defined( __has_builtin )
# if __has_builtin( __builtin_debugtrap )
# define OGRE_HALT() __builtin_debugtrap()
# elif __has_builtin( __debugbreak )
# define OGRE_HALT() __debugbreak()
# endif
#endif
#if !defined( OGRE_HALT )
# if defined( _MSC_VER ) || defined( __INTEL_COMPILER )
# define OGRE_HALT() __debugbreak()
# elif defined( __DMC__ ) && defined( _M_IX86 )
# define OGRE_HALT() __asm int 3h
# elif defined( __i386__ ) || defined( __x86_64__ )
# define OGRE_HALT() __asm__ __volatile__( "int3" )
# elif defined( __thumb__ )
# define OGRE_HALT() __asm__ __volatile__( ".inst 0xde01" )
# elif defined( __aarch64__ )
# define OGRE_HALT() __asm__ __volatile__( ".inst 0xd4200000" )
# elif defined( __arm__ )
# define OGRE_HALT() __asm__ __volatile__( ".inst 0xe7f001f0" )
# elif defined( __alpha__ ) && !defined( __osf__ )
# define OGRE_HALT() __asm__ __volatile__( "bpt" )
# elif defined( __powerpc__ )
# define OGRE_HALT() __asm__ __volatile__( ".4byte 0x7d821008" )
# elif defined( __riscv )
# define OGRE_HALT() __asm__ __volatile__( ".4byte 0x00100073" )
# else
# include <signal.h>
# if defined( SIGTRAP )
# define OGRE_HALT() raise( SIGTRAP )
# else
# define OGRE_HALT() raise( SIGABRT )
# endif
# endif
#endif

#define OGRE_UNUSED( x ) \
do \
{ \
Expand Down Expand Up @@ -126,12 +164,10 @@ namespace Ogre
# define OGRE_VERIFY_MSG( cond, msg, ... ) ( (void)0 )
#endif

#if __cplusplus >= 201103L
#if __cplusplus >= 201703L || defined( _MSVC_LANG ) && _MSVC_LANG >= 201703L
# define OGRE_STATIC_ASSERT( x ) static_assert( x )
#else // C++11
# define OGRE_STATIC_ASSERT( x ) static_assert( x, # x )
#else
# define OGRE_STATIC_ASSERT( x ) \
typedef char OgreStaticAssert[( x ) ? 1 : -1]; \
OGRE_UNUSED( OgreStaticAssert );
#endif

#endif
13 changes: 7 additions & 6 deletions OgreMain/include/OgreDescriptorSetSampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,18 @@ namespace Ogre

void checkValidity() const
{
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
size_t totalSamplersUsed = 0u;

for( size_t i = 0; i < NumShaderTypes; ++i )
totalSamplersUsed += mShaderTypeSamplerCount[i];

assert( totalSamplersUsed > 0 &&
"This DescriptorSetSampler doesn't use any sampler! Perhaps incorrectly setup?" );
assert( totalSamplersUsed == mSamplers.size() &&
"This DescriptorSetSampler doesn't use as many samplers as it "
"claims to have, or uses more than it has provided" );
OGRE_ASSERT_MEDIUM(
totalSamplersUsed > 0 &&
"This DescriptorSetSampler doesn't use any sampler! Perhaps incorrectly setup?" );
OGRE_ASSERT_MEDIUM( totalSamplersUsed == mSamplers.size() &&
"This DescriptorSetSampler doesn't use as many samplers as it "
"claims to have, or uses more than it has provided" );
#endif
}
};
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreFileSystemLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace Ogre
*/
const Ogre::String getConfigFilePath( Ogre::String filename ) const
{
#if OGRE_DEBUG_MODE == 1 && \
#if OGRE_DEBUG_MODE && \
( OGRE_PLATFORM != OGRE_PLATFORM_APPLE && OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS )
// add OGRE_BUILD_SUFFIX (default: "_d") to config file names
Ogre::String::size_type pos = filename.rfind( '.' );
Expand Down
4 changes: 1 addition & 3 deletions OgreMain/include/OgreNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,7 @@ namespace Ogre
*/
virtual_l2 FORCEINLINE const Matrix4 &_getFullTransform() const
{
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
assert( !mCachedTransformOutOfDate );
#endif
OGRE_ASSERT_MEDIUM( !mCachedTransformOutOfDate );
return mTransform.mDerivedTransform[mTransform.mIndex];
}

Expand Down
3 changes: 3 additions & 0 deletions OgreMain/include/OgrePlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,12 @@ THE SOFTWARE.
// No checks done at all
#define OGRE_DEBUG_NONE 0
// We perform basic assert checks and other non-performance intensive checks
// This setting must NOT break the ABI. i.e. a binary compiled with OGRE_DEBUG_LOW
// must be ABI compatible with a binary compiled without it.
#define OGRE_DEBUG_LOW 1
// We alter classes to add some debug variables for a bit more thorough checking
// and also perform checks that may cause some performance hit
// This setting or higher is allowed to break the ABI.
#define OGRE_DEBUG_MEDIUM 2
// We perform intensive validation without concerns for performance
#define OGRE_DEBUG_HIGH 3
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgrePrerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace Ogre

#define OGRE_UNUSED_VAR( x ) ( (void)x )

#if __cplusplus >= 201703L
#if __cplusplus >= 201703L || defined( _MSVC_LANG ) && _MSVC_LANG >= 201703L
# define OGRE_FALLTHROUGH [[fallthrough]]
#else
# if OGRE_COMPILER == OGRE_COMPILER_CLANG
Expand Down
9 changes: 4 additions & 5 deletions OgreMain/include/OgreRenderSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,16 +316,15 @@ namespace Ogre
See TextureFlags::TextureFlags.
Relevant flags are:
NotTexture
RenderToTexture
Uav
@param depthTextureFlags
Only used if format is a colour pixel format.
Same as textureFlags, but for associated depth buffer if format.
RenderWindowSpecific
@return
Supported sample description for requested FSAA mode, with graceful downgrading.
*/
virtual SampleDescription validateSampleDescription( const SampleDescription &sampleDesc,
PixelFormatGpu format, uint32 textureFlags,
uint32 depthTextureFlags );
PixelFormatGpu format,
uint32 textureFlags );

/** Creates a new rendering window.
@remarks
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreRenderSystemCapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ namespace Ogre

bool hasMinVersion( int minMajor, int minMinor, int minRel ) const
{
return major > minMajor || ( major == minMajor && minor >= minMinor ) ||
return major > minMajor || ( major == minMajor && minor > minMinor ) ||
( major == minMajor && minor == minMinor && release >= minRel );
}
};
Expand Down
2 changes: 1 addition & 1 deletion OgreMain/include/OgreSceneNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ namespace Ogre

NodeMemoryManager *getDefaultNodeMemoryManager( SceneMemoryMgrTypes sceneType ) override;

#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
void _setCachedTransformOutOfDate() override;
#endif
};
Expand Down
24 changes: 11 additions & 13 deletions OgreMain/src/Animation/OgreBone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ THE SOFTWARE.
#include "OgreLogManager.h"
#include "OgreNode.h"

#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
# define CACHED_TRANSFORM_OUT_OF_DATE() this->setCachedTransformOutOfDate()
#else
# define CACHED_TRANSFORM_OUT_OF_DATE() ( (void)0 )
Expand All @@ -49,7 +49,7 @@ namespace Ogre
IdObject( 0 ),
mReverseBind( 0 ),
mTransform( BoneTransform() ),
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
mCachedTransformOutOfDate( true ),
mDebugParentNode( 0 ),
mInitialized( false ),
Expand All @@ -65,15 +65,15 @@ namespace Ogre
//-----------------------------------------------------------------------
Bone::~Bone()
{
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
assert( !mInitialized && "Must call _deinitialize() before destructor!" );
#endif
}
//-----------------------------------------------------------------------
void Bone::_initialize( IdType id, BoneMemoryManager *boneMemoryManager, Bone *parent,
ArrayMatrixAf4x3 const *RESTRICT_ALIAS reverseBind )
{
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
assert( !mInitialized );
mInitialized = true;
#endif
Expand Down Expand Up @@ -130,14 +130,14 @@ namespace Ogre
mReverseBind = 0;
mBoneMemoryManager = 0;

#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
mInitialized = false;
#endif
}
//-----------------------------------------------------------------------
void Bone::setCachedTransformOutOfDate() const
{
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
mCachedTransformOutOfDate = true;

BoneVec::const_iterator itor = mChildren.begin();
Expand Down Expand Up @@ -213,7 +213,7 @@ namespace Ogre
//-----------------------------------------------------------------------
void Bone::_setNodeParent( Node *nodeParent )
{
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
mDebugParentNode = nodeParent;
#endif
if( nodeParent )
Expand Down Expand Up @@ -251,9 +251,7 @@ namespace Ogre
//-----------------------------------------------------------------------
Matrix4 Bone::_getDerivedTransform() const
{
#if OGRE_DEBUG_MODE
assert( !mCachedTransformOutOfDate );
#endif
OGRE_ASSERT_MEDIUM( !mCachedTransformOutOfDate );
OGRE_ALIGNED_DECL( Matrix4, localSpaceBone, OGRE_SIMD_ALIGNMENT );
OGRE_ALIGNED_DECL( Matrix4, parentNodeTransform, OGRE_SIMD_ALIGNMENT );

Expand Down Expand Up @@ -312,7 +310,7 @@ namespace Ogre
/*
mat.storeToAoS( mTransform.mDerivedTransform );
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
for( size_t j=0; j<ARRAY_PACKED_REALS; ++j )
{
if( mTransform.mOwner[j] )
Expand Down Expand Up @@ -367,7 +365,7 @@ namespace Ogre
derivedTransform = nodeMat * derivedTransform;
derivedTransform.streamToAoS( t.mFinalTransform );

#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
for( size_t j = 0; j < ARRAY_PACKED_REALS; ++j )
{
if( t.mOwner[j] )
Expand Down Expand Up @@ -403,7 +401,7 @@ namespace Ogre
}
}
//-----------------------------------------------------------------------
#if OGRE_DEBUG_MODE
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
void Bone::_setCachedTransformOutOfDate() { mCachedTransformOutOfDate = true; }
#endif
} // namespace Ogre
Expand Down
Loading

0 comments on commit 6ed2143

Please sign in to comment.