From afee2d2266d9dca9b92025fa4afb0290fb35c4a1 Mon Sep 17 00:00:00 2001 From: "Dmytro Yunchyk(aka DimA)" Date: Thu, 14 Sep 2023 12:21:44 +0200 Subject: [PATCH] Ogre: fixed Metal rendering on Simulator running on Arm Mac --- RenderSystems/Metal/src/OgreMetalRenderSystem.mm | 8 ++++---- RenderSystems/Metal/src/Vao/OgreMetalVaoManager.mm | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/RenderSystems/Metal/src/OgreMetalRenderSystem.mm b/RenderSystems/Metal/src/OgreMetalRenderSystem.mm index 30a957cb1aa..4d37423f0db 100644 --- a/RenderSystems/Metal/src/OgreMetalRenderSystem.mm +++ b/RenderSystems/Metal/src/OgreMetalRenderSystem.mm @@ -2277,7 +2277,7 @@ of this software and associated documentation files (the "Software"), to deal } // Setup baseInstance. -# if TARGET_OS_SIMULATOR == 0 +# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM [mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 4u atIndex:15]; # else [mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 256u atIndex:15]; @@ -2324,7 +2324,7 @@ of this software and associated documentation files (the "Software"), to deal { #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS // Setup baseInstance. -# if TARGET_OS_SIMULATOR == 0 +# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM [mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 4u atIndex:15]; # else [mActiveRenderEncoder setVertexBufferOffset:drawCmd->baseInstance * 256u atIndex:15]; @@ -2407,7 +2407,7 @@ of this software and associated documentation files (the "Software"), to deal # endif // Setup baseInstance. -# if TARGET_OS_SIMULATOR == 0 +# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM [mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 4u atIndex:15]; # else [mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 256u atIndex:15]; @@ -2437,7 +2437,7 @@ of this software and associated documentation files (the "Software"), to deal { #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS // Setup baseInstance. -# if TARGET_OS_SIMULATOR == 0 +# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM [mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 4u atIndex:15]; # else [mActiveRenderEncoder setVertexBufferOffset:cmd->baseInstance * 256u atIndex:15]; diff --git a/RenderSystems/Metal/src/Vao/OgreMetalVaoManager.mm b/RenderSystems/Metal/src/Vao/OgreMetalVaoManager.mm index 72980aa6d6a..e51baca21f0 100644 --- a/RenderSystems/Metal/src/Vao/OgreMetalVaoManager.mm +++ b/RenderSystems/Metal/src/Vao/OgreMetalVaoManager.mm @@ -138,7 +138,7 @@ of this software and associated documentation files (the "Software"), to deal // On iOS alignment must match "the maximum accessed object" type. e.g. // if it's all float, then alignment = 4. if it's a float2, then alignment = 8. // The max. object is float4, so alignment = 16 -# if TARGET_OS_SIMULATOR == 0 +# if TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM mConstBufferAlignment = 16; mTexBufferAlignment = 16; # else @@ -200,7 +200,7 @@ of this software and associated documentation files (the "Software"), to deal mSupportsPersistentMapping = true; const uint32 maxNumInstances = 4096u * 2u; -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS && TARGET_OS_SIMULATOR == 0 +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS && (TARGET_OS_SIMULATOR == 0 || OGRE_CPU == OGRE_CPU_ARM) uint32 *drawIdPtr = static_cast( OGRE_MALLOC_SIMD( maxNumInstances * sizeof( uint32 ), MEMCATEGORY_GEOMETRY ) ); for( uint32 i = 0; i < maxNumInstances; ++i )